We have a few functions that require very few inputs, but can accept much more optionally.
I’ve noticed that GPT 3.5 and 4 (even the newest from 1106) will sometimes still ask a follow-up question asking for a non-required parameter before calling the function.
We’ve already mentioned in the system prompt to only ask for required parameters, with additional language saying “Not to ask for optional parameters”…sometimes this works, but not all the time.
What is the point of a Open API spec if it doesn’t really follow it?
In the past I got around this by using list fields for the optional function parameters. I found it’s easier for the model to return an empty list as the argument when the parameter isn’t needed. I admit it’s not a perfect solution and may not be well-suited for all cases, but it worked for me.
Having the same problem.
Checking in to see of there are any updates in the way either of you ultimately approached this.
@zachary.schillaci What do you mean by a list field? is that something Python specific or does it apply if I’m writing javascript as well? Would this just translate to passing in an array in javascript?
I was speaking in Python terms, but yes I mean an optional array field which defaults to an empty array. This allows the model to optionally pass one or more parameters as an array input. The example function schema would look something like this:
{'properties': {'optional_fields': {'items': {},
'title': 'Optional Fields',
'type': 'array'},
'required_field': {'title': 'Required Field',
'type': 'integer'}},
'required': ['required_field'],
'title': 'ExampleSchemaWithOptionalListField',
'type': 'object'}
Note that the array field is not required.
1 Like
Thank you very much. I’ll try this out.