-
Notifications
You must be signed in to change notification settings - Fork 181
Add tool description to tool start event #880
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -698,9 +698,21 @@ def call_stream( | |||||||||||||||||||||||||
tool_number=tool_index, | ||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||
tool_params = ( | ||||||||||||||||||||||||||
json.loads(t.function.arguments) if t.function.arguments else {} | ||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||
tool = self.tool_executor.get_tool_by_name(t.function.name) | ||||||||||||||||||||||||||
description = ( | ||||||||||||||||||||||||||
tool.get_parameterized_one_liner(tool_params) if tool else None | ||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||
yield StreamMessage( | ||||||||||||||||||||||||||
event=StreamEvents.START_TOOL, | ||||||||||||||||||||||||||
data={"tool_name": t.function.name, "id": t.id}, | ||||||||||||||||||||||||||
data={ | ||||||||||||||||||||||||||
"tool_name": t.function.name, | ||||||||||||||||||||||||||
"id": t.id, | ||||||||||||||||||||||||||
"params": tool_params, | ||||||||||||||||||||||||||
"description": description, | ||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||
Comment on lines
+710
to
+715
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use computed tool_name and normalized params in START_TOOL payload Follow-up to the parsing fix: rely on the precomputed variables and avoid direct t.function access. Also normalize params to a dict to keep payload shape stable. - data={
- "tool_name": t.function.name,
- "id": t.id,
- "params": tool_params,
- "description": description,
- },
+ data={
+ "tool_name": tool_name,
+ "id": t.id,
+ "params": tool_params or {},
+ "description": description,
+ }, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
for future in concurrent.futures.as_completed(futures): | ||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against invalid JSON and custom tool calls in streaming path
Two issues:
Apply this safer parsing and resolution:
📝 Committable suggestion