Skip to content

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

@dmeyeroc

Description

@dmeyeroc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategory: Something isn't working and appears to be a defect in the client library.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions