haruki-830 opened a new pull request, #4504:
URL: https://github.com/apache/flink-cdc/pull/4504
This PR introduces a generic AI model client API and adds support for using
AI functions in YAML pipeline jobs:
```yaml
transform:
- source-table: db.users
projection: ID, AI_COMPLETE('chat_model', CONTENT, 'Complete the text')
AS COMPLETED
pipeline:
model:
- name: chat_model
type: openai-compatible
options:
model-name: your-model
endpoint: https://example.com/v1
api-key: your-api-key
```
The model client is discovered through the common `Factory` SPI and
validated with `FactoryHelper`. It is created during pipeline translation and
follows the `open`/`close` lifecycle of the transform operator.
This PR provides the generic model API and runtime integration. The concrete
OpenAI-compatible model client will be introduced in a follow-up PR.
The new API is added alongside the existing Model API. No existing model API
is removed. Framework changes are limited to the following:
- Added `AiModelClient`, `ModelContext`, `AiModelClientFactory`, and
capability interfaces for text generation and embedding.
- Added factory-based YAML model definitions using `name`, `type`, and
`options`.
- Kept compatibility with the existing `model-name`/`class-name`
configuration and legacy model UDF API.
- Added the generic `AI_COMPLETE` and `AI_EMBED` functions.
- Added validation for constant model arguments, undeclared models, invalid
model names, and duplicate declarations.
- Added a Dummy model for testing, together with YAML parser, Factory,
Calcite/Janino, runtime, MiniCluster, and E2E coverage.
---
##### Was generative AI tooling used to co-author this PR?
- [x] Yes (please specify the tool below)
Generated-by: Codex (gpt-5.6-sol)
--
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]