Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting response_format 'json_schema' not supported error when using assistant with GPT-4o #276

Open
dmeyeroc opened this issue Oct 30, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@dmeyeroc
Copy link

Service

OpenAI

Describe the bug

I am attempting to generate a structured output response using response_format = json_schema with an Assistant run using GPT-4o. When I attempt to execute the run, I get the following error:

Parameter: response_format

Invalid parameter: 'response_format' of type 'json_schema' is not supported with model version `gpt-4o`.

It's my understanding via this documentation that GPT-4o (which currently points to gpt-4o-2024-08-06) that this should be supported.

Additionally when attempting a simple chat completion specifying json_schema as the response_format via Postman, it works correctly.

This makes me think this could be a bug in the .NET library itself.

Steps to reproduce

Call CreateThreadAndRunAsync() using GPT-4o, with response format configured to return a specific schema.
Error is returned

Code snippets

// Most relevant snippets of code exemplifying the problem

var runCreationOptions = new RunCreationOptions()
{
    ResponseFormat = AssistantResponseFormat.CreateJsonSchemaFormat(Name, MySchema, Description, true),
    ModelOverride = "GPT-4o"
};

...

await _openAIAssistantsClient.CreateThreadAndRunAsync(_assistantId, threadCreationOptions, runCreationOptions);

// error

OS

Windows Server 2016 Standard

.NET version

.NET Core 2.2

Library version

2.0.0

@dmeyeroc dmeyeroc added the bug Something isn't working label Oct 30, 2024
@WillsB3
Copy link

WillsB3 commented Oct 31, 2024

FWIW I'm getting the same error using the JS SDK.

@goswamishashwatpuri
Copy link

Same error in JS SDK

@gregzo
Copy link

gregzo commented Nov 4, 2024

Same here when configuring an assistant in the UI. Setting the response type to JSON_SCHEMA displays the following error on save:

Invalid parameter: 'response_format' of type 'json_schema' is not supported with model version 'gpt-4o'.

@Todorcevic
Copy link

The error arises from a limitation in model compatibility with response_format: json_schema. Although some recent models support this setting (gpt-4o-mini, gpt-4o-mini-2024-07-18, and gpt-4o-2024-08-06), this does not guarantee that every GPT-4o variant is covered.

Suggestions
Try explicitly specifying a compatible model, such as gpt-4o-2024-08-06, instead of GPT-4o to ensure compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants