Skip to content

m serve OpenAI API structured output #824

@markstur

Description

@markstur

From the parent issue...

  1. Request Fields: Accepted but IgnoredThis field is parsed into the model_options dict but the endpoint does not map it to Mellea concepts.
Field What Should Happen
response_format json_object or json_schema should map to the format= parameter on instruct().
  1. Mellea-Specific Concepts That Need API Surface

e) Structured Output / Format
instruct() accepts format: type[BaseModel] for constrained decoding. OpenAI's
response_format only supports text or json_object, but newer versions add a
json_schema type with an inline JSON Schema.

Approach: Support the OpenAI response_format.type = "json_schema" field with
an inline schema. On the server side, dynamically construct a Pydantic model from
the JSON schema and pass it as format=.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions