probelock 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.
- probelock-0.1.0/.github/workflows/ci.yml +17 -0
- probelock-0.1.0/.github/workflows/release.yml +28 -0
- probelock-0.1.0/.gitignore +17 -0
- probelock-0.1.0/LICENSE +201 -0
- probelock-0.1.0/PKG-INFO +257 -0
- probelock-0.1.0/README.md +224 -0
- probelock-0.1.0/action.yml +57 -0
- probelock-0.1.0/demo/DEMO.md +120 -0
- probelock-0.1.0/demo/demo.sh +32 -0
- probelock-0.1.0/demo/gemma3-1b.lock +213 -0
- probelock-0.1.0/demo/lfm2.5-thinking.lock +186 -0
- probelock-0.1.0/demo/probelock-demo.cast +56 -0
- probelock-0.1.0/demo/qwen3.5-9b.lock +186 -0
- probelock-0.1.0/demo/report-qwen-vs-lfm.html +17 -0
- probelock-0.1.0/examples/agent_tools.json +54 -0
- probelock-0.1.0/fixtures/profile_q4.json +19 -0
- probelock-0.1.0/fixtures/profile_q8.json +19 -0
- probelock-0.1.0/probelock/__init__.py +8 -0
- probelock-0.1.0/probelock/cli.py +540 -0
- probelock-0.1.0/probelock/clients.py +465 -0
- probelock-0.1.0/probelock/data/format_probes.json +12 -0
- probelock-0.1.0/probelock/data/restraint_probes.json +14 -0
- probelock-0.1.0/probelock/diff.py +91 -0
- probelock-0.1.0/probelock/lockfile.py +18 -0
- probelock-0.1.0/probelock/models.py +147 -0
- probelock-0.1.0/probelock/probes.py +366 -0
- probelock-0.1.0/probelock/runner.py +69 -0
- probelock-0.1.0/probelock/scoring.py +154 -0
- probelock-0.1.0/probelock/stats.py +46 -0
- probelock-0.1.0/pyproject.toml +60 -0
- probelock-0.1.0/tests/test_cli.py +190 -0
- probelock-0.1.0/tests/test_diff.py +93 -0
- probelock-0.1.0/tests/test_httpclient.py +209 -0
- probelock-0.1.0/tests/test_models.py +48 -0
- probelock-0.1.0/tests/test_probes.py +99 -0
- probelock-0.1.0/tests/test_runner.py +155 -0
- probelock-0.1.0/tests/test_scoring.py +165 -0
- probelock-0.1.0/tests/test_sdk_clients.py +123 -0
- probelock-0.1.0/tests/test_stats.py +20 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- name: Install uv
|
|
13
|
+
uses: astral-sh/setup-uv@v5
|
|
14
|
+
- name: Tests
|
|
15
|
+
run: uv run --with pytest pytest -q
|
|
16
|
+
- name: Lint
|
|
17
|
+
run: uv run --with ruff ruff check .
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publish to PyPI via Trusted Publishing (OIDC) — no API tokens stored.
|
|
4
|
+
# One-time setup on PyPI: add a "pending publisher" for project `probelock`
|
|
5
|
+
# (owner: kelkalot, repository: probelock, workflow: release.yml).
|
|
6
|
+
# Then push a tag like `v0.1.0` (or run this workflow manually) to publish.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
pypi:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read # actions/checkout needs this for a private repo
|
|
18
|
+
# (declaring any permission defaults all others to `none`)
|
|
19
|
+
id-token: write # required to mint the OIDC token for Trusted Publishing
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: astral-sh/setup-uv@v5
|
|
23
|
+
- name: Build sdist + wheel
|
|
24
|
+
run: uv build
|
|
25
|
+
- name: Check metadata
|
|
26
|
+
run: uvx twine check dist/*
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
probelock-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
probelock-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: probelock
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A capability lockfile for local models. Catch silent regressions when you swap a model, quant, or runtime.
|
|
5
|
+
Project-URL: Homepage, https://github.com/kelkalot/probelock
|
|
6
|
+
Project-URL: Repository, https://github.com/kelkalot/probelock
|
|
7
|
+
Project-URL: Issues, https://github.com/kelkalot/probelock/issues
|
|
8
|
+
Author: Michael A. Riegler
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ci,evals,llama-cpp,llm,local-models,mlx,ollama,quantization,regression-testing,tool-calling
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: jsonschema>=4.0
|
|
23
|
+
Requires-Dist: rich>=13.0
|
|
24
|
+
Requires-Dist: typer>=0.12
|
|
25
|
+
Provides-Extra: anyllm
|
|
26
|
+
Requires-Dist: any-llm-sdk>=0.2; (python_version >= '3.11') and extra == 'anyllm'
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
30
|
+
Provides-Extra: litellm
|
|
31
|
+
Requires-Dist: litellm>=1.0; extra == 'litellm'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# probelock
|
|
35
|
+
|
|
36
|
+
**A capability lockfile for local models.** It records what a model does on a set
|
|
37
|
+
of tool-calling and output checks, and fails CI when a model/quant/runtime swap
|
|
38
|
+
lowers a score.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
llama-3.1-8b @ Q8_0 (ollama) → llama-3.1-8b @ Q4_K_M (ollama)
|
|
42
|
+
Capability Baseline Candidate Δ Status
|
|
43
|
+
arg_validity 1.00 0.67 -0.33 REGRESSION
|
|
44
|
+
arity_robustness 1.00 0.67 -0.33 REGRESSION
|
|
45
|
+
format_adherence 1.00 1.00 +0.00 ok
|
|
46
|
+
needle_in_tools 1.00 0.33 -0.67 REGRESSION
|
|
47
|
+
no_hallucinated_tool 1.00 0.67 -0.33 REGRESSION
|
|
48
|
+
required_args 1.00 1.00 +0.00 ok
|
|
49
|
+
structured_output 1.00 0.33 -0.67 REGRESSION
|
|
50
|
+
tool_discrimination 1.00 0.33 -0.67 REGRESSION
|
|
51
|
+
tool_permission 1.00 0.67 -0.33 REGRESSION
|
|
52
|
+
tool_restraint 1.00 0.67 -0.33 REGRESSION
|
|
53
|
+
tool_selection 1.00 0.67 -0.33 REGRESSION
|
|
54
|
+
|
|
55
|
+
FAIL — capabilities regressed or removed: arg_validity, arity_robustness,
|
|
56
|
+
needle_in_tools, no_hallucinated_tool, structured_output, tool_discrimination,
|
|
57
|
+
tool_permission, tool_restraint, tool_selection
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Here the Q4 quant scores 0.33–0.67 on several capabilities where Q8 scored 1.00.
|
|
61
|
+
`probelock gate` exits non-zero when a capability drops past the threshold.
|
|
62
|
+
|
|
63
|
+
## How it differs from promptfoo
|
|
64
|
+
|
|
65
|
+
> **promptfoo is a test framework you author. probelock is a lockfile you commit.**
|
|
66
|
+
|
|
67
|
+
1. **Probes are derived from your tool schemas.** Point it at the OpenAI-style
|
|
68
|
+
tool definitions your agent already ships, and it generates a fixed,
|
|
69
|
+
reproducible battery of capability checks. You write no test cases.
|
|
70
|
+
2. **No LLM judge.** Every probe is scored by code: JSON-schema validation, exact
|
|
71
|
+
match, or a tool-name check. Run it twice on the same model and the numbers
|
|
72
|
+
match. (promptfoo relies on assertions you write and often on model-graded
|
|
73
|
+
evals, which vary across runs.)
|
|
74
|
+
3. **It compares a model against its own baseline,** across a model/quant/runtime
|
|
75
|
+
swap, rather than producing an absolute leaderboard. You only ever compare like
|
|
76
|
+
with like, on your box, with your tools, so the "benchmarks are
|
|
77
|
+
gameable/hardware-dependent" objection doesn't apply.
|
|
78
|
+
|
|
79
|
+
## Install & run (only needs [uv](https://docs.astral.sh/uv/))
|
|
80
|
+
|
|
81
|
+
Run it without installing, or install it into the current environment:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uvx probelock --help # run the latest release
|
|
85
|
+
pip install probelock # or install it
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
To run an unreleased revision straight from git:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uvx --from git+https://github.com/kelkalot/probelock probelock --help
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The examples below use `uv run` from a checkout of this repo. No model is required
|
|
95
|
+
for the demo — a deterministic `SimulatedClient` stands in for two quant levels of
|
|
96
|
+
the same model:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# from the probelock/ project dir
|
|
100
|
+
uv run probelock derive --tools examples/agent_tools.json # see the probe battery
|
|
101
|
+
uv run probelock probe --tools examples/agent_tools.json --simulate fixtures/profile_q8.json -o q8.lock
|
|
102
|
+
uv run probelock probe --tools examples/agent_tools.json --simulate fixtures/profile_q4.json -o q4.lock
|
|
103
|
+
uv run probelock diff q8.lock q4.lock
|
|
104
|
+
uv run probelock gate --baseline q8.lock --candidate q4.lock # exits non-zero
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Against a local model, swap `--simulate` for an OpenAI-compatible endpoint:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
uv run probelock probe --tools examples/agent_tools.json \
|
|
111
|
+
--endpoint http://localhost:11434/v1 --model llama3.1:8b-instruct-q4_K_M \
|
|
112
|
+
--quant Q4_K_M --runtime ollama --timeout 120 -o q4.lock
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
A probe the model rejects (e.g. "model does not support tools") or that times out
|
|
116
|
+
scores **0** for that capability and the run continues, so a model that can't
|
|
117
|
+
tool-call still produces a lockfile. An unreachable server, a 404 (wrong model or
|
|
118
|
+
URL), or a run where every probe fails aborts the run, so a misconfiguration never
|
|
119
|
+
becomes a poisoned all-zeros baseline.
|
|
120
|
+
|
|
121
|
+
## Providers & frameworks
|
|
122
|
+
|
|
123
|
+
probelock speaks one protocol — OpenAI `/v1/chat/completions` with OpenAI-style
|
|
124
|
+
tools — so anything that exposes it works with `--endpoint`. For providers that
|
|
125
|
+
don't (Anthropic, Gemini, …), route through a unified SDK with `--via`. Every path
|
|
126
|
+
is deterministic; none of them put an LLM in the loop.
|
|
127
|
+
|
|
128
|
+
| You have… | Use |
|
|
129
|
+
|-----------|-----|
|
|
130
|
+
| Ollama, **vLLM**, **llama.cpp** server, LM Studio, HF TGI, OpenAI, OpenRouter, Together… | `--endpoint <url>/v1 --model <name>` (vLLM needs `--enable-auto-tool-choice`; llama.cpp needs `--jinja`) |
|
|
131
|
+
| **Anthropic / Gemini / Mistral / Bedrock / …** (any-llm) | `--via anyllm --model anthropic/claude-3-5-sonnet` |
|
|
132
|
+
| Any of 100+ providers (litellm SDK) | `--via litellm --model anthropic/claude-3-5-sonnet` |
|
|
133
|
+
| A running **LiteLLM proxy** | `--endpoint http://litellm:4000/v1 --model <name>` (no extra) |
|
|
134
|
+
| In-process HF `transformers` / MLX (no server) | not yet — add a small `Client` adapter |
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pip install 'probelock[anyllm]' # or 'probelock[litellm]'
|
|
138
|
+
probelock probe --tools tools.json --via anyllm --model mistral/mistral-large-latest \
|
|
139
|
+
--samples 5 --temperature 0.7 -o candidate.lock
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--via` clients reuse the same caching, sampling, and error semantics as
|
|
143
|
+
`--endpoint`; they're thin adapters over each SDK's OpenAI-shaped response. Add a
|
|
144
|
+
new backend by implementing the tiny `Client` protocol — that's the only seam.
|
|
145
|
+
|
|
146
|
+
### Recorded demo (Ollama)
|
|
147
|
+
|
|
148
|
+
[`demo/`](demo/) has runs against a local Ollama server: a committed `qwen3.5:9b`
|
|
149
|
+
baseline vs a `gemma3:1b` candidate (which does not support tool-calling). See
|
|
150
|
+
[`demo/DEMO.md`](demo/DEMO.md) for the transcript, or replay it:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
asciinema play demo/probelock-demo.cast # or: bash demo/demo.sh
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The tool-calling capabilities drop `1.00 → 0.00` and the gate exits non-zero.
|
|
157
|
+
`tool_restraint`, `tool_permission`, and `no_hallucinated_tool` stay `1.00` (a
|
|
158
|
+
model that can't call tools can't misuse one), and `gemma3:1b` scores `1.00` on
|
|
159
|
+
`format_adherence` vs `0.50` for `qwen3.5:9b`. The diff is per-capability.
|
|
160
|
+
|
|
161
|
+
Also committed: `qwen3.5:9b` vs `lfm2.5-thinking:1.2b`:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
uv run probelock diff demo/qwen3.5-9b.lock demo/lfm2.5-thinking.lock
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The 1.2B model matches `qwen3.5:9b` on tool selection, discrimination,
|
|
168
|
+
`needle_in_tools`, `arg_validity`, `required_args`, and the three safety probes;
|
|
169
|
+
`structured_output` and `arity_robustness` drop `1.00 → 0.33`.
|
|
170
|
+
|
|
171
|
+
## The capabilities (all scored deterministically)
|
|
172
|
+
|
|
173
|
+
| Capability | What it checks | Scorer |
|
|
174
|
+
|-----------------------|-----------------------------------------------------------|--------|
|
|
175
|
+
| `tool_selection` | Calls the right tool for the task | tool-name match |
|
|
176
|
+
| `tool_discrimination` | Calls the right tool **and no other** (picks precisely) | tool-name set |
|
|
177
|
+
| `needle_in_tools` | Finds the right tool when many (15+) are offered | tool-name match |
|
|
178
|
+
| `arg_validity` | Emitted args validate against the tool's JSON schema | `jsonschema` |
|
|
179
|
+
| `required_args` | All required args present and non-empty | key presence |
|
|
180
|
+
| `arity_robustness` | Fills **every** parameter (required + optional) when asked | all-present |
|
|
181
|
+
| `structured_output` | Emits schema-valid JSON on demand (no tools, no fences) | parse + `jsonschema` |
|
|
182
|
+
| `tool_restraint` | Does **not** call a tool for a task that needs none (over-trigger) | no tool call |
|
|
183
|
+
| `tool_permission` | Does **not** call a tool it was explicitly forbidden to use | forbidden tool absent |
|
|
184
|
+
| `no_hallucinated_tool`| Does **not** fabricate a call to a tool that wasn't offered | called ⊆ offered |
|
|
185
|
+
| `format_adherence` | Follows an exact output constraint | exact match |
|
|
186
|
+
|
|
187
|
+
Three are **negative** probes (a higher score means the bad behavior didn't
|
|
188
|
+
happen): `tool_restraint` (over-triggering), `tool_permission` (calling a forbidden
|
|
189
|
+
tool), and `no_hallucinated_tool` (fabricating a tool). All probes are derived from
|
|
190
|
+
the tool schemas, not hand-authored.
|
|
191
|
+
|
|
192
|
+
## Architecture
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
tool schemas ──▶ derive probes ──▶ Client ──▶ ResponseMessage ──▶ deterministic scorer ──▶ Lockfile
|
|
196
|
+
(your agent) (zero authoring) (model) (the only model (no LLM judge) (commit it)
|
|
197
|
+
-touching part)
|
|
198
|
+
Lockfile + Lockfile ──▶ diff / gate
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The only nondeterministic part is the `Client`; everything else is pure, so the
|
|
202
|
+
same inputs produce the same lockfile and the same diff. At temperature 0 the
|
|
203
|
+
client caches identical requests, so the probes that share one request (the tool
|
|
204
|
+
checks for a given tool) hit the network once. The `SimulatedClient` crafts correct or
|
|
205
|
+
incorrect responses that the real scorers grade, so the scoring path runs even
|
|
206
|
+
with no model present.
|
|
207
|
+
|
|
208
|
+
## Sampling & noisy gates
|
|
209
|
+
|
|
210
|
+
With one sample per probe, a capability backed by 3 tools quantizes to
|
|
211
|
+
`{0, 0.33, 0.67, 1.0}` — a single flip moves it 0.33, far past the default 0.05
|
|
212
|
+
gate. So:
|
|
213
|
+
|
|
214
|
+
- **`probe --samples N [--temperature T]`** runs each probe N times and records the
|
|
215
|
+
pass-*rate* (raise the temperature for sampling variance).
|
|
216
|
+
- **`gate --confidence 0.95`** only fails on a drop that is statistically
|
|
217
|
+
significant for the recorded trial count (a one-sided two-proportion test).
|
|
218
|
+
Sub-significant drops are shown as **`noisy ↓`** and do **not** fail the gate;
|
|
219
|
+
raise `--samples` to confirm or clear them.
|
|
220
|
+
|
|
221
|
+
A total collapse (e.g. `1.00 → 0.00`) is significant even at low N; a single-flip
|
|
222
|
+
`1.00 → 0.67` over 3 trials is `noisy` until you raise `--samples`.
|
|
223
|
+
|
|
224
|
+
## In CI
|
|
225
|
+
|
|
226
|
+
`probelock init` scaffolds a `probelock.tools.json` and a
|
|
227
|
+
`.github/workflows/probelock.yml` to start from. Commit a baseline lockfile, then
|
|
228
|
+
gate each candidate:
|
|
229
|
+
|
|
230
|
+
```yaml
|
|
231
|
+
- run: uvx probelock probe
|
|
232
|
+
--tools tools.json --endpoint $LLM_URL --model $MODEL --samples 5 --temperature 0.7 -o candidate.lock
|
|
233
|
+
- run: uvx probelock gate
|
|
234
|
+
--baseline probelock.lock --candidate candidate.lock --max-drop 0.05 --confidence 0.95
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
A composite GitHub Action ([`action.yml`](action.yml)) wraps those two steps. To
|
|
238
|
+
show the result on a pull request, render the diff as Markdown (or `--format html`
|
|
239
|
+
for a self-contained page):
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
probelock diff probelock.lock candidate.lock --format markdown >> "$GITHUB_STEP_SUMMARY"
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Roadmap
|
|
246
|
+
|
|
247
|
+
- A `--json-mode` `structured_output` probe (`response_format`) beside the strict prompt path.
|
|
248
|
+
- Trend view: compare a capability across more than two lockfiles (a quant ladder Q8→Q5→Q4→Q3).
|
|
249
|
+
- In-process backends (HF `transformers` / MLX) via a small `Client` adapter, no server required.
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
254
|
+
|
|
255
|
+
## Acknowledgements
|
|
256
|
+
|
|
257
|
+
Built with [Claude Code](https://claude.com/claude-code).
|