weiqingy opened a new pull request, #919:
URL: https://github.com/apache/flink-agents/pull/919

   Linked issue: #280
   
   Stacked on #843 (the structured-output foundation). Until #843 merges, this 
PR's diff includes the foundation commit; it will rebase to a single commit 
once #843 lands. Please review #843 first.
   
   ### Purpose of change
   
   Applies OpenAI's native structured output on top of the foundation in #843.
   
   The OpenAI completions connection overrides the schema-carrying `chat` and 
requests `response_format` json_schema strict when native applies, and declares 
the capability predicate over the effective model.
   
   Native applies only when the schema is a POJO class (Java) or a `BaseModel` 
subclass (Python) and the effective model supports it. Per OpenAI's 
structured-output guide, json_schema is supported on `gpt-4o-mini` and the 
`gpt-4o` snapshots from `2024-08-06` onward, while `gpt-4-turbo` and 
`gpt-3.5-turbo` have JSON mode only. Because "and later" is a snapshot cutoff 
rather than a name prefix, the predicate matches `gpt-4o-mini` by prefix (its 
whole family post-dates the cutoff) and the capable `gpt-4o` snapshots exactly, 
so a pre-cutoff snapshot such as `gpt-4o-2024-05-13` falls back to the prompt 
path instead of failing at the provider. A `RowTypeInfo` schema stays on the 
prompt path.
   
   No path passes a schema on the chat call yet, so behavior is unchanged; 
native output is exercised by direct callers and the unit tests.
   
   ### Tests
   
   Java: the request carries `response_format` json_schema strict when a 
capable model and a POJO schema are supplied; the capability predicate is 
model-dependent (an incapable and a pre-cutoff same-family snapshot both 
resolve to not-capable); null schema and non-POJO schema keep the prompt path.
   
   Python: the same coverage over the `BaseModel` path, including the 
pre-cutoff snapshot regression test and policy behavior.
   
   Java OpenAI module tests and the Python suite pass; lint and license checks 
are clean.
   
   ### API
   
   Touches the OpenAI connection: overrides the schema-carrying `chat` and 
declares the capability predicate. No new user-facing surface beyond the 
foundation in #843.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to