I have made a function for the OpenAI function calling, but I have found that the models don’t ask for the parameters and just make up them. Does someone know how to solve this problem?
I’m facing the same / similar issue. Despite having:
"required": ["reminder", "new_date", "new_time"]
my function just keeps calling even when my query does not include a date or time or day. It just keeps returning and empty new_date and new_time:
"function_call": {
"arguments": "{\n \"reminder\": \"email tony about the apocalypse\",\n \"new_date\": \"\",\n \"new_time\": \"\"\n}"
From what I understand, it is supposed to ask me for the information if its missing from required from what I saw in the cook book.
im using gpt-3.5-turbo-0613 btw. please assist.
If GPT makes up the parameters, then instruct it in the system message to only call the function(s) if it can be inferred from the users request, else start follow-up questions to clarify missing parameters.
Be very strict with the instruction. Use words/sentences like “It is mandatory …”, “strictly follow …”, etc.
Be positive with the commands. Avoid negative sentences like “You are not allowed to …”, “Do not …”, etc.
Yeah managed to wrangle it to make it work. But just going off the open ai examples. it seems like just having the function name in the “required” array seemed to implement a strict requirement on the model. but it did not seem to work. so trying o figure out if its an issue with the model or sth.
Hi Jirpm. You should state to the model “not to make up the parameters”, when defining the system´s message. Example is in the cookbook:
{“role”: “system”, “content”: “Don’t make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous.”}
I’m also having this problem but the accepted solution (and other solutions) are not working for me. Here’s my function definition:
{
"name": "start_timer",
"description": "Starts a timer based on the seconds given",
"parameters": {
"type": "object",
"properties": {
"seconds": {
"type": "integer",
"description": "The number of seconds for the timer"
}
},
"required": ["seconds"]
}
}
Here’re my messages:
[
{"role": "system", "content": "Don't make assumptions about what values to plug into functions. Ask for clarification if a user request is ambiguous."},
{"role": "user", "content": "give me a timer"}
]
This results in a function call with a 60 as the value for seconds.
I’ve tried a number of system message variations based on PriNova’s comment but have not been able to get it to work.
Running into the same issue here. I am telling the system:
It's mandatory to only call functions provided and request user input for parameters
It might seem awkward, but you need to implement your api so that it returns a json like { error: invalid value for property XYZ, assistant action : ask user for a valid value for property XYZ } … or something like this …
Required property in json schema and system messages have currently no reliable effect .
I know that in some scenarios it’s not clear when ai made up a parameter… but for now I managed to cover all scenarios (e.g. for email address when it make up a value it is always like *@example.com)
Yes! This seems to do the trick, was getting a little frustrated with the prompt training. Returning error data for the missing field(s), will result in the user being prompted for the information as instructed in the training and function description.