feat: Update InMemoryChatMessageStore, ChatMessageRetriever, ChatMessageWriter
#388
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.
Related Issues
Proposed Changes:
indexparameter to all methods. Theindexparam is meant to be a unique identifier for the chat session whose messages should be retrieved. We require the index parameter at runtime to make it easy to handle many different chat sessions with one chat message store.indexparameter.new_messagesparameter that will append these new messages to the end of the list of retrieved messages. This enables the patternChatPromptBuilder-->ChatMessageRetriever-->ChatGenerator/Agentwithout needing to use anOutputAdapterto combine the outputs of theChatPromptBuilderand theChatMessageRetriever.is_storedto the meta of the retrievedChatMessage's. This is used to make it easier to know which ChatMessage's to skip if the full chat history + new messages are passed into a downstreamChatMessageWriter(e.g. such as the output from Agent)indexparameter.TODOs
last_kto either be rounds of user-agent interactions instead of last k number of messages. Or try to keep it aslast_knumber of messages but only return a valid list of messages. E.g. A LLM provider will complain if a Tool Result message is sent without it's corresponding Tool Call message.ChatPromptBuilderto accept a list of messages (example below). This would allow for more flexibility in deciding how the chat history should be managed and would allow us to remove this functionality from theChatMessageRetrieverHow did you test it?
Notes for the reviewer
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.