-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Langchain memory support + ArtifactMemory #57
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- IxSequence now checks if memory has a truthy value to avoid memory=None - MapSubchain now passes memory to the IxSequence it creates
…ins in the config
- added get_memory_options for consistently fetching memory class options - memory and backend are split into load_memory and load_chat_memory_backend - load_memory now supports both lists and single configs - added parse_scope helper for parsing session config and returning a session_id - adds tests for new loading helpers - adds tests for IXSequence, MapSubchains - MockMemory now has a session_id property for testing with memory
Updated docs for memory: - General docs + config - ArtifactMemory
This was referenced May 29, 2023
Merged
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds general support for Langchain memory classes + adds
ArtifactMemory
Memory
All Langchain memory classes that extend
BaseMemory
should be supported unless they have custom loading requirements. (e. g.BaseChatMemory
required a backend loader for persistence storage).Memory loader will set
session_id
based onsession
config for the memory or backend class. Memory may be scoped tochat
,agent
,task
, oruser
and allows grouping within those scopes. This provides a very flexible system for shared and localized memory.Example use cases:
Artifact Memory
Artifact Memory class for loading
{artifact}
references into the context. The user or a bot may include a reference to a name/key and the memory class will provide it as an input for the chain & prompt template.Demo of new ChatInput including artifact references
Changes
Chain memory
Chains now support Langchain memory
load_memory
andload_chat_memory_backend
helpersget_memory_session
helper for parsing session info out of runtime contextLLMChain
,LLMReply
,IXSequence
,MapSubchain
now support memory.LLMChain
now filters inputs keys provided bymemory
out ofinput_keys
to support memory set directly on the chain when used inside aSequence
.ArtifactMemory
ArtifactMemory
ArtifactMemory
to Coder v1Artifact.data
for loading artifact content (e.g. from file)Artifact.as_memory_text()
for rendering artifactsChat
ChatMutation
now parses{artifact}
references from input intoartifact_keys
Misc
IxCallbackManager
now hastask_id
,chat_id
,agent_id
,user_id
propertiesfake_chat
now allows task to be passed by kwargmock_callback_manager
now creates a chat if one does not existHow Tested
@pirate
TODOs