simonw / simonw/llm

Automatically convert types if models send strings to tools expecting integers/floats

Open
#1,027 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tools
Dominant language
Python
Stars
12.5k
Forks
998
Avg merge
3d 13h
Merged PRs (30d)
10

Description

llm --functions '
def multiply(x: int, y: int) -> int:
    """Multiply two numbers."""
    return x * y
' 'what is 34234 * 213345' -m qwen3:4b

I've noticed that qwen3 4B sometimes ignores the integer types and sends strings instead. It would be neat if LLM spotted that and converted them before handing them to the function, based on the signature.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown llm --functions command with the Qwen model, then trace the tool-call path that hands model arguments to the Python function. Determine where the function signature is available and add conversion of string values to declared integer or float types before invocation. Done means the example succeeds with string arguments while existing tool calls remain supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.