I testing tool calling and I have a simple question.
Inthe docs the response you are supposed to send to the ai is:
...
"messages": [{
"role": "user",
"content": "What is the weather like in Boston?"
}],
"tools": [{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
}],
Question and problem I gave is. Do I have to send the triage of responses, 1 my request. Second the API's response and then a tool resoult from me. Currently I am sending conversation history and tool response but then the code exectution stops right at the get. When I change the actual "role" from "tool" to "user" the tool responds fine
FOR more info here's bits of my code.
The test function
def phony_tool(query, call):
return{"role": "tool",
"name": "search_data",
"tool_call_id": f"{call}",
"content": f"No data on:{query}"
}