agentscope-ai / agentscope-ai/agentscope-java
[Feature]:工具调用参数检查校验及自动修复增强
- 主要語言
- Java
- 星號
- 5.6k
- 分支
- 1.3k
- 平均合併
- 4 天 12 小時
- 30 天內合併 PR
- 77
描述
When working with LLM tool calls, we frequently encounter malformed JSON in tool call arguments. Common issues include:
- Markdown code blocks: Arguments wrapped in \json ... `
- JSON comments: // or /* */ comments that aren't valid JSON
- Single quotes: Using ' instead of " for strings/keys
- Missing braces: Incomplete JSON objects
- Trailing commas: Commas after last element (not valid in strict JSON)
These issues cause the current ChatMessageConverter to fail when parsing tool arguments, requiring manual intervention or rejecting otherwise valid tool calls.
Example problematic inputs:
```
```json
{"query": "test"} // Simple search
{'query': 'test',}
{"query": "test",}
{"query": "test", “condition”: {"id": "123"}
```
Implement a **robust multi-stage tool argument parser** that progressively cleans up malformed JSON before parsing.
貢獻指南
評估
這個 Issue 還沒有評估資料。