You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
messages = [
{
"role": "system",
"content": "If needed, leverage the tools at your disposal to answer the user question, otherwise provide the answer."
},
{
"role": "user",
"content": "What's the weather in Napoleon's hometown?"
}
]
tools = [
{
"type": "function",
"function": {
"name": "get_home_town",
"description": "Get the home town of a specific person",
"parameters": {
"type": "object",
"properties": {
"person": {
"type": "string",
"description": "The name of a person (first and last names) to identify.",
}
},
"required": ["person"],
},
},
},
{
"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",
},
},
"required": ["location"],
},
},
},
]
{
"role": "assistant",
"content": "To answer your question, I need to first find out Napoleon's hometown and then check the current weather there. Let me use the functions provided to me.
First, I'll use the \"get_home_town\" function to find out Napoleon's hometown.
[{\"name\": \"get_home_town\", \"arguments\": {\"person\": \"Napoleon Bonaparte\"}}]"
}
Expected Behavior
The user question is "What's the weather in Napoleon's hometown?".
I expected the model to choose the first tool get_home_town() with a Napoleon parameter.
Instead, the model decided to answer a plain-text in english describing the tool call to make. Although the described tool call is the right one, I expect to get an actual tool call as output.
Expected behavior (got it without system message): Right behavior
Suggested Solutions
For now, my solution is to not specify a system message to avoid the model going verbose.
Inherent problem seems to be at train level, where the model seems to have seen less system + user messages followed with a <|startoftool|> token. Speculating here though.
The text was updated successfully, but these errors were encountered:
Thanks for opening this issue. We are aware that our models might have issues with function calling. What you said with system prompts is really interesting, I am escalating this to our science team.
The next generation of our models will be much better :) Thanks for the feedback anyway, I'll close as there is nothing we can do at the moment on the client side.
Input
Model
mistral-large-latest
Request Payload
Output
Expected Behavior
The user question is "What's the weather in Napoleon's hometown?".
I expected the model to choose the first tool
get_home_town()
with a Napoleon parameter.Instead, the model decided to answer a plain-text in english describing the tool call to make. Although the described tool call is the right one, I expect to get an actual tool call as output.
I expected the following:
Interestingly, I do get
mistral-large-latest
to yield this tool call if I remove thesystem
prompt.Additional Context
Here are the traces for my trials:
system
message): Right behaviorSuggested Solutions
For now, my solution is to not specify a
system
message to avoid the model going verbose.Inherent problem seems to be at train level, where the model seems to have seen less
system
+user
messages followed with a <|startoftool|> token. Speculating here though.The text was updated successfully, but these errors were encountered: