Assistant API always uses custom functions, if the response_format: 'json_schema' is enabled

If I select ‘text’ in response_format, it will check the prompt and decide whether to use functions or not.
But if the response_format: ‘json_schema’ is enabled, Assistant API always uses custom functions, regardless of the prompt, even if it was just simple “How are you?”

I want to make it only use functions if they are required to use for a prompt, in the json_schema response_format.

Here is create Assistant configuration:

async createAssistant(name: string, instructions: string) {
    const assistant = await openai.beta.assistants.create({
      name,
      instructions,
      model: 'gpt-4o-2024-08-06',
      tools: [
        {
          type: 'function',
          function: MY_CUSTOM_FUNCTION,
        },
      ],
      response_format: {
        type: 'json_schema',
        json_schema: {
          name: 'collab_response',
          strict: true,
          schema: collabAISchema,
        },
      },
    });
1 Like