Skip to content

Structured Output: support custom JSON schema #725

@repko-artem

Description

@repko-artem

Currently the only way to pass a json schema as response_format is to use PropertyDefinition class.
But unfortunately it supports only subset of allowed JSON schema format. I.e. it doesn't support such attributes as anyof and definitions while they're fully supported by OpenAI models:
https://platform.openai.com/docs/guides/structured-outputs#for-anyof-the-nested-schemas-must-each-be-a-valid-json-schema-per-this-subset
https://platform.openai.com/docs/guides/structured-outputs#definitions-are-supported

Do you have some nearest plan to support these json schema features by adding them to PropertyDefinition class or to make possible to pass just a json schema?
I.e. official OpenAI lib uses System.BinaryData class for it:
https://github.com/openai/openai-dotnet/blob/9308b2b16acc8b259aad0d76855d436dca4f569f/src/Custom/Chat/ChatResponseFormat.cs#L92

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions