3 ms·
You have to explicitly opt into it by passing strict=True https://platform.openai.com/docs/guides/structured-outputs/supported-schemas https://platform.openai.c
by simonw 1y ago
You have to explicitly opt into it by passing strict=True https://platform.openai.com/docs/guides/structured-outputs/supported-schemas https://platform.openai.com/docs/guides/structured-outputs/s...
- jawiggins 1y agoAre you able to use `strict=True` when using pydantic models? It doesn't seem to be valid for me. I think that only works for json schemas. class FooBar(BaseModel): foo: list[str] bar: list[int] prompt = """#Task Your job is to reply with Foo Bar, a json object with foo, a list of strings, and bar, a list of ints """ response = openai_client.chat.completions.parse( model="gpt-5-nano-2025-08-07", messages=[{"role": "system", "content": FooBar}], max_completion_tokens=4096, seed=123, response_format=CommentAnalysis, strict=True ) > TypeError: Completions.parse() got an unexpected keyword argument 'strict'