Get tool_call_id from iterable response #987
Unanswered
nitanmarcel
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Based on my very limited experience, you can generate a unique ID (e.g., a UUID) manually and include it in both messages to keep track of tool calls. For example: [
{"role": "system", "content": "You are an AI assistant..."},
{"role": "user", "content": "user prompt"},
{
"role": "assistant", "content": null, "tool_calls": [
{"id": "a4de1832-71bb-483d-9b58-85b97c11639e", "function": {"name": "Search...", "arguments": "{\"a\": \"1234\"}"}, "type": "function"}
]
},
{"role": "tool", "content": "{...}", "tool_call_id": "a4de1832-71bb-483d-9b58-85b97c11639e"}
] Each time I initiate a tool call, I generate a UUID and assign it to both the However, if I misunderstood your concern, feel free to elaborate! Let me know if this solution aligns with your requirements. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use openai to execute consecutive commands in a shell, one after another based on the response of the previous command. For this I need to pass a new message with the role tool, and the result of the command. This requires the model to know which tool id to use. How can I retreive the tool_call_id?
Beta Was this translation helpful? Give feedback.
All reactions