llm-toolcall-check 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,62 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu-latest]
18
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
19
+ include:
20
+ - os: macos-latest
21
+ python: "3.13"
22
+ - os: windows-latest
23
+ python: "3.13"
24
+ steps:
25
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
+ with:
27
+ persist-credentials: false
28
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
29
+ with:
30
+ python-version: ${{ matrix.python }}
31
+ - run: pip install -e . pytest ruff
32
+ - run: ruff check . && ruff format --check .
33
+ if: matrix.os == 'ubuntu-latest'
34
+ - run: pytest -q
35
+
36
+ live:
37
+ # Runs the real checks against a small model on Ollama.
38
+ runs-on: ubuntu-latest
39
+ timeout-minutes: 30
40
+ steps:
41
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
42
+ with:
43
+ persist-credentials: false
44
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
45
+ with:
46
+ python-version: "3.13"
47
+ - run: pip install -e .
48
+ - run: |
49
+ curl -fsSL https://ollama.com/install.sh | sh
50
+ # The installer only starts Ollama when systemd is running on the runner.
51
+ curl -fs http://127.0.0.1:11434/api/version || (ollama serve > ollama.log 2>&1 &)
52
+ for i in $(seq 1 30); do curl -fs http://127.0.0.1:11434/api/version && break; sleep 2; done
53
+ ollama pull qwen3:0.6b
54
+ - name: Run llm-toolcall-check
55
+ run: |
56
+ set +e
57
+ llm-toolcall-check --server ollama -m qwen3:0.6b -n 1 --markdown > report.md
58
+ code=$?
59
+ cat report.md >> "$GITHUB_STEP_SUMMARY"
60
+ cat report.md
61
+ # 0 or 1 are both valid results; 2 means the tool itself failed.
62
+ test $code -le 1
@@ -0,0 +1,40 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
16
+ with:
17
+ persist-credentials: false
18
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
19
+ with:
20
+ python-version: "3.13"
21
+ - run: pip install build && python -m build
22
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
23
+ with:
24
+ name: dist
25
+ path: dist/
26
+
27
+ publish:
28
+ needs: build
29
+ runs-on: ubuntu-latest
30
+ environment:
31
+ name: pypi
32
+ url: https://pypi.org/project/llm-toolcall-check/
33
+ permissions:
34
+ id-token: write
35
+ steps:
36
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
37
+ with:
38
+ name: dist
39
+ path: dist/
40
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
@@ -0,0 +1,6 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ dist/
4
+ .venv/
5
+ .pytest_cache/
6
+ .ruff_cache/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dip Pansuriya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.5
2
+ Name: llm-toolcall-check
3
+ Version: 0.1.0
4
+ Summary: Check whether an OpenAI-compatible LLM server handles tool calling correctly
5
+ Project-URL: Homepage, https://github.com/DipPansuriya/llm-toolcall-check
6
+ Project-URL: Issues, https://github.com/DipPansuriya/llm-toolcall-check/issues
7
+ Author: Dip Pansuriya
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: function-calling,llama.cpp,llm,ollama,openai,testing,tool-calling,vllm
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Topic :: Software Development :: Testing
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+
20
+ # llm-toolcall-check
21
+
22
+ Check whether your local LLM server handles **tool calling** correctly.
23
+
24
+ Ollama, vLLM, llama.cpp, LM Studio and SGLang all offer an OpenAI-compatible API, but tool calling is where they
25
+ break most often: the tool call comes back as plain text, streamed arguments arrive broken, parallel calls get
26
+ merged, or `tool_choice` is ignored. Your agent then fails with an error that looks like the model's fault.
27
+
28
+ `llm-toolcall-check` sends a set of small, realistic requests and tells you exactly what went wrong, and **whose fault
29
+ it is**: the server's (a bug to report) or the model's (pick another model).
30
+
31
+ ```console
32
+ $ llm-toolcall-check --server ollama --model qwen3:4b
33
+ Checking qwen3:4b at http://localhost:11434/v1 (3 runs per check)
34
+
35
+ ✔ single 3/3 One tool call
36
+ ✔ streaming 3/3 One tool call, streamed
37
+ ✔ parallel 3/3 Two tool calls in one reply
38
+ ✔ parallel-streaming 3/3 Two tool calls, streamed
39
+ ✔ tool-result 3/3 Answer from a tool result
40
+ ✔ no-tool 3/3 No tool call when none is needed
41
+ ✖ choice-required 0/3 tool_choice 'required'
42
+ server: ignored tool_choice 'required' and answered in text (3x)
43
+ ✖ choice-named 0/3 tool_choice naming a function
44
+ server: ignored tool_choice naming get_weather and answered in text (3x)
45
+ ✖ choice-none 0/3 tool_choice 'none'
46
+ server: ignored tool_choice 'none' and called a tool (3x)
47
+ ✔ nested-arguments 3/3 Nested arguments (objects, arrays, enums)
48
+ ✔ unicode 3/3 Non-ASCII arguments, streamed
49
+ ✔ structured-output 3/3 response_format json_schema
50
+
51
+ Passed 9 of 12 checks.
52
+ Server problems in: choice-required, choice-named, choice-none. These are bugs to report to the server.
53
+ ```
54
+
55
+ ## Install
56
+
57
+ ```sh
58
+ pip install llm-toolcall-check
59
+ ```
60
+
61
+ Python 3.10 or newer. No dependencies.
62
+
63
+ ## Usage
64
+
65
+ Start your server, then point `llm-toolcall-check` at it:
66
+
67
+ ```sh
68
+ llm-toolcall-check --server ollama --model qwen3:4b
69
+ llm-toolcall-check --server vllm # uses the only model the server lists
70
+ llm-toolcall-check --base-url http://gpu-box:8000/v1 --model Qwen/Qwen3-8B
71
+ ```
72
+
73
+ | Option | Meaning |
74
+ | --- | --- |
75
+ | `--server NAME` | Default local URL for `ollama`, `vllm`, `sglang`, `llama.cpp` or `lmstudio` |
76
+ | `--base-url URL` | Any OpenAI-compatible base URL (default: `$OPENAI_BASE_URL`, then Ollama) |
77
+ | `-m, --model NAME` | Model to test (default: the only model the server lists) |
78
+ | `--api-key KEY` | API key (default: `$LLM_TOOLCALL_CHECK_API_KEY`, then `$OPENAI_API_KEY`) |
79
+ | `-n, --runs N` | Runs per check (default: 3). Models are not fully deterministic, so failures show as `2/3` |
80
+ | `--only IDS`, `--skip IDS` | Comma-separated check ids, see `--list` |
81
+ | `--markdown` | Print a Markdown table you can paste into a bug report |
82
+ | `--json` | Print JSON |
83
+ | `--fail-on-model` | Also exit 1 when only the model made mistakes |
84
+ | `--timeout SECONDS` | Per request (default: 120) |
85
+
86
+ Exit codes: `0` no server problems, `1` server problems found, `2` the check could not run (for example the server
87
+ is not reachable).
88
+
89
+ ## The checks
90
+
91
+ | Id | What it sends | What it catches |
92
+ | --- | --- | --- |
93
+ | `single` | "What's the weather in Paris?" with one tool | Tool call returned as text, missing `id`, `arguments` as an object instead of a string, wrong `finish_reason` |
94
+ | `streaming` | The same, with `stream: true` | Broken deltas, missing `index`, name sent twice, no `[DONE]` |
95
+ | `parallel` | Two cities in one question | Calls merged into one, duplicate ids |
96
+ | `parallel-streaming` | The same, streamed | Arguments of two calls glued together |
97
+ | `tool-result` | A conversation with a tool result | Server rejects `role: tool` or `content: null` |
98
+ | `no-tool` | A question that needs no tool | Model calls tools anyway |
99
+ | `choice-required` | `tool_choice: "required"` | Server ignores it |
100
+ | `choice-named` | `tool_choice` naming one function | Server ignores it or calls another tool |
101
+ | `choice-none` | `tool_choice: "none"` | Server still calls tools, or leaks raw tool markup |
102
+ | `nested-arguments` | A tool with objects, arrays and enums | Arguments that don't match the schema |
103
+ | `unicode` | "Zürich", streamed | Mangled non-ASCII text such as `Zürich` or `\u00fc` |
104
+ | `structured-output` | `response_format: json_schema` | Server doesn't enforce the schema |
105
+
106
+ Every response is also scanned for raw template tokens such as `<tool_call>`, `[TOOL_CALLS]`, `<|python_tag|>` or
107
+ `<|im_end|>`, which mean the server's parser missed something.
108
+
109
+ ### Server problem or model problem?
110
+
111
+ - **server**: the server broke the OpenAI API contract. The model may have produced a perfect tool call, but the
112
+ server returned it as text, mangled it while streaming, or ignored a request option. Report these to the server
113
+ project; `--markdown` gives you a ready table.
114
+ - **model**: the server did its job, but the model chose badly: no tool call, the wrong tool, or arguments that
115
+ don't match the schema. Try a bigger model or a different quantization.
116
+
117
+ ## Same model, different servers
118
+
119
+ Qwen3 4B (Q4_K_M), 3 runs per check, November 2026:
120
+
121
+ | Check | Ollama 0.40.18 | llama.cpp 1.1.0 (`--jinja`) |
122
+ | --- | --- | --- |
123
+ | single, streaming, parallel, tool-result, no-tool | ✔ | ✔ |
124
+ | choice-required | ✖ ignored | ✔ |
125
+ | choice-named | ✖ ignored | ✔ |
126
+ | choice-none | ✖ still calls tools | ✖ tool call leaks into `content` as `<tool_call>…` |
127
+ | nested-arguments, unicode, structured-output | ✔ | ✔ |
128
+
129
+ Both are known upstream: [ollama#17921](https://github.com/ollama/ollama/issues/17921) and
130
+ [llama.cpp#30434](https://github.com/ggml-org/llama.cpp/pull/30434).
131
+
132
+ ## Use in CI
133
+
134
+ Test a model and server combination before you deploy it:
135
+
136
+ ```yaml
137
+ - run: pip install llm-toolcall-check
138
+ - run: llm-toolcall-check --base-url http://localhost:8000/v1 --model my-model --markdown >> "$GITHUB_STEP_SUMMARY"
139
+ ```
140
+
141
+ ## How it works
142
+
143
+ `llm-toolcall-check` talks to `/v1/chat/completions` with the Python standard library and looks at the raw JSON, not at
144
+ what an SDK makes of it. Streamed replies are put back together the way the OpenAI SDKs do it (string fields are
145
+ concatenated), so it reports what your agent would actually see. Requests use `temperature: 0`.
146
+
147
+ Nothing is sent anywhere except the server you point it at.
148
+
149
+ ## License
150
+
151
+ MIT
@@ -0,0 +1,132 @@
1
+ # llm-toolcall-check
2
+
3
+ Check whether your local LLM server handles **tool calling** correctly.
4
+
5
+ Ollama, vLLM, llama.cpp, LM Studio and SGLang all offer an OpenAI-compatible API, but tool calling is where they
6
+ break most often: the tool call comes back as plain text, streamed arguments arrive broken, parallel calls get
7
+ merged, or `tool_choice` is ignored. Your agent then fails with an error that looks like the model's fault.
8
+
9
+ `llm-toolcall-check` sends a set of small, realistic requests and tells you exactly what went wrong, and **whose fault
10
+ it is**: the server's (a bug to report) or the model's (pick another model).
11
+
12
+ ```console
13
+ $ llm-toolcall-check --server ollama --model qwen3:4b
14
+ Checking qwen3:4b at http://localhost:11434/v1 (3 runs per check)
15
+
16
+ ✔ single 3/3 One tool call
17
+ ✔ streaming 3/3 One tool call, streamed
18
+ ✔ parallel 3/3 Two tool calls in one reply
19
+ ✔ parallel-streaming 3/3 Two tool calls, streamed
20
+ ✔ tool-result 3/3 Answer from a tool result
21
+ ✔ no-tool 3/3 No tool call when none is needed
22
+ ✖ choice-required 0/3 tool_choice 'required'
23
+ server: ignored tool_choice 'required' and answered in text (3x)
24
+ ✖ choice-named 0/3 tool_choice naming a function
25
+ server: ignored tool_choice naming get_weather and answered in text (3x)
26
+ ✖ choice-none 0/3 tool_choice 'none'
27
+ server: ignored tool_choice 'none' and called a tool (3x)
28
+ ✔ nested-arguments 3/3 Nested arguments (objects, arrays, enums)
29
+ ✔ unicode 3/3 Non-ASCII arguments, streamed
30
+ ✔ structured-output 3/3 response_format json_schema
31
+
32
+ Passed 9 of 12 checks.
33
+ Server problems in: choice-required, choice-named, choice-none. These are bugs to report to the server.
34
+ ```
35
+
36
+ ## Install
37
+
38
+ ```sh
39
+ pip install llm-toolcall-check
40
+ ```
41
+
42
+ Python 3.10 or newer. No dependencies.
43
+
44
+ ## Usage
45
+
46
+ Start your server, then point `llm-toolcall-check` at it:
47
+
48
+ ```sh
49
+ llm-toolcall-check --server ollama --model qwen3:4b
50
+ llm-toolcall-check --server vllm # uses the only model the server lists
51
+ llm-toolcall-check --base-url http://gpu-box:8000/v1 --model Qwen/Qwen3-8B
52
+ ```
53
+
54
+ | Option | Meaning |
55
+ | --- | --- |
56
+ | `--server NAME` | Default local URL for `ollama`, `vllm`, `sglang`, `llama.cpp` or `lmstudio` |
57
+ | `--base-url URL` | Any OpenAI-compatible base URL (default: `$OPENAI_BASE_URL`, then Ollama) |
58
+ | `-m, --model NAME` | Model to test (default: the only model the server lists) |
59
+ | `--api-key KEY` | API key (default: `$LLM_TOOLCALL_CHECK_API_KEY`, then `$OPENAI_API_KEY`) |
60
+ | `-n, --runs N` | Runs per check (default: 3). Models are not fully deterministic, so failures show as `2/3` |
61
+ | `--only IDS`, `--skip IDS` | Comma-separated check ids, see `--list` |
62
+ | `--markdown` | Print a Markdown table you can paste into a bug report |
63
+ | `--json` | Print JSON |
64
+ | `--fail-on-model` | Also exit 1 when only the model made mistakes |
65
+ | `--timeout SECONDS` | Per request (default: 120) |
66
+
67
+ Exit codes: `0` no server problems, `1` server problems found, `2` the check could not run (for example the server
68
+ is not reachable).
69
+
70
+ ## The checks
71
+
72
+ | Id | What it sends | What it catches |
73
+ | --- | --- | --- |
74
+ | `single` | "What's the weather in Paris?" with one tool | Tool call returned as text, missing `id`, `arguments` as an object instead of a string, wrong `finish_reason` |
75
+ | `streaming` | The same, with `stream: true` | Broken deltas, missing `index`, name sent twice, no `[DONE]` |
76
+ | `parallel` | Two cities in one question | Calls merged into one, duplicate ids |
77
+ | `parallel-streaming` | The same, streamed | Arguments of two calls glued together |
78
+ | `tool-result` | A conversation with a tool result | Server rejects `role: tool` or `content: null` |
79
+ | `no-tool` | A question that needs no tool | Model calls tools anyway |
80
+ | `choice-required` | `tool_choice: "required"` | Server ignores it |
81
+ | `choice-named` | `tool_choice` naming one function | Server ignores it or calls another tool |
82
+ | `choice-none` | `tool_choice: "none"` | Server still calls tools, or leaks raw tool markup |
83
+ | `nested-arguments` | A tool with objects, arrays and enums | Arguments that don't match the schema |
84
+ | `unicode` | "Zürich", streamed | Mangled non-ASCII text such as `Zürich` or `\u00fc` |
85
+ | `structured-output` | `response_format: json_schema` | Server doesn't enforce the schema |
86
+
87
+ Every response is also scanned for raw template tokens such as `<tool_call>`, `[TOOL_CALLS]`, `<|python_tag|>` or
88
+ `<|im_end|>`, which mean the server's parser missed something.
89
+
90
+ ### Server problem or model problem?
91
+
92
+ - **server**: the server broke the OpenAI API contract. The model may have produced a perfect tool call, but the
93
+ server returned it as text, mangled it while streaming, or ignored a request option. Report these to the server
94
+ project; `--markdown` gives you a ready table.
95
+ - **model**: the server did its job, but the model chose badly: no tool call, the wrong tool, or arguments that
96
+ don't match the schema. Try a bigger model or a different quantization.
97
+
98
+ ## Same model, different servers
99
+
100
+ Qwen3 4B (Q4_K_M), 3 runs per check, November 2026:
101
+
102
+ | Check | Ollama 0.40.18 | llama.cpp 1.1.0 (`--jinja`) |
103
+ | --- | --- | --- |
104
+ | single, streaming, parallel, tool-result, no-tool | ✔ | ✔ |
105
+ | choice-required | ✖ ignored | ✔ |
106
+ | choice-named | ✖ ignored | ✔ |
107
+ | choice-none | ✖ still calls tools | ✖ tool call leaks into `content` as `<tool_call>…` |
108
+ | nested-arguments, unicode, structured-output | ✔ | ✔ |
109
+
110
+ Both are known upstream: [ollama#17921](https://github.com/ollama/ollama/issues/17921) and
111
+ [llama.cpp#30434](https://github.com/ggml-org/llama.cpp/pull/30434).
112
+
113
+ ## Use in CI
114
+
115
+ Test a model and server combination before you deploy it:
116
+
117
+ ```yaml
118
+ - run: pip install llm-toolcall-check
119
+ - run: llm-toolcall-check --base-url http://localhost:8000/v1 --model my-model --markdown >> "$GITHUB_STEP_SUMMARY"
120
+ ```
121
+
122
+ ## How it works
123
+
124
+ `llm-toolcall-check` talks to `/v1/chat/completions` with the Python standard library and looks at the raw JSON, not at
125
+ what an SDK makes of it. Streamed replies are put back together the way the OpenAI SDKs do it (string fields are
126
+ concatenated), so it reports what your agent would actually see. Requests use `temperature: 0`.
127
+
128
+ Nothing is sent anywhere except the server you point it at.
129
+
130
+ ## License
131
+
132
+ MIT
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "llm-toolcall-check"
7
+ dynamic = ["version"]
8
+ description = "Check whether an OpenAI-compatible LLM server handles tool calling correctly"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Dip Pansuriya" }]
13
+ requires-python = ">=3.10"
14
+ dependencies = []
15
+ keywords = ["llm", "tool-calling", "function-calling", "openai", "ollama", "vllm", "llama.cpp", "testing"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Programming Language :: Python :: 3",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ "Topic :: Software Development :: Testing",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/DipPansuriya/llm-toolcall-check"
27
+ Issues = "https://github.com/DipPansuriya/llm-toolcall-check/issues"
28
+
29
+ [project.scripts]
30
+ llm-toolcall-check = "llm_toolcall_check.cli:main"
31
+
32
+ [tool.hatch.version]
33
+ path = "src/llm_toolcall_check/__init__.py"
34
+
35
+ [tool.pytest.ini_options]
36
+ testpaths = ["tests"]
37
+
38
+ [tool.ruff]
39
+ line-length = 120
@@ -0,0 +1,3 @@
1
+ """Check whether an OpenAI-compatible LLM server handles tool calling correctly."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ sys.exit(main())