Skip to content

Some models ran through OpenAI-compatible APIs need JSON schema in instructions even when native structured output is used #3490

@xcpky

Description

@xcpky

Description

Currently, reponse_format is set to json_object for PromptedOutput if json object is supported.

It's better to set it to json schema if json schema is supported just like native output, before checking the json_object.

The problem with NativeOutput is that, for many endpoints, enabling structured output alone without guiding in the prompt causes bad and unstable response. After all the model doesn't know the schema, it's just logits mask. Openai is a notable exception though.

I can contribute to this if the proposal is OK for the maintainers.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions