agentscope-ai / agentscope-ai/agentscope-java

[Feature]:工具调用参数检查校验及自动修复增强

未關閉
#847 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area/core/tool enhancement
主要語言
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 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。