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

   <!--
   * 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: #913
   
   ### Purpose of change
   
   <!-- What is the purpose of this change? -->
   
   `create_model_from_java_tool_schema_str` read 
`properties[name]["description"]`
   directly, but Java's `SchemaUtils.generateSchema` only emits a 
`"description"`
   key when a `@ToolParam` has a non-empty description 
(`ToolParam.description()`
   defaults to `""`). A description-less param — which the project's own tools
   produce, e.g. `@ToolParam(name = "a")` — therefore crashed the Python schema
   converter with `KeyError: 'description'`.
   
   Read it with `.get()` so the existing `if description is None` fallback
   fabricates the default `"Parameter: <name>"` description instead of crashing.
   
   Closes #913
   
   ### Tests
   
   <!-- How is this change verified? -->
   
   Added `test_model_from_java_schema_without_description`, covering a property
   with no `description` key. It fails on `main` with `KeyError: 'description'`
   (`utils.py:196`) and passes with this change.
   
   - `pytest flink_agents/api/tools/`: 16 passed.
   - `ruff check --no-fix` / `ruff format --check` (pinned 0.11.13): clean.
   
   ### API
   
   <!-- Does this change touches any public APIs? -->
   
   No. The function signature and contract are unchanged; it only stops raising
   `KeyError` for a schema that omits `description`, falling back to the default
   description that the surrounding code already implements. The Java schema
   generator is untouched.
   
   ### 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 -->


-- 
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