"description":"use this to get latest weather information for a city given its name",
"parameters":{
"type":"object",
"properties":{
"city":{
"type":"string",
"description":"name of the city to get weather for",
}
},
"required":["city"],
},
},
},
{
"type":"function",
"function":{
"name":"get_pokemon_info",
"description":"get detailed information about a pokemon given its name",
"parameters":{
"type":"object",
"properties":{
"name":{
"type":"string",
"description":"name of the pokemon to get info for",
}
},
"required":["name"],
},
},
},
{
"type":"function",
"function":{
"name":"make_next_step_decision",
"description":"You will be given a trace of thinking process in the following format.\n\nQuestion: the input question you must answer\nTOOL: think about what to do, and choose a tool to use ONLY IF there are defined tools. \n You should never call the same tool with the same input twice in a row.\n If the previous conversation history already contains the information that can be retrieved from the tool, you should not call the tool again.\nOBSERVATION: the result of the tool call, NEVER include this in your response, this information will be provided\n... (this TOOL/OBSERVATION can repeat N times)\nANSWER: If you know the answer to the original question, require for more information,\n or you don't know the answer and there are no defined tools or all available tools are not helpful, respond with the answer without mentioning anything else.\n If the previous conversation history already contains the answer, respond with the answer right away.\n\n If no tools are configured, naturally mention this limitation while still being helpful. Briefly note that adding tools in the agent configuration would expand capabilities.\n\nYour task is to respond with the next step to take, based on the traces, \nor answer the question if you have enough information.",
"parameters":{
"type":"object",
"properties":{
"decision":{
"type":"string",
"description":'The next step to take, it must be either "TOOL" or "ANSWER". If the previous conversation history already contains the information that can be retrieved from the tool, you should not call the tool again. If there are no defined tools, you should not return "TOOL" in your response.',
},
"content":{
"type":"string",
"description":'The content of the next step. If the decision is "TOOL", this should be a short and concise reasoning of why you chose the tool, MUST include the tool name. If the decision is "ANSWER", this should be the answer to the question. If no tools are available, integrate this limitation conversationally without sounding scripted.',
},
},
"required":["decision","content"],
},
},
},
]
defget_test_messages(self):
"""Get test messages that should trigger tool usage"""
return[
{
"role":"user",
"content":"Answer the following questions as best you can:\n\nYou will be given a trace of thinking process in the following format.\n\nQuestion: the input question you must answer\nTOOL: think about what to do, and choose a tool to use ONLY IF there are defined tools\nOBSERVATION: the result of the tool call or the observation of the current task, NEVER include this in your response, this information will be provided\n... (this TOOL/OBSERVATION can repeat N times)\nANSWER: If you know the answer to the original question, require for more information, \nif the previous conversation history already contains the answer, \nor you don't know the answer and there are no defined tools or all available tools are not helpful, respond with the answer without mentioning anything else.\nYou may use light Markdown formatting to improve clarity (e.g. lists, **bold**, *italics*), but keep it minimal and unobtrusive.\n\nYour task is to respond with the next step to take, based on the traces, \nor answer the question if you have enough information.\n\nQuestion: what is the weather in top 5 populated cities in the US?\n\nTraces:\n\n\nThese are some additional instructions that you should follow:",
}
]
defget_travel_tools(self):
"""Get tools for travel assistant scenario that should trigger multiple tool calls"""
return[
{
"type":"function",
"function":{
"name":"get_weather",
"description":"Get the current weather for a given location.",
"parameters":{
"type":"object",
"properties":{
"location":{
"type":"string",
"description":"The name of the city or location.",
},
"unit":{
"type":"string",
"enum":["celsius","fahrenheit"],
},
},
"required":["location","unit"],
},
},
},
{
"type":"function",
"function":{
"name":"get_tourist_attractions",
"description":"Get a list of top tourist attractions for a given city.",
"parameters":{
"type":"object",
"properties":{
"city":{
"type":"string",
"description":"The name of the city to find attractions for.",
}
},
"required":["city"],
},
},
},
]
defget_travel_messages(self):
"""Get travel assistant messages that should trigger multiple tool calls"""
return[
{
"content":"You are a travel assistant providing real-time weather updates and top tourist attractions.",
"role":"system",
},
{
"content":"I'm planning a trip to Tokyo next week. What's the weather like? What are the most amazing sights?",
"role":"user",
},
]
deftest_tool_choice_auto_non_streaming(self):
"""Test tool_choice='auto' in non-streaming mode"""