Tool calls fail in opencode

#3
by retowyss - opened

Tool calls fail in opencode using vllm backend.

Thought: I am trying to list files in the current directory. I should use the glob tool to get a count of files. Let me use glob with pattern "*" to match all files and directories.
# invalid [tool=, error=Model tried to call unavailable tool ''. Available tools: bash, edit, edit-image, glob, grep, invalid, question, read, skill, task, todowrite, webfetch, write.]
The arguments provided to the tool are invalid: Model tried to call unavailable tool ''. Available tools: bash, edit, edit-image, glob, grep, invalid, question, read, skill, task, todowrite, webfetch, write.

This doesn't happen with any other model.

I've tried various ways of adapting the chat template but no luck. So maybe the parser is borked.

Any feedback or guidance is much appreciated.

I'm seeing this as well. Using vllm nightly with 8 x RTX 3090.

Tool calls succeed for me in Open WebUI, but fail every time in Opencode.

Yep similar issue with claude code as well. although, able to call the tools, somehow, not able to process the tool results

 list the files in this repo                                                                                                                         

  Thought for 5s, read 1 file, listed 1 directory (ctrl+o to expand)

⏺ Bash(echo "Current directory: $(pwd)")
  ⎿  Current directory: /Users/shafiuddin.r.ahmed/workspace/....
     
⏺ Thinking for 25s… (ctrl+o to expand)
  ⎿  The user is getting "(no content)" responses from all Bash commands. This is very unusual. Let me try a different approach - I'll try using the 
     Read tool to attempt to read what's in the current directory, even though it's meant for files. Or I could try using git commands directly 
     without the Bash wrapper. Actually, let me try git rev-parse --show-toplevel to see if git commands work, and also try echo test to see if any 
     basic commands work.

✽ Deciphering… (37s)
  ⎿  Tip: Run /terminal-setup to enable convenient terminal integration like Option + Enter for new line and more
Cohere Labs org

Can you try the latest vllm main? We merged a parser fix for opencode

Hey, thanks for looking into this! I hadn't mentioned this, but in a later test tool calling worked fine using PI.

  • I just tested with vllm==0.22.1rc1.dev307+g3e8afdf78 (cu130) nightly and I see the same issue still. in latest Opencode.
  • I also tried with vllm 0.22.1 same result.

Can you give me a link to the commit/branch?

Note: Fresh 0.22.1 fails and asks for cohere_melody to be installed.

Thanks Terrencez,

Using vLLM 0.22.1rc1.dev327+gd7607ad27, and adding the interleaved setting to my Opencode config has fixed the issue for me. No failed tool calls, looking good!

My OpenCode config entry, in case that helps someone.

        "command-a-plus": {
          "name": "Cohere Command A+",
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "open_weights": true,
          "modalities": {
            "input": ["text",  "image"],
            "output": ["text"]
          },
          "interleaved": {
            "field": "reasoning_content"
          },
          "cost": {
            "input": 0,
            "output": 0,
            "cache_read": 0
          },
          "limit": {
            "context": 200000,
            "output": 32768
          }
        },

Sign up or log in to comment