You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "weiqingy (via GitHub)" <gi...@apache.org> on 2026/10/19 07:04:12 UTC
[PR] [api][python][integrations] Share the native output model helper across chat model connections [flink-agents]
weiqingy opened a new pull request, #1277:
URL: https://github.com/apache/flink-agents/pull/1277
Linked issue: #1266
### Purpose of change
Six Python chat model connections each had a private `_native_output_model`, and vLLM imported the OpenAI one. Every copy picks the Pydantic model a connection sends as a native structured-output schema. This PR moves that choice into one public helper, `native_output_model`, in `flink_agents/api/agents/types.py`, next to `render_output_schema`. All seven connections now call it.
A change to which models go native now touches one place instead of six, and the copies can no longer drift apart.
Each connection's request builder stays as it is. This is a refactor with no behavior change.
### Behavioral Semantics
- `native_output_model` returns the `BaseModel` subclass inside an `OutputSchema`. It returns `None` for no schema and for a `RowTypeInfo`. Every copy returned the same for the values a connection receives.
- DashScope's copy read the attribute with `getattr`, so it also accepted an object that is not an `OutputSchema` but has an `output_schema` attribute. The shared helper checks `isinstance(output_schema, OutputSchema)`, like the other five copies. No caller passes such an object: Python callers pass an `OutputSchema` or `None`, and a Python chat model reached from Java never receives a schema.
### Tests
No new tests. The existing native structured-output tests cover every caller of the helper:
- A helper that always returns `None` fails the native structured-output tests of all seven connections.
- A helper that lets a `RowTypeInfo` through fails the `RowTypeInfo` tests of the six connections that have one.
Local run (macOS, Python 3.11): `pytest flink_agents/integrations/chat_models flink_agents/api/agents/tests -m "not integration"` passes, 451 tests. `ruff check` and `ruff format --check` (0.11.13) pass on the changed files.
### API
Adds one public function, `native_output_model`, to `flink_agents.api.agents.types`. The removed `_native_output_model` functions were module-private. Java has nothing to align: each Java connection checks `outputSchema instanceof Class` inline.
### Documentation
<!-- Do not remove this section. Check the proper box only. -->
- [ ] `doc-needed` <!-- Your PR changes impact docs -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-included` <!-- Your PR already contains the necessary documentation updates -->
### Was this patch authored or co-authored using generative AI tooling?
<!-- Do not remove this section. Check the proper box only. -->
- [x] Yes
- [ ] No
Generated-by: GitHub Copilot CLI 1.0.98 (Claude Opus 5.5)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [api][python][integrations] Share the native output model helper across chat model connections [flink-agents]
Posted by "wenjin272 (via GitHub)" <gi...@apache.org>.
wenjin272 merged PR #1277:
URL: https://github.com/apache/flink-agents/pull/1277
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org