Update tool definitions handling in GatewayRunner
- Modified the retrieval of tool definitions to use the agent result's "tools" key, ensuring accurate logging in the transcript. - Enhanced the response structure to include tools in the final output, improving the clarity of tool usage in session interactions.
This commit is contained in:
parent
0f58dfdea4
commit
635bec06cb
1 changed files with 3 additions and 1 deletions
|
|
@ -450,7 +450,7 @@ class GatewayRunner:
|
||||||
# definitions as the first entry so the transcript is self-describing
|
# definitions as the first entry so the transcript is self-describing
|
||||||
# -- the same list of dicts sent as tools=[...] in the API request.
|
# -- the same list of dicts sent as tools=[...] in the API request.
|
||||||
if not history:
|
if not history:
|
||||||
tool_defs = tools_holder[0]
|
tool_defs = agent_result.get("tools", [])
|
||||||
self.session_store.append_to_transcript(
|
self.session_store.append_to_transcript(
|
||||||
session_entry.session_id,
|
session_entry.session_id,
|
||||||
{
|
{
|
||||||
|
|
@ -896,6 +896,7 @@ class GatewayRunner:
|
||||||
"final_response": error_msg,
|
"final_response": error_msg,
|
||||||
"messages": result.get("messages", []),
|
"messages": result.get("messages", []),
|
||||||
"api_calls": result.get("api_calls", 0),
|
"api_calls": result.get("api_calls", 0),
|
||||||
|
"tools": tools_holder[0] or [],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Scan tool results for MEDIA:<path> tags that need to be delivered
|
# Scan tool results for MEDIA:<path> tags that need to be delivered
|
||||||
|
|
@ -934,6 +935,7 @@ class GatewayRunner:
|
||||||
"final_response": final_response,
|
"final_response": final_response,
|
||||||
"messages": result_holder[0].get("messages", []) if result_holder[0] else [],
|
"messages": result_holder[0].get("messages", []) if result_holder[0] else [],
|
||||||
"api_calls": result_holder[0].get("api_calls", 0) if result_holder[0] else 0,
|
"api_calls": result_holder[0].get("api_calls", 0) if result_holder[0] else 0,
|
||||||
|
"tools": tools_holder[0] or [],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start progress message sender if enabled
|
# Start progress message sender if enabled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue