system-one 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.
- system_one-0.1.0/PKG-INFO +209 -0
- system_one-0.1.0/README.md +155 -0
- system_one-0.1.0/pyproject.toml +172 -0
- system_one-0.1.0/system_one/__init__.py +65 -0
- system_one-0.1.0/system_one/agent.py +106 -0
- system_one-0.1.0/system_one/backends/__init__.py +94 -0
- system_one-0.1.0/system_one/backends/http.py +182 -0
- system_one-0.1.0/system_one/backends/onnx.py +410 -0
- system_one-0.1.0/system_one/catalog.py +145 -0
- system_one-0.1.0/system_one/cli.py +126 -0
- system_one-0.1.0/system_one/errors.py +38 -0
- system_one-0.1.0/system_one/export.py +252 -0
- system_one-0.1.0/system_one/mcp.py +111 -0
- system_one-0.1.0/system_one/py.typed +0 -0
- system_one-0.1.0/system_one/schemas.py +259 -0
- system_one-0.1.0/system_one/settings.py +68 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: system-one
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: System One Models Python SDK
|
|
5
|
+
Keywords: python,mcp,jev,system,one
|
|
6
|
+
Author: RaRhAeu
|
|
7
|
+
Author-email: RaRhAeu <rarha_eu@protonmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
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: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Dist: pydantic>=2.13.5
|
|
26
|
+
Requires-Dist: pydantic-settings>=2.15.0
|
|
27
|
+
Requires-Dist: system-one[http,onnx,mcp,hub] ; extra == 'all'
|
|
28
|
+
Requires-Dist: torch>=2.6 ; extra == 'export'
|
|
29
|
+
Requires-Dist: safetensors>=0.4 ; extra == 'export'
|
|
30
|
+
Requires-Dist: transformers>=4.48 ; extra == 'export'
|
|
31
|
+
Requires-Dist: onnx>=1.23 ; extra == 'export'
|
|
32
|
+
Requires-Dist: onnxscript>=0.7.2 ; extra == 'export'
|
|
33
|
+
Requires-Dist: onnxruntime<1.24 ; extra == 'export'
|
|
34
|
+
Requires-Dist: system-one[hub] ; extra == 'export'
|
|
35
|
+
Requires-Dist: httpx2>=2.13.0 ; extra == 'http'
|
|
36
|
+
Requires-Dist: huggingface-hub>=0.26 ; extra == 'hub'
|
|
37
|
+
Requires-Dist: fastmcp>=4.0 ; extra == 'mcp'
|
|
38
|
+
Requires-Dist: pyyaml>=6 ; extra == 'mcp'
|
|
39
|
+
Requires-Dist: onnxruntime>=1.22,<1.24 ; extra == 'onnx'
|
|
40
|
+
Requires-Dist: tokenizers>=0.21 ; extra == 'onnx'
|
|
41
|
+
Requires-Dist: numpy>=1.26 ; extra == 'onnx'
|
|
42
|
+
Requires-Dist: orjson>=3.12.0 ; extra == 'onnx'
|
|
43
|
+
Requires-Python: >=3.10, <4.0
|
|
44
|
+
Project-URL: Documentation, https://github.com/asynq-io/system-one#readme
|
|
45
|
+
Project-URL: Issues, https://github.com/asynq-io/system-one/issues
|
|
46
|
+
Project-URL: Source, https://github.com/asynq-io/system-one
|
|
47
|
+
Provides-Extra: all
|
|
48
|
+
Provides-Extra: export
|
|
49
|
+
Provides-Extra: http
|
|
50
|
+
Provides-Extra: hub
|
|
51
|
+
Provides-Extra: mcp
|
|
52
|
+
Provides-Extra: onnx
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+

|
|
57
|
+

|
|
58
|
+

|
|
59
|
+

|
|
60
|
+

|
|
61
|
+

