modelparams 0.0.1__py3-none-any.whl
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.
Potentially problematic release.
This version of modelparams might be problematic. Click here for more details.
- modelparams/__init__.py +60 -0
- modelparams/_generated/__init__.py +2 -0
- modelparams/_generated/catalog.json +18338 -0
- modelparams/_generated/model_ids.py +536 -0
- modelparams/_generated/registry.py +270 -0
- modelparams/catalog.py +59 -0
- modelparams/models.py +62 -0
- modelparams/py.typed +1 -0
- modelparams/types/__init__.py +4 -0
- modelparams/types/alibaba.py +183 -0
- modelparams/types/anthropic.py +620 -0
- modelparams/types/cerebras.py +33 -0
- modelparams/types/cohere.py +182 -0
- modelparams/types/deepseek.py +69 -0
- modelparams/types/google.py +388 -0
- modelparams/types/groq.py +33 -0
- modelparams/types/meta.py +78 -0
- modelparams/types/minimax.py +214 -0
- modelparams/types/mistral.py +250 -0
- modelparams/types/moonshot.py +154 -0
- modelparams/types/nvidia.py +244 -0
- modelparams/types/openai.py +610 -0
- modelparams/types/perplexity.py +98 -0
- modelparams/types/thinking_machines.py +28 -0
- modelparams/types/xai.py +174 -0
- modelparams/types/xiaomi.py +59 -0
- modelparams/types/z_ai.py +331 -0
- modelparams/validation.py +19 -0
- modelparams-0.0.1.dist-info/METADATA +104 -0
- modelparams-0.0.1.dist-info/RECORD +32 -0
- modelparams-0.0.1.dist-info/WHEEL +4 -0
- modelparams-0.0.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from functools import cache
|
|
4
|
+
from typing import Any, cast
|
|
5
|
+
|
|
6
|
+
from pydantic import TypeAdapter
|
|
7
|
+
|
|
8
|
+
from ._generated.model_ids import ModelId
|
|
9
|
+
from ._generated.registry import PARAM_TYPES
|
|
10
|
+
from .models import JsonPrimitive
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@cache
|
|
14
|
+
def params_adapter(model_id: ModelId) -> TypeAdapter[Any]:
|
|
15
|
+
return TypeAdapter(PARAM_TYPES[model_id])
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def validate_params(model_id: ModelId, params: object) -> dict[str, JsonPrimitive]:
|
|
19
|
+
return cast(dict[str, JsonPrimitive], params_adapter(model_id).validate_python(params))
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: modelparams
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Typed model parameters for Python, generated from the modelparams.dev catalog.
|
|
5
|
+
Project-URL: Homepage, https://modelparams.dev
|
|
6
|
+
Project-URL: Repository, https://github.com/mnfst/modelparameters.dev
|
|
7
|
+
Project-URL: Issues, https://github.com/mnfst/modelparameters.dev/issues
|
|
8
|
+
Author: modelparams.dev contributors
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,llm,model-parameters,pydantic,typing
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: pydantic<3,>=2.10
|
|
22
|
+
Requires-Dist: typing-extensions>=4.12
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
25
|
+
Requires-Dist: mypy>=1.13; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.3; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.9; extra == 'dev'
|
|
28
|
+
Requires-Dist: twine>=6.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# modelparams
|
|
32
|
+
|
|
33
|
+
Typed model parameters for Python, generated from the open
|
|
34
|
+
[modelparams.dev](https://modelparams.dev) catalog.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install modelparams
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Typed request parameters
|
|
41
|
+
|
|
42
|
+
Generated `TypedDict` definitions provide autocomplete and static errors for unsupported keys,
|
|
43
|
+
incorrect value types, and invalid enum values:
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from modelparams import validate_params
|
|
47
|
+
from modelparams.types.openai import Gpt_4_1Params
|
|
48
|
+
|
|
49
|
+
params: Gpt_4_1Params = {
|
|
50
|
+
"max_tokens": 1024,
|
|
51
|
+
"temperature": 0.7,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
validated = validate_params("openai/gpt-4.1", params)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`validate_params` uses a cached strict Pydantic adapter. It returns a provider-keyed dictionary or
|
|
58
|
+
raises `pydantic.ValidationError` for unknown parameters, coercions, invalid enum values, or values
|
|
59
|
+
outside the catalog range.
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from openai import OpenAI
|
|
63
|
+
|
|
64
|
+
OpenAI().chat.completions.create(model="gpt-4.1", messages=messages, **validated)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Provider-specific dot paths remain literal dictionary keys:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from modelparams.types.anthropic import Claude_Haiku_4_5_20251001Params
|
|
71
|
+
|
|
72
|
+
params: Claude_Haiku_4_5_20251001Params = {
|
|
73
|
+
"thinking.type": "enabled",
|
|
74
|
+
"thinking.budget_tokens": 4096,
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Catalog helpers
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from modelparams import get_defaults, get_model, get_param, list_models
|
|
82
|
+
|
|
83
|
+
model = get_model("anthropic/claude-haiku-4-5-20251001")
|
|
84
|
+
print(model.auth_type, model.params)
|
|
85
|
+
|
|
86
|
+
defaults = get_defaults("anthropic/claude-haiku-4-5-20251001")
|
|
87
|
+
thinking = get_param("anthropic/claude-haiku-4-5-20251001", "thinking.type")
|
|
88
|
+
anthropic_models = list_models("anthropic")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The catalog is bundled with the package. No network request is made at runtime.
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
From the repository root:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm run codegen:python
|
|
99
|
+
uv sync --project packages/modelparams-python --extra dev
|
|
100
|
+
uv run --project packages/modelparams-python pytest packages/modelparams-python/tests
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Generated catalog and type files are committed and verified in CI. Python releases use independent
|
|
104
|
+
`modelparams-py@x.y.z` tags and publish to PyPI through the repository's trusted-publisher workflow.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
modelparams/__init__.py,sha256=nouNDDxx5IVmKr3gL2g0bfd4ofc5qBuVWivxcdRcNFc,1120
|
|
2
|
+
modelparams/catalog.py,sha256=r8mYGtSEM-aPGspECmK5aojtvGKNLtFHozRafxJYiq4,1828
|
|
3
|
+
modelparams/models.py,sha256=eSALYojcFesln7MaCeWw70dztkKF163_I2Z-_84pGDo,1753
|
|
4
|
+
modelparams/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
+
modelparams/validation.py,sha256=sUeCwBczGScZQH7IyU-kdOvrs9VeAM0_Ik9MXmnSEfs,541
|
|
6
|
+
modelparams/_generated/__init__.py,sha256=z0HeJhBAyprM_tz9scFxEDrtExlso4I7eu-DgsKKGR0,146
|
|
7
|
+
modelparams/_generated/catalog.json,sha256=nrj_kP7s5mWBUa9SLFDfgCE04oSf5WE1TkTdarYEcTQ,504529
|
|
8
|
+
modelparams/_generated/model_ids.py,sha256=17PE0FJbpjZCK5PGqWGYq9aCzOG_urHCheCxGO_wUI8,17702
|
|
9
|
+
modelparams/_generated/registry.py,sha256=f1P_S-aukDcp-IQePxi6tQ9K5vPFAHXOnHtdRh5VEIA,17792
|
|
10
|
+
modelparams/types/__init__.py,sha256=ZuGQ9XxP5Kt0jJuivCGwitkHOXOcuS7lVMaiT0HdG0k,356
|
|
11
|
+
modelparams/types/alibaba.py,sha256=IMSlN0rMvv-CA_bC4AKQIxtIWNQqjWVJNAYQvNjBeYQ,6011
|
|
12
|
+
modelparams/types/anthropic.py,sha256=oZbf2cotGlHNb9zra_OpubY-a-aeDoks8Rq5mfY9rXI,23616
|
|
13
|
+
modelparams/types/cerebras.py,sha256=gqJPVqOFyxThkvQ0ElNcEKFkTWxEEhLkQ2mTLH6oOKU,1055
|
|
14
|
+
modelparams/types/cohere.py,sha256=rvtI8oShvYaWnIrbhlB-QekUZw3B9G8bJetVAy3PQUc,6911
|
|
15
|
+
modelparams/types/deepseek.py,sha256=1-7Oq6LJjhzDDvWIMCnEb1mpVRk6WXoVx7xuYsD8Skw,2194
|
|
16
|
+
modelparams/types/google.py,sha256=ODa5Fos8uuPp9ZPVgLKmX5DoRziub0nT1TGsYmkFjZ4,16132
|
|
17
|
+
modelparams/types/groq.py,sha256=MZEMj1P4G8mvPkmE15OFb3GORa7hySjT72YRPDocP_E,1065
|
|
18
|
+
modelparams/types/meta.py,sha256=L1whJJh6zWfVNpGLS3DiU2-z54TwZZvkvRc5sloSzRs,2558
|
|
19
|
+
modelparams/types/minimax.py,sha256=HBGpDlQHNSJ0K25sgZVGquxDPUdZ5bu80V1rbW9659g,7014
|
|
20
|
+
modelparams/types/mistral.py,sha256=r-eq2sCFqDiIuUBZqf4T_k15KAykObgYEKTvqkNJVck,9246
|
|
21
|
+
modelparams/types/moonshot.py,sha256=nSl4ujAobUlNWYeQb-8Wg7rcm8fF3dJStk3NQNag9io,5174
|
|
22
|
+
modelparams/types/nvidia.py,sha256=HsO6XjqPwCfMYMmhf2T6OeWotNL9tXEr7qRCnfBgs90,9003
|
|
23
|
+
modelparams/types/openai.py,sha256=0FjqUzvbQ4DVk3P_TAjKvpdykyu7JCf6jWNFKW2PMFE,19088
|
|
24
|
+
modelparams/types/perplexity.py,sha256=zCn4TnyNCEos97lh4c8yZnZdpCOaIlpksH5bMwrtRP8,3651
|
|
25
|
+
modelparams/types/thinking_machines.py,sha256=E473QST64OCbWgskbzOoAy2W4gT-2sdZugRtVvJFMnU,783
|
|
26
|
+
modelparams/types/xai.py,sha256=8Eeb-9PzJN-ZekJGpm-jv00GTrRogm5c0kev_7z9rYY,6274
|
|
27
|
+
modelparams/types/xiaomi.py,sha256=iH-e7I9PMgO5G9LpcUtIJ1NZGnlssFaFq-HMqqLsG_4,1987
|
|
28
|
+
modelparams/types/z_ai.py,sha256=Z1s5xr1bgC6rQafI7Jtdu3e3uPv5Eb9LZXpi42b8WEg,11222
|
|
29
|
+
modelparams-0.0.1.dist-info/METADATA,sha256=HC9wY6C91o43uPGnyDtFMByKAhUkLQYSSJxARqrVxXg,3288
|
|
30
|
+
modelparams-0.0.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
31
|
+
modelparams-0.0.1.dist-info/licenses/LICENSE,sha256=m-i-2Cglz658ZXbK7m5Za4Ftp8WmTVI2DuOE0_FqQpM,1085
|
|
32
|
+
modelparams-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 modelparams.dev contributors
|
|
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.
|