Skip to content

Support Structured Output As A Chat Completion Response Format #47

@LuisOsta

Description

@LuisOsta

Problem

Currently only two response formats are supported:

Solution

Add a new ChatCompletionResponseFormat variant for the json schema. There's a few ways to implement this that vary in complexity:

  • Support Schema Builder like how OpenAI libraries do for Python and Javascript. I think relying on something like https://crates.io/crates/schemars would be the simplest approach for schema building but I can imagine that would
  • Take in a schema via a JSON string and have the user be responsible for building that JSON schema and converting it into a JSON string themselves

There could be other alternative that I haven't noticed as well

Alternatives

Currently I use the Chat messages to communicate the schema via human language

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions