agentscope-ai / agentscope-ai/agentscope-java

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

Aberta
#847 0 comentários 0 reações 0 responsáveis Ver no GitHub
area/core/tool enhancement
Linguagem predominante
Java
Estrelas
5.6k
Forks
1.3k
Merge médio
4d 12h
PRs com merge (30d)
77

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.