fix: tool calling compatibility for DeepSeek/GLM/Kimi#899
fix: tool calling compatibility for DeepSeek/GLM/Kimi#899chumyin merged 2 commits intozeroclaw-labs:mainfrom
Conversation
|
Thanks for contributing to ZeroClaw. For faster review, please ensure:
See |
PR intake checks found warnings (non-blocking)Fast safe checks found advisory issues. CI lint/test/build gates still enforce merge quality.
Action items:
Run logs: https://github.com/zeroclaw-labs/zeroclaw/actions/runs/22234050632 Detected blocking line issues (sample):
Detected advisory line issues (sample):
|
@maintainers Thanks for the review guidelines! Updates: • ✅ PR template sections: Completed The failures are unrelated to this PR: • GatewayRateLimiter::new() API mismatch (needs 3 args, test gives 2) Our core changes (compatible.rs + loop_.rs) build and work correctly. Ready for review! |
|
This is what I have experience 😭 |
|
As of 2026-02-19 17:29:30, if use deepseek, the tool still cannot be invoked normally, and a warning will be displayed: WARN zeroclaw::agent::loop_: Malformed <tool_call> JSON: expected tool-call object in tag body |
|
Hi @HHRAYLAM, friendly automation nudge from PR hygiene. This PR has had no new commits for 5h and still needs an update before merge:
Recommended next steps
Maintainers: apply |
|
This may also be useful to have in ollama as that is how I run GLM Flash locally. |
7cd878a to
e1e3dfd
Compare
|
Thank you for the contribution, and congratulations on driving this compatibility fix forward.\n\nI rebased the branch onto the latest |
Summary
Problem: Chinese LLM providers (DeepSeek, GLM/Zhipu, Moonshot/Kimi) claim OpenAI compatibility but return slight
ly different tool calling formats, causing "Malformed <tool_call> JSON: expected tool-call object in tag body" errors
and preventing tool usage.
Why it matters: Users in China and those preferring cost-effective LLMs cannot use zeroclaw's agent capabilities
with popular local providers like DeepSeek, GLM-4/5, or Kimi, limiting adoption.
What changed: Enhanced
OpenAiCompatibleProviderwith#[serde(default)]for robust field parsing, added fallback methods (
function_name(),function_arguments()) for alternative field names, and introducedparse_xml_tool_ca lls()to handle XML-style tool calls (DeepSeek format) alongside JSON.What did not change (scope boundary): Existing OpenAI, Anthropic, and other Western providers' behavior remains
unchanged; no modifications to core agent logic beyond parsing layer.
Label Snapshot
risk: lowsize: Sprovider,agentprovider:deepseek,provider:glm,provider:moonshot,agent:loopChange Metadata
bugproviderLinked Issue
Validation Evidence
Commands and result summary: