add get_tool_call_name method to extract tool name from ToolCallItem#728
Closed
syedmuneeb321 wants to merge 2 commits intoopenai:mainfrom
syedmuneeb321:main
Closed
add get_tool_call_name method to extract tool name from ToolCallItem#728syedmuneeb321 wants to merge 2 commits intoopenai:mainfrom syedmuneeb321:main
syedmuneeb321 wants to merge 2 commits intoopenai:mainfrom
syedmuneeb321:main
Conversation
Adds a utility method get_tool_call_name to extract the name of a tool from a ToolCallItem. Useful for identifying which tool was invoked during agent execution.
Adds a class method tool_response_output that extracts and returns the output data from a ToolCallOutputItem. This helps retrieve the result of a tool call in agent workflows.
rm-openai
requested changes
May 21, 2025
Comment on lines
+253
to
+255
| def get_tool_call_name(cls, tool_call: ToolCallItem) -> str: | ||
| """Returns the tool name from a ToolCallItem.""" | ||
| return tool_call.raw_item.name |
Collaborator
There was a problem hiding this comment.
can we just add this to ToolCallItem instead? so you can just do item.tool_name
Author
There was a problem hiding this comment.
But I used it inside ItemHelper, like how you made different methods that take out the agent’s message.
Collaborator
There was a problem hiding this comment.
Yeah, those are for Responses APIitems, to which we cannot add methods because they are not part of this SDK (they are in the openai sdk). Doing item.tool_name is far better devx than ItemHelper.get_tool_call_name(item)
Contributor
|
This PR is stale because it has been open for 10 days with no activity. |
Contributor
|
This PR was closed because it has been inactive for 7 days since being marked as stale. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a utility method get_tool_call_name to extract the name of a tool from a ToolCallItem. Useful for identifying which tool was invoked during agent execution.