genkit
genkit copied to clipboard
[py] openai: add constrained generation
Doing a pass over older issues. Constrained generation is supported now. _get_response_format builds a strict json_schema response_format from the request's output schema, and falls back to json_object mode for models that don't take a schema natively (e.g. DeepSeek, handled by _needs_schema_in_prompt), which then get the schema injected via prompt (py/packages/genkit-openai/src/genkit_openai/models/model.py:122,141). Closing as fixed.