typevet 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.
- typevet-0.1.0/LICENSE +21 -0
- typevet-0.1.0/PKG-INFO +124 -0
- typevet-0.1.0/README.md +93 -0
- typevet-0.1.0/pyproject.toml +296 -0
- typevet-0.1.0/pyproject.toml.orig +260 -0
- typevet-0.1.0/src/typevet/__init__.py +67 -0
- typevet-0.1.0/src/typevet/_version.py +43 -0
- typevet-0.1.0/src/typevet/adapters/__init__.py +16 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/__init__.py +59 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/fields.py +108 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/generation_events.py +75 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/http_events.py +91 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/logs.py +116 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/redaction.py +94 -0
- typevet-0.1.0/src/typevet/adapters/diagnostics/settings.py +77 -0
- typevet-0.1.0/src/typevet/adapters/inbound/__init__.py +65 -0
- typevet-0.1.0/src/typevet/adapters/inbound/api.py +61 -0
- typevet-0.1.0/src/typevet/adapters/inbound/backend_settings.py +610 -0
- typevet-0.1.0/src/typevet/adapters/inbound/helpers.py +67 -0
- typevet-0.1.0/src/typevet/adapters/inbound/settings.py +155 -0
- typevet-0.1.0/src/typevet/adapters/outbound/__init__.py +61 -0
- typevet-0.1.0/src/typevet/adapters/outbound/async_fake.py +123 -0
- typevet-0.1.0/src/typevet/adapters/outbound/chat_completion.py +148 -0
- typevet-0.1.0/src/typevet/adapters/outbound/fake.py +119 -0
- typevet-0.1.0/src/typevet/adapters/outbound/gemma/__init__.py +84 -0
- typevet-0.1.0/src/typevet/adapters/outbound/gemma/answer_binding.py +290 -0
- typevet-0.1.0/src/typevet/adapters/outbound/gemma/scoring_prefix.py +102 -0
- typevet-0.1.0/src/typevet/adapters/outbound/gemma/served_template.py +131 -0
- typevet-0.1.0/src/typevet/adapters/outbound/generation_finite.py +50 -0
- typevet-0.1.0/src/typevet/adapters/outbound/http_errors.py +38 -0
- typevet-0.1.0/src/typevet/adapters/outbound/judgment_scoring.py +471 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/__init__.py +41 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/gemma_native_vision_factory.py +286 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/generation.py +187 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/generation_async.py +170 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/http_mapping.py +103 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/multimodal.py +145 -0
- typevet-0.1.0/src/typevet/adapters/outbound/llama_cpp/scoring.py +333 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/__init__.py +44 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/content.py +63 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/generation.py +163 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/generation_async.py +257 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/http_mapping.py +121 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/judgment_factory.py +210 -0
- typevet-0.1.0/src/typevet/adapters/outbound/vllm/scoring.py +372 -0
- typevet-0.1.0/src/typevet/domain/__init__.py +193 -0
- typevet-0.1.0/src/typevet/domain/candidate_scoring_request.py +134 -0
- typevet-0.1.0/src/typevet/domain/candidate_scoring_response.py +96 -0
- typevet-0.1.0/src/typevet/domain/candidate_scoring_validate.py +197 -0
- typevet-0.1.0/src/typevet/domain/decision_compile.py +368 -0
- typevet-0.1.0/src/typevet/domain/decision_execute.py +229 -0
- typevet-0.1.0/src/typevet/domain/decisions.py +129 -0
- typevet-0.1.0/src/typevet/domain/errors.py +235 -0
- typevet-0.1.0/src/typevet/domain/field_instructions.py +134 -0
- typevet-0.1.0/src/typevet/domain/judgment_answers.py +198 -0
- typevet-0.1.0/src/typevet/domain/judgment_normalize.py +243 -0
- typevet-0.1.0/src/typevet/domain/judgment_questions.py +187 -0
- typevet-0.1.0/src/typevet/domain/judgment_response.py +102 -0
- typevet-0.1.0/src/typevet/domain/media.py +101 -0
- typevet-0.1.0/src/typevet/domain/models.py +115 -0
- typevet-0.1.0/src/typevet/domain/question_schema.py +258 -0
- typevet-0.1.0/src/typevet/domain/scoring_stage.py +34 -0
- typevet-0.1.0/src/typevet/ports/__init__.py +39 -0
- typevet-0.1.0/src/typevet/ports/async_generation.py +57 -0
- typevet-0.1.0/src/typevet/ports/framing.py +59 -0
- typevet-0.1.0/src/typevet/ports/generation.py +58 -0
- typevet-0.1.0/src/typevet/ports/judgment.py +71 -0
- typevet-0.1.0/src/typevet/ports/scoring.py +64 -0
- typevet-0.1.0/src/typevet/py.typed +0 -0
- typevet-0.1.0/src/typevet/runtime/__init__.py +50 -0
- typevet-0.1.0/src/typevet/runtime/categorical.py +196 -0
- typevet-0.1.0/src/typevet/runtime/judgment.py +17 -0
- typevet-0.1.0/src/typevet/runtime/llama_cpp_gemma_vision.py +28 -0
- typevet-0.1.0/src/typevet/runtime/scoring_prefix.py +14 -0
- typevet-0.1.0/src/typevet/runtime/vllm_judgment.py +28 -0
- typevet-0.1.0/src/typevet/testing/__init__.py +22 -0
- typevet-0.1.0/src/typevet/testing/fakes.py +152 -0
typevet-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alberto-Codes
|
|
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.
|
typevet-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: typevet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed answers from model next-token probabilities, on llama.cpp and vLLM
|
|
5
|
+
Keywords: evaluation,gemma,json-schema,llama-cpp,llm,structured-generation,structured-output,type-safe,vllm
|
|
6
|
+
Author: Alberto-Codes
|
|
7
|
+
Author-email: Alberto-Codes <alberto.codes.dev@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Dist: httpx>=0.28
|
|
20
|
+
Requires-Dist: jsonschema>=4.26.0
|
|
21
|
+
Requires-Dist: structlog>=24.1
|
|
22
|
+
Requires-Dist: typer>=0.12 ; extra == 'cli'
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Project-URL: Homepage, https://github.com/Alberto-Codes/typevet
|
|
25
|
+
Project-URL: Documentation, https://alberto-codes.github.io/typevet/
|
|
26
|
+
Project-URL: Repository, https://github.com/Alberto-Codes/typevet
|
|
27
|
+
Project-URL: Issues, https://github.com/Alberto-Codes/typevet/issues
|
|
28
|
+
Project-URL: Changelog, https://github.com/Alberto-Codes/typevet/blob/main/CHANGELOG.md
|
|
29
|
+
Provides-Extra: cli
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
[](https://github.com/Alberto-Codes/typevet/actions/workflows/ci.yml)
|
|
33
|
+
[](https://alberto-codes.github.io/typevet/)
|
|
34
|
+
[](https://github.com/Alberto-Codes/typevet/blob/main/pyproject.toml)
|
|
35
|
+
[](https://github.com/astral-sh/ruff)
|
|
36
|
+
[](https://github.com/Alberto-Codes/docvet)
|
|
37
|
+
|
|
38
|
+
# typevet
|
|
39
|
+
|
|
40
|
+
Kind: landing page (the project overview; the one page that mixes kinds).
|
|
41
|
+
|
|
42
|
+
typevet is a Python library that asks a model typed questions and returns typed answers.
|
|
43
|
+
The three question types are `Noul` (yes or no), `Choice` (one label) and `Score` (one rubric level).
|
|
44
|
+
typevet computes each answer from the model's next-token probabilities, read before sampling.
|
|
45
|
+
typevet also returns JSON objects that pass a JSON Schema you supply, or it raises an error.
|
|
46
|
+
The receipts cover Gemma 4 31B on llama.cpp for local work and on vLLM for hosting.
|
|
47
|
+
|
|
48
|
+
Read the documentation at <https://alberto-codes.github.io/typevet/>.
|
|
49
|
+
|
|
50
|
+
## Status
|
|
51
|
+
|
|
52
|
+
- typevet is pre-1.0. The package version is `0.1.0`.
|
|
53
|
+
- Install typevet from PyPI: `pip install typevet` or `uv add typevet`.
|
|
54
|
+
See [Install typevet](https://alberto-codes.github.io/typevet/how-to/install/).
|
|
55
|
+
- typevet requires Python 3.12 or later.
|
|
56
|
+
- Each tested pin has one receipt.
|
|
57
|
+
The receipt gives the full pin and its limits.
|
|
58
|
+
|
|
59
|
+
| Backend | Tested pin | Receipt |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| vLLM | `vllm/vllm-openai:v0.30.0`, BF16 `google/gemma-4-31B-it`, one H100 80 GB | [#170](https://github.com/Alberto-Codes/typevet/issues/170#issuecomment-5884707915) |
|
|
62
|
+
| llama.cpp | Build `b11223-4da633776`, local alias `gemma-4-31b-kv9-q4km-mm` | [#203](https://github.com/Alberto-Codes/typevet/issues/203#issuecomment-5882379255) |
|
|
63
|
+
| llama.cpp grammar | Build `b11243-fc07d781e`, Gemma 4 31B QAT Q4_0 GGUF | [#129](https://github.com/Alberto-Codes/typevet/issues/129#issuecomment-5892208050) |
|
|
64
|
+
|
|
65
|
+
Performance: on one H100 at concurrency level 64, 480 Banking77 records took 12.1 s at 39.6 records/s.
|
|
66
|
+
That run had 0 errors. Banking77 calibration passed; DIFrauD SMS failed parity (ECE 0.158 against 0.10). One run, one pod, one pin.
|
|
67
|
+
See [Performance on one H100](https://alberto-codes.github.io/typevet/reference/performance/)
|
|
68
|
+
and [Serve Gemma 4 31B on a rented H100](https://alberto-codes.github.io/typevet/how-to/serve-gemma-4-31b-on-a-rented-h100/).
|
|
69
|
+
A valid structure does not prove accuracy or calibration.
|
|
70
|
+
The receipts are small samples.
|
|
71
|
+
|
|
72
|
+
## Quickstart
|
|
73
|
+
|
|
74
|
+
Get one offline typed judgment from a scripted fake. This step needs no model.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install typevet
|
|
78
|
+
python -c "
|
|
79
|
+
from typevet.domain import Noul
|
|
80
|
+
from typevet.runtime import ScoringJudgmentAdapter
|
|
81
|
+
from typevet.testing import ScriptedScoringFake
|
|
82
|
+
fake = ScriptedScoringFake(logprobs={'True': -0.2, 'False': -1.0})
|
|
83
|
+
port = ScoringJudgmentAdapter(fake, tokenize_content=lambda t: (ord(t[0]),))
|
|
84
|
+
r = port.judge('text', {'q': Noul(instructions='Ok?', criteria={'true': 'Y', 'false': 'N'})}, 'fake')
|
|
85
|
+
print('noul', r.nouls['q'].noul)
|
|
86
|
+
"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The command prints the probability of yes, near 0.69.
|
|
90
|
+
The [offline tutorial](https://github.com/Alberto-Codes/typevet/blob/main/docs/tutorials/first-typed-judgment-offline.md) explains each step.
|
|
91
|
+
Then connect a model server:
|
|
92
|
+
|
|
93
|
+
- To host typevet, follow [Serve typevet on vLLM](https://github.com/Alberto-Codes/typevet/blob/main/docs/how-to/serve-typevet-on-vllm.md).
|
|
94
|
+
- To run typevet locally, follow [Run Gemma 4 on llama.cpp](https://github.com/Alberto-Codes/typevet/blob/main/docs/how-to/run-gemma4-llamacpp.md).
|
|
95
|
+
- To call typevet from code, follow [Call typevet from Python](https://github.com/Alberto-Codes/typevet/blob/main/docs/how-to/call-typevet-from-python.md).
|
|
96
|
+
|
|
97
|
+
## Learn more
|
|
98
|
+
|
|
99
|
+
- [How typevet works with Gemma 4](https://github.com/Alberto-Codes/typevet/blob/main/docs/explanation/how-typevet-works-with-gemma-4.md)
|
|
100
|
+
explains the scoring path, the two backends and the receipts.
|
|
101
|
+
- [Gemma 4 multimodal judgments](https://github.com/Alberto-Codes/typevet/blob/main/docs/explanation/gemma-4-multimodal-judgments.md)
|
|
102
|
+
explains how images reach each backend, and the limits.
|
|
103
|
+
- [Native typed judgments](https://github.com/Alberto-Codes/typevet/blob/main/docs/explanation/native-typed-judgments.md) states the scope and the limitations.
|
|
104
|
+
- [The documentation index](https://github.com/Alberto-Codes/typevet/blob/main/docs/README.md) lists every page and its kind.
|
|
105
|
+
|
|
106
|
+
[TypeLLM](https://github.com/TypeLLM/TypeLLM) is a research reference for the decision model.
|
|
107
|
+
It is not a runtime dependency.
|
|
108
|
+
|
|
109
|
+
## For contributors
|
|
110
|
+
|
|
111
|
+
Read [CLAUDE.md](https://github.com/Alberto-Codes/typevet/blob/main/CLAUDE.md) first.
|
|
112
|
+
It states the gates, the issue workflow and the rules for agents and people.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
uv sync
|
|
116
|
+
uv run pre-commit install -t pre-commit -t pre-push -t commit-msg
|
|
117
|
+
uv run pytest -q
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The default test run skips live tests.
|
|
121
|
+
Pull requests and pushes to `main` run the hook stages in
|
|
122
|
+
[the CI workflow](https://github.com/Alberto-Codes/typevet/blob/main/.github/workflows/ci.yml).
|
|
123
|
+
[The writing system](https://github.com/Alberto-Codes/typevet/blob/main/docs/reference/writing-system.md) and
|
|
124
|
+
[the commit rules](https://github.com/Alberto-Codes/typevet/blob/main/docs/reference/commits.md) apply to every change.
|
typevet-0.1.0/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
[](https://github.com/Alberto-Codes/typevet/actions/workflows/ci.yml)
|
|
2
|
+
[](https://alberto-codes.github.io/typevet/)
|
|
3
|
+
[](https://github.com/Alberto-Codes/typevet/blob/main/pyproject.toml)
|
|
4
|
+
[](https://github.com/astral-sh/ruff)
|
|
5
|
+
[](https://github.com/Alberto-Codes/docvet)
|
|
6
|
+
|
|
7
|
+
# typevet
|
|
8
|
+
|
|
9
|
+
Kind: landing page (the project overview; the one page that mixes kinds).
|
|
10
|
+
|
|
11
|
+
typevet is a Python library that asks a model typed questions and returns typed answers.
|
|
12
|
+
The three question types are `Noul` (yes or no), `Choice` (one label) and `Score` (one rubric level).
|
|
13
|
+
typevet computes each answer from the model's next-token probabilities, read before sampling.
|
|
14
|
+
typevet also returns JSON objects that pass a JSON Schema you supply, or it raises an error.
|
|
15
|
+
The receipts cover Gemma 4 31B on llama.cpp for local work and on vLLM for hosting.
|
|
16
|
+
|
|
17
|
+
Read the documentation at <https://alberto-codes.github.io/typevet/>.
|
|
18
|
+
|
|
19
|
+
## Status
|
|
20
|
+
|
|
21
|
+
- typevet is pre-1.0. The package version is `0.1.0`.
|
|
22
|
+
- Install typevet from PyPI: `pip install typevet` or `uv add typevet`.
|
|
23
|
+
See [Install typevet](https://alberto-codes.github.io/typevet/how-to/install/).
|
|
24
|
+
- typevet requires Python 3.12 or later.
|
|
25
|
+
- Each tested pin has one receipt.
|
|
26
|
+
The receipt gives the full pin and its limits.
|
|
27
|
+
|
|
28
|
+
| Backend | Tested pin | Receipt |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| vLLM | `vllm/vllm-openai:v0.30.0`, BF16 `google/gemma-4-31B-it`, one H100 80 GB | [#170](https://github.com/Alberto-Codes/typevet/issues/170#issuecomment-5884707915) |
|
|
31
|
+
| llama.cpp | Build `b11223-4da633776`, local alias `gemma-4-31b-kv9-q4km-mm` | [#203](https://github.com/Alberto-Codes/typevet/issues/203#issuecomment-5882379255) |
|
|
32
|
+
| llama.cpp grammar | Build `b11243-fc07d781e`, Gemma 4 31B QAT Q4_0 GGUF | [#129](https://github.com/Alberto-Codes/typevet/issues/129#issuecomment-5892208050) |
|
|
33
|
+
|
|
34
|
+
Performance: on one H100 at concurrency level 64, 480 Banking77 records took 12.1 s at 39.6 records/s.
|
|
35
|
+
That run had 0 errors. Banking77 calibration passed; DIFrauD SMS failed parity (ECE 0.158 against 0.10). One run, one pod, one pin.
|
|
36
|
+
See [Performance on one H100](https://alberto-codes.github.io/typevet/reference/performance/)
|
|
37
|
+
and [Serve Gemma 4 31B on a rented H100](https://alberto-codes.github.io/typevet/how-to/serve-gemma-4-31b-on-a-rented-h100/).
|
|
38
|
+
A valid structure does not prove accuracy or calibration.
|
|
39
|
+
The receipts are small samples.
|
|
40
|
+
|
|
41
|
+
## Quickstart
|
|
42
|
+
|
|
43
|
+
Get one offline typed judgment from a scripted fake. This step needs no model.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install typevet
|
|
47
|
+
python -c "
|
|
48
|
+
from typevet.domain import Noul
|
|
49
|
+
from typevet.runtime import ScoringJudgmentAdapter
|
|
50
|
+
from typevet.testing import ScriptedScoringFake
|
|
51
|
+
fake = ScriptedScoringFake(logprobs={'True': -0.2, 'False': -1.0})
|
|
52
|
+
port = ScoringJudgmentAdapter(fake, tokenize_content=lambda t: (ord(t[0]),))
|
|
53
|
+
r = port.judge('text', {'q': Noul(instructions='Ok?', criteria={'true': 'Y', 'false': 'N'})}, 'fake')
|
|
54
|
+
print('noul', r.nouls['q'].noul)
|
|
55
|
+
"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The command prints the probability of yes, near 0.69.
|
|
59
|
+
The [offline tutorial](https://github.com/Alberto-Codes/typevet/blob/main/docs/tutorials/first-typed-judgment-offline.md) explains each step.
|
|
60
|
+
Then connect a model server:
|
|
61
|
+
|
|
62
|
+
- To host typevet, follow [Serve typevet on vLLM](https://github.com/Alberto-Codes/typevet/blob/main/docs/how-to/serve-typevet-on-vllm.md).
|
|
63
|
+
- To run typevet locally, follow [Run Gemma 4 on llama.cpp](https://github.com/Alberto-Codes/typevet/blob/main/docs/how-to/run-gemma4-llamacpp.md).
|
|
64
|
+
- To call typevet from code, follow [Call typevet from Python](https://github.com/Alberto-Codes/typevet/blob/main/docs/how-to/call-typevet-from-python.md).
|
|
65
|
+
|
|
66
|
+
## Learn more
|
|
67
|
+
|
|
68
|
+
- [How typevet works with Gemma 4](https://github.com/Alberto-Codes/typevet/blob/main/docs/explanation/how-typevet-works-with-gemma-4.md)
|
|
69
|
+
explains the scoring path, the two backends and the receipts.
|
|
70
|
+
- [Gemma 4 multimodal judgments](https://github.com/Alberto-Codes/typevet/blob/main/docs/explanation/gemma-4-multimodal-judgments.md)
|
|
71
|
+
explains how images reach each backend, and the limits.
|
|
72
|
+
- [Native typed judgments](https://github.com/Alberto-Codes/typevet/blob/main/docs/explanation/native-typed-judgments.md) states the scope and the limitations.
|
|
73
|
+
- [The documentation index](https://github.com/Alberto-Codes/typevet/blob/main/docs/README.md) lists every page and its kind.
|
|
74
|
+
|
|
75
|
+
[TypeLLM](https://github.com/TypeLLM/TypeLLM) is a research reference for the decision model.
|
|
76
|
+
It is not a runtime dependency.
|
|
77
|
+
|
|
78
|
+
## For contributors
|
|
79
|
+
|
|
80
|
+
Read [CLAUDE.md](https://github.com/Alberto-Codes/typevet/blob/main/CLAUDE.md) first.
|
|
81
|
+
It states the gates, the issue workflow and the rules for agents and people.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv sync
|
|
85
|
+
uv run pre-commit install -t pre-commit -t pre-push -t commit-msg
|
|
86
|
+
uv run pytest -q
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The default test run skips live tests.
|
|
90
|
+
Pull requests and pushes to `main` run the hook stages in
|
|
91
|
+
[the CI workflow](https://github.com/Alberto-Codes/typevet/blob/main/.github/workflows/ci.yml).
|
|
92
|
+
[The writing system](https://github.com/Alberto-Codes/typevet/blob/main/docs/reference/writing-system.md) and
|
|
93
|
+
[the commit rules](https://github.com/Alberto-Codes/typevet/blob/main/docs/reference/commits.md) apply to every change.
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "typevet"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Typed answers from model next-token probabilities, on llama.cpp and vLLM"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 3 - Alpha",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
13
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
keywords = [
|
|
21
|
+
"evaluation",
|
|
22
|
+
"gemma",
|
|
23
|
+
"json-schema",
|
|
24
|
+
"llama-cpp",
|
|
25
|
+
"llm",
|
|
26
|
+
"structured-generation",
|
|
27
|
+
"structured-output",
|
|
28
|
+
"type-safe",
|
|
29
|
+
"vllm",
|
|
30
|
+
]
|
|
31
|
+
dependencies = [
|
|
32
|
+
"httpx>=0.28",
|
|
33
|
+
"jsonschema>=4.26.0",
|
|
34
|
+
"structlog>=24.1",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[[project.authors]]
|
|
38
|
+
name = "Alberto-Codes"
|
|
39
|
+
email = "alberto.codes.dev@gmail.com"
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
cli = ["typer>=0.12"]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/Alberto-Codes/typevet"
|
|
46
|
+
Documentation = "https://alberto-codes.github.io/typevet/"
|
|
47
|
+
Repository = "https://github.com/Alberto-Codes/typevet"
|
|
48
|
+
Issues = "https://github.com/Alberto-Codes/typevet/issues"
|
|
49
|
+
Changelog = "https://github.com/Alberto-Codes/typevet/blob/main/CHANGELOG.md"
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["uv_build>=0.11.20,<0.13.0"]
|
|
53
|
+
build-backend = "uv_build"
|
|
54
|
+
|
|
55
|
+
[tool.uv_build]
|
|
56
|
+
include = ["src/typevet/py.typed"]
|
|
57
|
+
|
|
58
|
+
[tool.uv]
|
|
59
|
+
default-groups = [
|
|
60
|
+
"dev",
|
|
61
|
+
"docs",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.uv.workspace]
|
|
65
|
+
members = ["evals"]
|
|
66
|
+
|
|
67
|
+
[tool.uv.sources.typevet-evals]
|
|
68
|
+
workspace = true
|
|
69
|
+
|
|
70
|
+
[tool.ruff]
|
|
71
|
+
line-length = 88
|
|
72
|
+
target-version = "py312"
|
|
73
|
+
exclude = [
|
|
74
|
+
".venv",
|
|
75
|
+
"__pycache__",
|
|
76
|
+
"*.egg-info",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[tool.ruff.lint]
|
|
80
|
+
extend-select = [
|
|
81
|
+
"E402",
|
|
82
|
+
"E501",
|
|
83
|
+
"I",
|
|
84
|
+
"D",
|
|
85
|
+
"B",
|
|
86
|
+
"SIM",
|
|
87
|
+
"UP",
|
|
88
|
+
"RUF",
|
|
89
|
+
"PL",
|
|
90
|
+
"C901",
|
|
91
|
+
"TRY",
|
|
92
|
+
"PERF",
|
|
93
|
+
"S",
|
|
94
|
+
"G",
|
|
95
|
+
]
|
|
96
|
+
ignore = ["TRY003"]
|
|
97
|
+
|
|
98
|
+
[tool.ruff.lint.mccabe]
|
|
99
|
+
max-complexity = 12
|
|
100
|
+
|
|
101
|
+
[tool.ruff.lint.pylint]
|
|
102
|
+
max-args = 7
|
|
103
|
+
|
|
104
|
+
[tool.ruff.lint.pycodestyle]
|
|
105
|
+
max-line-length = 100
|
|
106
|
+
|
|
107
|
+
[tool.ruff.lint.pydocstyle]
|
|
108
|
+
convention = "google"
|
|
109
|
+
|
|
110
|
+
[tool.ruff.lint.per-file-ignores]
|
|
111
|
+
"**/tests/**/*.py" = [
|
|
112
|
+
"S101",
|
|
113
|
+
"D100",
|
|
114
|
+
"D101",
|
|
115
|
+
"D102",
|
|
116
|
+
"D103",
|
|
117
|
+
"D104",
|
|
118
|
+
"PLR2004",
|
|
119
|
+
]
|
|
120
|
+
"evals/src/typevet_evals/wheel_isolated.py" = ["S603"]
|
|
121
|
+
"scripts/check_commit_msg.py" = ["S603"]
|
|
122
|
+
"evals/src/typevet_evals/datasets/partner_guard.py" = [
|
|
123
|
+
"S603",
|
|
124
|
+
"S607",
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
[tool.ruff.lint.isort]
|
|
128
|
+
known-first-party = [
|
|
129
|
+
"typevet",
|
|
130
|
+
"typevet_evals",
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
[tool.ruff.format]
|
|
134
|
+
quote-style = "double"
|
|
135
|
+
docstring-code-format = true
|
|
136
|
+
|
|
137
|
+
[tool.pytest.ini_options]
|
|
138
|
+
pythonpath = ["."]
|
|
139
|
+
testpaths = [
|
|
140
|
+
"tests",
|
|
141
|
+
"evals/tests",
|
|
142
|
+
]
|
|
143
|
+
markers = [
|
|
144
|
+
"unit: fast, isolated",
|
|
145
|
+
"contract: adapter behaviour against fakes",
|
|
146
|
+
"live: touches local llama.cpp; never in default CI",
|
|
147
|
+
]
|
|
148
|
+
addopts = [
|
|
149
|
+
"-ra",
|
|
150
|
+
"--strict-markers",
|
|
151
|
+
"--strict-config",
|
|
152
|
+
"--showlocals",
|
|
153
|
+
"-m",
|
|
154
|
+
"not live",
|
|
155
|
+
]
|
|
156
|
+
|
|
157
|
+
[tool.coverage.run]
|
|
158
|
+
source = [
|
|
159
|
+
"typevet",
|
|
160
|
+
"typevet_evals",
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
[tool.coverage.report]
|
|
164
|
+
fail_under = 90
|
|
165
|
+
show_missing = true
|
|
166
|
+
|
|
167
|
+
[tool.ty.src]
|
|
168
|
+
include = [
|
|
169
|
+
"src",
|
|
170
|
+
"tests",
|
|
171
|
+
"scripts",
|
|
172
|
+
"evals/src",
|
|
173
|
+
"evals/tests",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[tool.importlinter]
|
|
177
|
+
root_packages = [
|
|
178
|
+
"typevet",
|
|
179
|
+
"typevet_evals",
|
|
180
|
+
]
|
|
181
|
+
include_external_packages = true
|
|
182
|
+
exclude_type_checking_imports = true
|
|
183
|
+
|
|
184
|
+
[[tool.importlinter.contracts]]
|
|
185
|
+
name = "Hexagonal layers"
|
|
186
|
+
type = "layers"
|
|
187
|
+
layers = [
|
|
188
|
+
"typevet.runtime",
|
|
189
|
+
"typevet.adapters.inbound",
|
|
190
|
+
"typevet.adapters.outbound",
|
|
191
|
+
"typevet.adapters.diagnostics",
|
|
192
|
+
"typevet.testing",
|
|
193
|
+
"typevet.ports",
|
|
194
|
+
"typevet.domain",
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
[[tool.importlinter.contracts]]
|
|
198
|
+
name = "The library does not import the evals"
|
|
199
|
+
type = "forbidden"
|
|
200
|
+
source_modules = ["typevet"]
|
|
201
|
+
forbidden_modules = ["typevet_evals"]
|
|
202
|
+
|
|
203
|
+
[[tool.importlinter.contracts]]
|
|
204
|
+
name = "Evaluation families"
|
|
205
|
+
type = "layers"
|
|
206
|
+
layers = [
|
|
207
|
+
"typevet_evals.cli | typevet_evals.gemma_native_vision_wheel_smoke | typevet_evals.psai_vision_probability_evidence | typevet_evals.wheel_isolated",
|
|
208
|
+
"typevet_evals.throughput",
|
|
209
|
+
"typevet_evals.vllm_acceptance",
|
|
210
|
+
"typevet_evals.instruction_variant | typevet_evals.cord",
|
|
211
|
+
"typevet_evals.psai_vision_consumer | typevet_evals.outcome_replay_metrics",
|
|
212
|
+
"typevet_evals.runner | typevet_evals.tpjep | typevet_evals.experiment_identity",
|
|
213
|
+
"typevet_evals.datasets",
|
|
214
|
+
]
|
|
215
|
+
|
|
216
|
+
[[tool.importlinter.contracts]]
|
|
217
|
+
name = "Model framing stays off the serving backends"
|
|
218
|
+
type = "forbidden"
|
|
219
|
+
source_modules = ["typevet.adapters.outbound.gemma"]
|
|
220
|
+
forbidden_modules = [
|
|
221
|
+
"typevet.adapters.outbound.llama_cpp",
|
|
222
|
+
"typevet.adapters.outbound.vllm",
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
[[tool.importlinter.contracts]]
|
|
226
|
+
name = "Serving backends stay independent"
|
|
227
|
+
type = "independence"
|
|
228
|
+
modules = [
|
|
229
|
+
"typevet.adapters.outbound.llama_cpp",
|
|
230
|
+
"typevet.adapters.outbound.vllm",
|
|
231
|
+
]
|
|
232
|
+
|
|
233
|
+
[[tool.importlinter.contracts]]
|
|
234
|
+
name = "Fakes stay off the adapters"
|
|
235
|
+
type = "forbidden"
|
|
236
|
+
source_modules = ["typevet.testing"]
|
|
237
|
+
forbidden_modules = ["typevet.adapters"]
|
|
238
|
+
|
|
239
|
+
[[tool.importlinter.contracts]]
|
|
240
|
+
name = "Domain is IO-free"
|
|
241
|
+
type = "forbidden"
|
|
242
|
+
source_modules = ["typevet.domain"]
|
|
243
|
+
forbidden_modules = [
|
|
244
|
+
"json",
|
|
245
|
+
"pathlib",
|
|
246
|
+
"os",
|
|
247
|
+
"io",
|
|
248
|
+
"logging",
|
|
249
|
+
"httpx",
|
|
250
|
+
"typer",
|
|
251
|
+
"jsonschema",
|
|
252
|
+
"structlog",
|
|
253
|
+
]
|
|
254
|
+
|
|
255
|
+
[tool.docvet]
|
|
256
|
+
fail-on = [
|
|
257
|
+
"enrichment",
|
|
258
|
+
"freshness",
|
|
259
|
+
"coverage",
|
|
260
|
+
"griffe",
|
|
261
|
+
"presence",
|
|
262
|
+
]
|
|
263
|
+
exclude = [
|
|
264
|
+
"tests",
|
|
265
|
+
"scripts",
|
|
266
|
+
"evals/tests",
|
|
267
|
+
]
|
|
268
|
+
|
|
269
|
+
[tool.docvet.presence]
|
|
270
|
+
min-coverage = 100.0
|
|
271
|
+
|
|
272
|
+
[tool.typevet.commit-msg]
|
|
273
|
+
allowed-authors = [
|
|
274
|
+
"alberto.nieto.80@gmail.com",
|
|
275
|
+
"alberto.codes.dev@gmail.com",
|
|
276
|
+
"github-actions[bot]@users.noreply.github.com",
|
|
277
|
+
]
|
|
278
|
+
coauthor-grandfather-through = "1b1d9a3cfde019c5dbfe164c1660f1d3be28b5ba"
|
|
279
|
+
|
|
280
|
+
[dependency-groups]
|
|
281
|
+
dev = [
|
|
282
|
+
"docvet[griffe]>=1.16.0",
|
|
283
|
+
"import-linter>=2.15",
|
|
284
|
+
"pre-commit>=4.6.2",
|
|
285
|
+
"pytest>=9.1.1",
|
|
286
|
+
"pytest-cov>=7.1.0",
|
|
287
|
+
"ruff>=0.16.8",
|
|
288
|
+
"ty>=0.0.82",
|
|
289
|
+
"typevet-evals",
|
|
290
|
+
]
|
|
291
|
+
docs = [
|
|
292
|
+
"mkdocs>=1.6.1,<2",
|
|
293
|
+
"mkdocs-material>=9.7.7",
|
|
294
|
+
"mkdocstrings[python]>=1.0.6",
|
|
295
|
+
"pymdown-extensions>=12.1",
|
|
296
|
+
]
|