Tool Calling - access to ToolResponseMessage #2913
Replies: 2 comments
-
|
+1 |
Beta Was this translation helpful? Give feedback.
-
|
Step 1: Understand the Limitation This means ToolResponseMessages (raw tool outputs like IDs, metadata, etc.) are not persisted in memory by default. As you noticed, InMemoryChatMemory and MessageChatMemoryAdvisor only store User and Assistant messages, not tool responses. Step 2: Use Manual Tool Management (Current Workaround)
java
Why this works: Step 3: Extend Memory to Capture Tool Responses
java Why this works: Step 4: Track Options in a ChecklistHere’s a quick comparison of approaches:
Step 5: Future Suggestion
Final NoteRight now, there’s no built-in way to access ToolResponseMessages with
Both approaches ensure you retain IDs and metadata for subsequent interactions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When using tools with
ChatModelandinternalToolExecutionEnabledset totrue, the tool calls are made internally, and the results are passed directly to the AI model.In many cases, it would be helpful to have access to the results of those tool calls for subsequent interactions. For example, if a tool returns a list of entities with both an ID and a name/label, the Assistant Message typically only exposes the name/label. If a later interaction requires the ID, it is no longer available.
Disabling
internalToolExecutionEnabledand manually managing tool calls viaToolCallingManagersolves this problem, since you can accesstoolExecutionResult.conversationHistory(), which includes allUser,Assistant, andToolmessages.However, is there a way to access the full conversation history — including
ToolResponseMessages— without having to manually manage tool calls?I tried using
InMemoryChatMemoryandMessageChatMemoryAdvisor, but they did not persistToolResponseMessages.If this functionality is not currently available, I believe it would be a valuable addition to the framework.
⸻
Beta Was this translation helpful? Give feedback.
All reactions