Error 500 with gpt4o mini and function call

Hi,
My prompt to gpt4o mini includes a tool call.

Half the calls are rejected with openai.InternalServerError: Error code: 500 - {‘error’: {‘message’: 'The server had an error processing your request. Sorry about that! You can retry your request, or contact us…}} when the prompt does not necessitate a tool call.

This happens whether or not some arguments of the tool are ‘required’: True

It does not happen with GPT4o.

Are others seeing the issue or more likely something wrong with our code?

Thanks

Instructing the model to call the function with an empty string when no data is found seems to solve the issue:

If there is … in the query, call the tool with empty string “”.

If the model might not feel confident in filling out the provided schema fields, you can also start the root object with a schema that has anyOf, with two alternate schemas – either one based on your data, or one where the AI can reply and can say what the problem was with selecting the schema where data is required.

Another technique is a second function that can escape from function-calling when invoked in error, with “response to user, not to any external tool”.

2 Likes