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

   <!--
   * Thank you very much for contributing to Flink Agents.
   * Please add the relevant components in the PR title. E.g., [api], 
[runtime], [java], [python], [hotfix], etc.
   -->
   
   <!-- Please link the PR to the relevant issue(s). Hotfix doesn't need this. 
-->
   Linked issue: #1395
   
   ### Purpose of change
   
   `FunctionSchema` writes a `@ToolParam(nullable = true)` parameter as 
`"type": [<type>, "null"]`, but 
`OllamaChatModelConnection.convertToOllamaTools` read every property type as a 
`String`, so any chat call with such a tool failed with a `ClassCastException`. 
ollama4j's `Tools.Property` takes a single type name, so a type list is now 
sent as its first non-null type. Everything else about the conversion is 
unchanged.
   
   ### Behavioral Semantics
   
   <!-- For a non-trivial code change whose implementation is largely 
AI-assisted: interaction decisions, behavioral contracts, and failure behavior. 
See `contribution-guides/ai-assisted-pr.md`. Remove this heading and this 
comment otherwise. -->
   
   #### Behavioral contracts
   
   1. A property whose `type` is a string is converted exactly as before.
   2. A property whose `type` is a list is sent with the first entry that is 
not `"null"`; its description and required flag are kept.
   3. The Python Ollama connection passes the schema through unchanged and is 
not affected.
   
   ### Tests
   
   New `OllamaChatModelConnectionTest#testNullableParameterTypeList` fails on 
main with the `ClassCastException` and passes with this change. `mvn verify -pl 
integrations/chat-models/ollama`: 38 tests pass, spotless clean.
   
   ### API
   
   No public API change.
   
   ### 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
   
   If yes, include a `Generated-by: <tool name and version> (<model name and 
version>)` line, for example `Generated-by: Claude Code 2.1.226 (Claude Opus 
4.6)`, in the commit message so it reaches Git history. Repeat the same line 
here for reviewer visibility. See the [ASF generative tooling 
guidance](https://www.apache.org/legal/generative-tooling.html).
   
   Generated-by: Claude Code 2.1.259 (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: [email protected]

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

Reply via email to