Hey,
I’ve been exploring your models and experimenting with function calling, but I’m encountering an issue. My example keeps returning “Invalid function calling output” errors from the API.
my example request body to your service API
{
"messages": [
{
"role": "system",
"content": "Your answer should be in the same language as the initial query.\nThink step by step.\nDo not call a tool if the input depends on another tool output you dont have yet.\nDo not try to answer until you get tools output, if you dont have an answer yet you can continue calling tools until you do.\nYour answer should be in the same language as the initial query.\nYou are a helpful assistant.\n"
},
{
"role": "user",
"content": "What is the weather in LA?"
},
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_d3494f7a409c4a9aa7",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\":\"LA\"}"
}
}
]
},
{
"role": "tool",
"content": "It's 25 degrees Celcius and sunny.",
"name": "get_weather",
"tool_call_id": "call_d3494f7a409c4a9aa7"
},
{
"role": "system",
"content": "Please respond conversationally to the user"
},
{
"role": "assistant",
"content": "The weather in LA is 25 degrees Celcius and sunny."
},
{
"role": "user",
"content": "what about NY?"
}
],
"model": "Meta-Llama-3.1-405B-Instruct",
"temperature": 0.2,
"max_tokens": 200,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"n": 1,
"stream": false,
"tool_choice": "auto",
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string"
}
},
"required": [
"location"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
}
}
]
}
gives 200 error response
{
"error": {
"code": null,
"message": "ModelMetaclass object argument after ** must be a mapping, not str",
"model_output": "{\"name\": \"get_weather\", \"parameters\": \"{\\\"location\\\": \\\"NY\\\"}\"}",
"param": null,
"type": "Invalid function calling output."
}
}
Hope you can help me.
Thanks