Skip to content

CopyContext - Both ChatContext and AgentContext #24

Description

@wisedev-pstach

Description:
Currently, when creating a new ChatContext or AgentContext, there is no easy way to carry over information or context from a previous session. The idea of this feature is to implement a method called CopyContext, which would allow a new context to load and append information from an existing one, enabling a seamless flow of topics, chats, or other related context across different sessions.

This functionality will ensure that previous chats and topics are preserved and can be referenced in future conversations. Ideally, this mechanism should support multiple appends, where new context can be added without overwriting the previous context. Additionally, we can explore whether LLamaSharp provides any built-in capabilities to facilitate this, or if it can be achieved by embedding previous chats as resources within new ones.

Implementation Plan:

  • Implement a WithContext method that allows a new ChatContext or AgentContext to import and append context from an existing one.
  • Ensure the new context does not overwrite the previous context but appends new information to it.
  • Explore LLamaSharp features to determine if it has native support for context persistence or contextual data transfer. If not, implement a custom solution that can achieve similar results. (Embedding previous chat data can be an option) as resources for the new context.

Validation Steps:

  1. Create an initial ChatContext or AgentContext with topics and messages.
  2. Create a new ChatContext or AgentContext and call WithContext to import the old context.
  3. Ensure that the new context appends the topics, messages, or knowledge base from the old context without overwriting them.
  4. Test the behavior by calling WithContext multiple times and verify that previous contexts are preserved and appended correctly.

Expected Behavior:

  • The WithContext method should allow the new context to append the context of previous chats or agents.
  • Repeated use of WithContext should accumulate context without overwriting existing data.
  • The new context should become aware of previous topics, conversations, or knowledge as needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeatureNew work being planned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions