genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[py] openai: add constrained generation

Open timere-nemo opened this issue 1 year ago • 1 comments

timere-nemo avatar Mar 27 '25 23:03 timere-nemo

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.

cabljac avatar Jul 20 '26 20:07 cabljac