Zhuoxi2000 opened a new issue, #913:
URL: https://github.com/apache/flink-agents/issues/913

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   `create_model_from_java_tool_schema_str`
   (`python/flink_agents/api/tools/utils.py`) reads
   `properties[param_name]["description"]` directly. But the Java side only 
emits
   a `"description"` key when a `@ToolParam` has a non-empty description —
   `SchemaUtils.generateSchema` (`plan/.../tools/SchemaUtils.java`) skips it 
when
   `ToolParam.description()` is `""` (the default). So a Java tool with a
   description-less param — which the project's own tools produce, e.g.
   `@ToolParam(name = "a")` in `FunctionToolTest.calculate` — makes the Python
   converter raise `KeyError: 'description'`.
   
   The code just below already handles a missing description
   (`if description is None: description = f"Parameter: {param_name}"`), so the
   intent is clearly to tolerate it; only the dict access is too strict.
   
   ### How to reproduce
   
   The schema Java emits for `calculate(@ToolParam(name = "a") double a)`:
   
   ```python
   from flink_agents.api.tools.utils import 
create_model_from_java_tool_schema_str
   
   schema = 
'{"type":"object","properties":{"a":{"type":"number"}},"required":["a"]}'
   create_model_from_java_tool_schema_str("J", schema)
   # KeyError: 'description'
   
   ### Version and environment
   
   
   ```markdown
   - Flink Agents: `main` (`ad0a935`); the code is unchanged in 0.3.0.
   - Component: `python` (`api/tools`). Java side is correct; only the Python
     converter needs to tolerate the absent key.
   - Pure logic bug, independent of OS/Python version.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a 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]

Reply via email to