|
|
62
|
+
[](https://github.com/charliermarsh/ruff)
|
|
63
|
+
[](https://github.com/PyCQA/bandit)
|
|
64
|
+
|
|
65
|
+
# system-one
|
|
66
|
+
|
|
67
|
+
A vendor-neutral SDK for System One models. One contract — `ask(state, questions)
|
|
68
|
+
-> answers` — over three question primitives (`noul`, `choice`, `score`).
|
|
69
|
+
Switching providers is one config object, not a code change.
|
|
70
|
+
|
|
71
|
+
These are decision models, not chat models: no messages, no streaming, no
|
|
72
|
+
temperature.
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
```shell
|
|
77
|
+
pip install "system-one[http]" # hosted providers
|
|
78
|
+
pip install "system-one[onnx]" # local, in-process
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from system_one import SystemOne, TypesafeConfig
|
|
85
|
+
|
|
86
|
+
with SystemOne(TypesafeConfig()) as agent: # reads $SYSTEM_ONE_API_KEY
|
|
87
|
+
response = agent.ask(
|
|
88
|
+
"Customer is furious about a double charge.",
|
|
89
|
+
{
|
|
90
|
+
"urgent": {"type": "noul", "instructions": "Does this need a human now?"},
|
|
91
|
+
"topic": {
|
|
92
|
+
"type": "choice",
|
|
93
|
+
"instructions": "Which queue?",
|
|
94
|
+
"criteria": ["billing", "technical", "other"],
|
|
95
|
+
},
|
|
96
|
+
"severity": {
|
|
97
|
+
"type": "score",
|
|
98
|
+
"instructions": "How severe?",
|
|
99
|
+
"criteria": ["minor", "normal", "major", "critical"],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
print(response.nouls["urgent"].noul, response.nouls["urgent"].confidence)
|
|
105
|
+
print(response.choices["topic"].choice, response.choices["topic"].probabilities)
|
|
106
|
+
print(response.scores["severity"].score)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`AsyncSystemOne` has the same shape and the same method names, awaited:
|
|
110
|
+
`await agent.ask(...)`, `await agent.close()`, `async with`.
|
|
111
|
+
|
|
112
|
+
## Configuration
|
|
113
|
+
|
|
114
|
+
All settings come from `SYSTEM_ONE_*` environment variables or a `.env` file,
|
|
115
|
+
and any of them can be set in code instead: `SystemOne(HTTPConfig(..., timeout=30))`.
|
|
116
|
+
|
|
117
|
+
| Variable | Default | Notes |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| `SYSTEM_ONE_BACKEND` | `http` | `http` or `onnx` |
|
|
120
|
+
| `SYSTEM_ONE_MODEL` | — | overrides whatever the config would use |
|
|
121
|
+
| `SYSTEM_ONE_BASE_URL` | — | required by plain `http`; the presets set their own |
|
|
122
|
+
| `SYSTEM_ONE_PATH` | `/v1/systemone` | |
|
|
123
|
+
| `SYSTEM_ONE_API_KEY` | — | required by `TypesafeConfig` / `OpenRouterConfig` |
|
|
124
|
+
| `SYSTEM_ONE_TIMEOUT` | `10.0` | seconds |
|
|
125
|
+
| `SYSTEM_ONE_MAX_RETRIES` | `2` | `408`, `429`, `5xx` only |
|
|
126
|
+
| `SYSTEM_ONE_ONNX_DIR` | `onnx` | holds `<model>.onnx`, `<model>.json`, `tokenizer/` |
|
|
127
|
+
|
|
128
|
+
Vendor choice is a config class, not a string:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from system_one import (
|
|
132
|
+
HTTPConfig,
|
|
133
|
+
ONNXConfig,
|
|
134
|
+
OpenRouterConfig,
|
|
135
|
+
SystemOne,
|
|
136
|
+
TypesafeConfig,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
SystemOne(TypesafeConfig()) # hosted jev, $SYSTEM_ONE_API_KEY
|
|
140
|
+
SystemOne(OpenRouterConfig()) # same body, different endpoint
|
|
141
|
+
SystemOne(HTTPConfig(base_url="https://my-host", model="mine"))
|
|
142
|
+
SystemOne(ONNXConfig()) # local graph, no network, no key
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Backend-specific calls stay reachable through `agent.backend`. Tests can inject
|
|
146
|
+
one directly: `SystemOne(using=FakeBackend())`.
|
|
147
|
+
|
|
148
|
+
## Running locally
|
|
149
|
+
|
|
150
|
+
The `onnx` backend runs a decision model in-process — no network, no API key,
|
|
151
|
+
no torch at runtime. The weights come from
|
|
152
|
+
[laya](https://github.com/receptron/laya)
|
|
153
|
+
([`convaiinnovations/laya`](https://huggingface.co/convaiinnovations/laya)),
|
|
154
|
+
in the layout the backend reads:
|
|
155
|
+
|
|
156
|
+
```shell
|
|
157
|
+
pip install "system-one[onnx,hub]"
|
|
158
|
+
system-one fetch --out-dir onnx # --variant fp32|int8|fp16, --name sets the base name
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
That writes `onnx/laya.onnx` (≈1.6 GB fp32), `onnx/laya.json` and
|
|
162
|
+
`onnx/tokenizer/` — no torch, no tracing. To use another laya variant or your
|
|
163
|
+
own model, write a spec and run
|
|
164
|
+
`system-one export examples/export/laya-english.yaml`; that needs
|
|
165
|
+
`system-one[export]`. Unset, `SYSTEM_ONE_MODEL` is whatever the backend serves —
|
|
166
|
+
`laya` here — so a local run only sets it for a differently named graph. Nothing
|
|
167
|
+
leaves the machine:
|
|
168
|
+
|
|
169
|
+
```shell
|
|
170
|
+
SYSTEM_ONE_BACKEND=onnx
|
|
171
|
+
SYSTEM_ONE_ONNX_DIR=onnx # default
|
|
172
|
+
SYSTEM_ONE_MODEL=laya # the file base name in that directory
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
with SystemOne(ONNXConfig(model="laya")) as agent:
|
|
177
|
+
response = agent.ask(
|
|
178
|
+
"The site is down.",
|
|
179
|
+
{"outage": {"type": "noul", "instructions": "Is there an outage?"}},
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Full walkthrough — fetch vs export, variants, several models in one directory,
|
|
184
|
+
verification, troubleshooting: [docs/usage/local-model.md](docs/usage/local-model.md).
|
|
185
|
+
|
|
186
|
+
## Errors
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
SystemOneError # catch this
|
|
190
|
+
├── APIError # non-2xx; .status .body .retry_after
|
|
191
|
+
│ └── AuthenticationError # 401/403, never retried
|
|
192
|
+
└── APIConnectionError
|
|
193
|
+
└── APITimeoutError
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
A malformed response body raises pydantic's `ValidationError`.
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
```shell
|
|
201
|
+
uv sync --all-extras
|
|
202
|
+
uv run pytest
|
|
203
|
+
uv run pre-commit run --all-files
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Tests needing the ONNX artifacts skip themselves when `onnx/laya.onnx` is
|
|
207
|
+
absent (`SYSTEM_ONE_ONNX_DIR` and `SYSTEM_ONE_MODEL` override where they look).
|
|
208
|
+
`scripts/check_onnx_parity.py` checks the graph against the reference `laya`
|
|
209
|
+
implementation and needs the `export` extra plus the real weights.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
[](https://github.com/charliermarsh/ruff)
|
|
9
|
+
[](https://github.com/PyCQA/bandit)
|
|
10
|
+
|
|
11
|
+
# system-one
|
|
12
|
+
|
|
13
|
+
A vendor-neutral SDK for System One models. One contract — `ask(state, questions)
|
|
14
|
+
-> answers` — over three question primitives (`noul`, `choice`, `score`).
|
|
15
|
+
Switching providers is one config object, not a code change.
|
|
16
|
+
|
|
17
|
+
These are decision models, not chat models: no messages, no streaming, no
|
|
18
|
+
temperature.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```shell
|
|
23
|
+
pip install "system-one[http]" # hosted providers
|
|
24
|
+
pip install "system-one[onnx]" # local, in-process
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from system_one import SystemOne, TypesafeConfig
|
|
31
|
+
|
|
32
|
+
with SystemOne(TypesafeConfig()) as agent: # reads $SYSTEM_ONE_API_KEY
|
|
33
|
+
response = agent.ask(
|
|
34
|
+
"Customer is furious about a double charge.",
|
|
35
|
+
{
|
|
36
|
+
"urgent": {"type": "noul", "instructions": "Does this need a human now?"},
|
|
37
|
+
"topic": {
|
|
38
|
+
"type": "choice",
|
|
39
|
+
"instructions": "Which queue?",
|
|
40
|
+
"criteria": ["billing", "technical", "other"],
|
|
41
|
+
},
|
|
42
|
+
"severity": {
|
|
43
|
+
"type": "score",
|
|
44
|
+
"instructions": "How severe?",
|
|
45
|
+
"criteria": ["minor", "normal", "major", "critical"],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
print(response.nouls["urgent"].noul, response.nouls["urgent"].confidence)
|
|
51
|
+
print(response.choices["topic"].choice, response.choices["topic"].probabilities)
|
|
52
|
+
print(response.scores["severity"].score)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`AsyncSystemOne` has the same shape and the same method names, awaited:
|
|
56
|
+
`await agent.ask(...)`, `await agent.close()`, `async with`.
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
All settings come from `SYSTEM_ONE_*` environment variables or a `.env` file,
|
|
61
|
+
and any of them can be set in code instead: `SystemOne(HTTPConfig(..., timeout=30))`.
|
|
62
|
+
|
|
63
|
+
| Variable | Default | Notes |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `SYSTEM_ONE_BACKEND` | `http` | `http` or `onnx` |
|
|
66
|
+
| `SYSTEM_ONE_MODEL` | — | overrides whatever the config would use |
|
|
67
|
+
| `SYSTEM_ONE_BASE_URL` | — | required by plain `http`; the presets set their own |
|
|
68
|
+
| `SYSTEM_ONE_PATH` | `/v1/systemone` | |
|
|
69
|
+
| `SYSTEM_ONE_API_KEY` | — | required by `TypesafeConfig` / `OpenRouterConfig` |
|
|
70
|
+
| `SYSTEM_ONE_TIMEOUT` | `10.0` | seconds |
|
|
71
|
+
| `SYSTEM_ONE_MAX_RETRIES` | `2` | `408`, `429`, `5xx` only |
|
|
72
|
+
| `SYSTEM_ONE_ONNX_DIR` | `onnx` | holds `<model>.onnx`, `<model>.json`, `tokenizer/` |
|
|
73
|
+
|
|
74
|
+
Vendor choice is a config class, not a string:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from system_one import (
|
|
78
|
+
HTTPConfig,
|
|
79
|
+
ONNXConfig,
|
|
80
|
+
OpenRouterConfig,
|
|
81
|
+
SystemOne,
|
|
82
|
+
TypesafeConfig,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
SystemOne(TypesafeConfig()) # hosted jev, $SYSTEM_ONE_API_KEY
|
|
86
|
+
SystemOne(OpenRouterConfig()) # same body, different endpoint
|
|
87
|
+
SystemOne(HTTPConfig(base_url="https://my-host", model="mine"))
|
|
88
|
+
SystemOne(ONNXConfig()) # local graph, no network, no key
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Backend-specific calls stay reachable through `agent.backend`. Tests can inject
|
|
92
|
+
one directly: `SystemOne(using=FakeBackend())`.
|
|
93
|
+
|
|
94
|
+
## Running locally
|
|
95
|
+
|
|
96
|
+
The `onnx` backend runs a decision model in-process — no network, no API key,
|
|
97
|
+
no torch at runtime. The weights come from
|
|
98
|
+
[laya](https://github.com/receptron/laya)
|
|
99
|
+
([`convaiinnovations/laya`](https://huggingface.co/convaiinnovations/laya)),
|
|
100
|
+
in the layout the backend reads:
|
|
101
|
+
|
|
102
|
+
```shell
|
|
103
|
+
pip install "system-one[onnx,hub]"
|
|
104
|
+
system-one fetch --out-dir onnx # --variant fp32|int8|fp16, --name sets the base name
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
That writes `onnx/laya.onnx` (≈1.6 GB fp32), `onnx/laya.json` and
|
|
108
|
+
`onnx/tokenizer/` — no torch, no tracing. To use another laya variant or your
|
|
109
|
+
own model, write a spec and run
|
|
110
|
+
`system-one export examples/export/laya-english.yaml`; that needs
|
|
111
|
+
`system-one[export]`. Unset, `SYSTEM_ONE_MODEL` is whatever the backend serves —
|
|
112
|
+
`laya` here — so a local run only sets it for a differently named graph. Nothing
|
|
113
|
+
leaves the machine:
|
|
114
|
+
|
|
115
|
+
```shell
|
|
116
|
+
SYSTEM_ONE_BACKEND=onnx
|
|
117
|
+
SYSTEM_ONE_ONNX_DIR=onnx # default
|
|
118
|
+
SYSTEM_ONE_MODEL=laya # the file base name in that directory
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
with SystemOne(ONNXConfig(model="laya")) as agent:
|
|
123
|
+
response = agent.ask(
|
|
124
|
+
"The site is down.",
|
|
125
|
+
{"outage": {"type": "noul", "instructions": "Is there an outage?"}},
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Full walkthrough — fetch vs export, variants, several models in one directory,
|
|
130
|
+
verification, troubleshooting: [docs/usage/local-model.md](docs/usage/local-model.md).
|
|
131
|
+
|
|
132
|
+
## Errors
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
SystemOneError # catch this
|
|
136
|
+
├── APIError # non-2xx; .status .body .retry_after
|
|
137
|
+
│ └── AuthenticationError # 401/403, never retried
|
|
138
|
+
└── APIConnectionError
|
|
139
|
+
└── APITimeoutError
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
A malformed response body raises pydantic's `ValidationError`.
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
```shell
|
|
147
|
+
uv sync --all-extras
|
|
148
|
+
uv run pytest
|
|
149
|
+
uv run pre-commit run --all-files
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Tests needing the ONNX artifacts skip themselves when `onnx/laya.onnx` is
|
|
153
|
+
absent (`SYSTEM_ONE_ONNX_DIR` and `SYSTEM_ONE_MODEL` override where they look).
|
|
154
|
+
`scripts/check_onnx_parity.py` checks the graph against the reference `laya`
|
|
155
|
+
implementation and needs the `export` extra plus the real weights.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "system-one"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "System One Models Python SDK"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<4.0"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
keywords = ["python", "mcp", "jev", "system", "one"]
|
|
9
|
+
authors = [{ name = "RaRhAeu", email = "rarha_eu@protonmail.com" }]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
23
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
24
|
+
"Topic :: Software Development :: Libraries",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
"Typing :: Typed",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"pydantic>=2.13.5",
|
|
30
|
+
"pydantic-settings>=2.15.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
http = ["httpx2>=2.13.0"]
|
|
35
|
+
onnx = [
|
|
36
|
+
"onnxruntime>=1.22,<1.24",
|
|
37
|
+
"tokenizers>=0.21",
|
|
38
|
+
"numpy>=1.26",
|
|
39
|
+
"orjson>=3.12.0",
|
|
40
|
+
]
|
|
41
|
+
mcp = [
|
|
42
|
+
"fastmcp>=4.0",
|
|
43
|
+
"pyyaml>=6",
|
|
44
|
+
]
|
|
45
|
+
hub = ["huggingface_hub>=0.26"]
|
|
46
|
+
export = [
|
|
47
|
+
"torch>=2.6",
|
|
48
|
+
"safetensors>=0.4",
|
|
49
|
+
"transformers>=4.48",
|
|
50
|
+
"onnx>=1.23",
|
|
51
|
+
"onnxscript>=0.7.2",
|
|
52
|
+
"onnxruntime<1.24",
|
|
53
|
+
"system-one[hub]",
|
|
54
|
+
]
|
|
55
|
+
all = ["system-one[http,onnx,mcp,hub]"]
|
|
56
|
+
|
|
57
|
+
[project.scripts]
|
|
58
|
+
system-one = "system_one.cli:main"
|
|
59
|
+
system-one-mcp = "system_one.mcp:main"
|
|
60
|
+
|
|
61
|
+
[project.urls]
|
|
62
|
+
Documentation = "https://github.com/asynq-io/system-one#readme"
|
|
63
|
+
Issues = "https://github.com/asynq-io/system-one/issues"
|
|
64
|
+
Source = "https://github.com/asynq-io/system-one"
|
|
65
|
+
|
|
66
|
+
[dependency-groups]
|
|
67
|
+
dev = [
|
|
68
|
+
{include-group = "lint"},
|
|
69
|
+
{include-group = "test"},
|
|
70
|
+
{include-group = "docs"},
|
|
71
|
+
"ipython",
|
|
72
|
+
"laya>=0.3.4",
|
|
73
|
+
"typesafe-sdk>=0.7.0",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
test = [
|
|
77
|
+
"numpy>=1.26",
|
|
78
|
+
"pytest",
|
|
79
|
+
"pytest-cov",
|
|
80
|
+
"pytest-sugar",
|
|
81
|
+
"pytest-repeat",
|
|
82
|
+
"pytest-timeout",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
lint = [
|
|
86
|
+
"mypy",
|
|
87
|
+
"ruff",
|
|
88
|
+
"bandit",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
docs = [
|
|
92
|
+
"mkdocs",
|
|
93
|
+
"mkdocs-material",
|
|
94
|
+
"mkdocs-autorefs",
|
|
95
|
+
"mkdocstrings[python]",
|
|
96
|
+
"watchdog",
|
|
97
|
+
]
|
|
98
|
+
[tool.uv.build-backend]
|
|
99
|
+
module-root = ""
|
|
100
|
+
module-name = "system_one"
|
|
101
|
+
|
|
102
|
+
[build-system]
|
|
103
|
+
requires = ["uv_build>=0.9.16,<0.10.0"]
|
|
104
|
+
build-backend = "uv_build"
|
|
105
|
+
|
|
106
|
+
[tool.pytest.ini_options]
|
|
107
|
+
timeout = 3
|
|
108
|
+
addopts = "--cov=./system_one"
|
|
109
|
+
testpaths = ["./tests"]
|
|
110
|
+
|
|
111
|
+
[tool.coverage.report]
|
|
112
|
+
exclude_lines = [
|
|
113
|
+
"pragma: no cover",
|
|
114
|
+
"if TYPE_CHECKING:",
|
|
115
|
+
"raise NotImplementedError",
|
|
116
|
+
"except ImportError:"
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
[tool.pyright]
|
|
120
|
+
venvPath = "."
|
|
121
|
+
venv = ".venv"
|
|
122
|
+
|
|
123
|
+
[tool.mypy]
|
|
124
|
+
python_version = "3.10"
|
|
125
|
+
exclude = [".venv", "^tmp/"]
|
|
126
|
+
strict = true
|
|
127
|
+
disable_error_code = ["annotation-unchecked"]
|
|
128
|
+
follow_imports = "normal"
|
|
129
|
+
ignore_missing_imports = true
|
|
130
|
+
pretty = true
|
|
131
|
+
show_column_numbers = true
|
|
132
|
+
show_error_codes = true
|
|
133
|
+
warn_no_return = false
|
|
134
|
+
warn_unused_ignores = true
|
|
135
|
+
|
|
136
|
+
[tool.ruff]
|
|
137
|
+
target-version = "py310"
|
|
138
|
+
|
|
139
|
+
line-length = 88
|
|
140
|
+
indent-width = 4
|
|
141
|
+
|
|
142
|
+
[tool.ruff.lint]
|
|
143
|
+
select = ["ALL"]
|
|
144
|
+
|
|
145
|
+
ignore = [
|
|
146
|
+
"A002",
|
|
147
|
+
"ANN401",
|
|
148
|
+
"B008", # do not perform function calls in argument defaults
|
|
149
|
+
"COM812",
|
|
150
|
+
"CPY001",
|
|
151
|
+
"D",
|
|
152
|
+
"E501", # line too long
|
|
153
|
+
"EM101",
|
|
154
|
+
"N818",
|
|
155
|
+
"PLW2901",
|
|
156
|
+
"PTH123",
|
|
157
|
+
"TRY003",
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
[tool.ruff.lint.flake8-type-checking]
|
|
161
|
+
runtime-evaluated-base-classes = ["pydantic.BaseModel", "pydantic_settings.BaseSettings"]
|
|
162
|
+
|
|
163
|
+
[tool.ruff.lint.per-file-ignores]
|
|
164
|
+
"tests/*" = ["S101", "ANN001", "ANN002", "ANN003", "ANN201", "ANN202", "SLF001", "PLR2004", "ARG002", "FBT001", "PLC0415"]
|
|
165
|
+
"examples/*" = ["S101", "ANN001", "ANN201", "INP001", "T201", "EM101", "TRY003"]
|
|
166
|
+
"scripts/*" = ["S101", "INP001", "T201", "EM101", "EM102", "TRY003", "SLF001", "PLR2004"]
|
|
167
|
+
"system_one/*" = ["PLC0415"]
|
|
168
|
+
"system_one/cli.py" = ["PLC0415", "T201"]
|
|
169
|
+
"system_one/export.py" = ["PLC0415", "T201", "S101"]
|
|
170
|
+
|
|
171
|
+
[tool.bandit]
|
|
172
|
+
skips = ['B101']
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""A vendor-neutral SDK for System One models: `ask(state, questions) -> answers`."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
|
|
5
|
+
from system_one.agent import AsyncSystemOne, SystemOne
|
|
6
|
+
from system_one.errors import (
|
|
7
|
+
RETRY_STATUSES,
|
|
8
|
+
APIConnectionError,
|
|
9
|
+
APIError,
|
|
10
|
+
APITimeoutError,
|
|
11
|
+
AuthenticationError,
|
|
12
|
+
SystemOneError,
|
|
13
|
+
)
|
|
14
|
+
from system_one.schemas import (
|
|
15
|
+
Answer,
|
|
16
|
+
Choice,
|
|
17
|
+
ChoiceAnswer,
|
|
18
|
+
Noul,
|
|
19
|
+
NoulAnswer,
|
|
20
|
+
NoulCriteria,
|
|
21
|
+
Question,
|
|
22
|
+
Score,
|
|
23
|
+
ScoreAnswer,
|
|
24
|
+
SystemOneInput,
|
|
25
|
+
SystemOneOutput,
|
|
26
|
+
Usage,
|
|
27
|
+
)
|
|
28
|
+
from system_one.settings import (
|
|
29
|
+
HTTPConfig,
|
|
30
|
+
ONNXConfig,
|
|
31
|
+
OpenRouterConfig,
|
|
32
|
+
Settings,
|
|
33
|
+
TypesafeConfig,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
__version__ = version("system-one")
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
"RETRY_STATUSES",
|
|
40
|
+
"APIConnectionError",
|
|
41
|
+
"APIError",
|
|
42
|
+
"APITimeoutError",
|
|
43
|
+
"Answer",
|
|
44
|
+
"AsyncSystemOne",
|
|
45
|
+
"AuthenticationError",
|
|
46
|
+
"Choice",
|
|
47
|
+
"ChoiceAnswer",
|
|
48
|
+
"HTTPConfig",
|
|
49
|
+
"Noul",
|
|
50
|
+
"NoulAnswer",
|
|
51
|
+
"NoulCriteria",
|
|
52
|
+
"ONNXConfig",
|
|
53
|
+
"OpenRouterConfig",
|
|
54
|
+
"Question",
|
|
55
|
+
"Score",
|
|
56
|
+
"ScoreAnswer",
|
|
57
|
+
"Settings",
|
|
58
|
+
"SystemOne",
|
|
59
|
+
"SystemOneError",
|
|
60
|
+
"SystemOneInput",
|
|
61
|
+
"SystemOneOutput",
|
|
62
|
+
"TypesafeConfig",
|
|
63
|
+
"Usage",
|
|
64
|
+
"__version__",
|
|
65
|
+
]
|