haruki-830 commented on code in PR #4520:
URL: https://github.com/apache/flink-cdc/pull/4520#discussion_r3911914732
##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/TransformParser.java:
##########
Review Comment:
Thanks for the suggestion! I agree that this direction makes sense.
Deferring model resolution to evaluation time would remove the literal-only
restriction in `JaninoCompiler` and enable dynamic model selection such as:
>
```sql
AI_COMPLETE(
IF(important_job, 'ultimate_model', 'cheap_model'),
content,
prompt
)
```
>
One possible implementation would be to introduce an internal
`AiModelClientResolver` that wraps the existing `Map<String, AiModelClient>`
held by the transform operators and inject it into the evaluation scope as a
single parameter. `JaninoCompiler` would preserve the model argument as a
regular string expression and pass both the resolver and the evaluated model
name to `AiFunctions`. The function could then preserve the existing `NULL`
short-circuit behavior before resolving the client and validating its
capability at evaluation time.
>
For literal model names, we could retain the existing validation as a
fail-fast pre-check, while still using the same runtime resolution path during
evaluation.
>
Since this changes the shared evaluation pipeline for the entire AI function
family introduced in #4512, rather than only the image functions added by this
PR, would you prefer this to be handled in a separate JIRA and PR, or should I
include it in this PR?
--
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]