spring-projects / spring-projects/spring-ai
Model Tool Calls not persisted in chat memory
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Bug description
When adding a MessageChatMemoryAdvisor to my chat client. I would expect it to persist all messages, including the tool calls that the model makes. However, when getting the final chatResponse, I can only see the user message and the final model response in the chat memory.
Environment
Java 21, SpringAI M4, InMemoryChatMemory
Steps to reproduce
- Create a chat client with at least one tool call and add a
MessageChatMemoryAdvisorwith anInMemoryChatMemoryinstance passed in to it. - Make a user query which invokes the tool call
- Investigate the ChatMemory instance and see that only the user input and the model response are included in the history.
Expected behavior
I expected to also be able to see the model tool calls in the ChatHistory
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the tool-call flow with MessageChatMemoryAdvisor and InMemoryChatMemory, then trace how the user message, tool calls, and final model response are added to chat history. Done means the ChatMemory history includes the model tool calls as well as the user input and final response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- ai, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100