modelparams 0.0.1__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.
Files changed (33) hide show
  1. modelparams-0.0.1/.gitignore +21 -0
  2. modelparams-0.0.1/LICENSE +21 -0
  3. modelparams-0.0.1/PKG-INFO +104 -0
  4. modelparams-0.0.1/README.md +74 -0
  5. modelparams-0.0.1/pyproject.toml +63 -0
  6. modelparams-0.0.1/src/modelparams/__init__.py +60 -0
  7. modelparams-0.0.1/src/modelparams/_generated/__init__.py +2 -0
  8. modelparams-0.0.1/src/modelparams/_generated/catalog.json +18338 -0
  9. modelparams-0.0.1/src/modelparams/_generated/model_ids.py +536 -0
  10. modelparams-0.0.1/src/modelparams/_generated/registry.py +270 -0
  11. modelparams-0.0.1/src/modelparams/catalog.py +59 -0
  12. modelparams-0.0.1/src/modelparams/models.py +62 -0
  13. modelparams-0.0.1/src/modelparams/py.typed +1 -0
  14. modelparams-0.0.1/src/modelparams/types/__init__.py +4 -0
  15. modelparams-0.0.1/src/modelparams/types/alibaba.py +183 -0
  16. modelparams-0.0.1/src/modelparams/types/anthropic.py +620 -0
  17. modelparams-0.0.1/src/modelparams/types/cerebras.py +33 -0
  18. modelparams-0.0.1/src/modelparams/types/cohere.py +182 -0
  19. modelparams-0.0.1/src/modelparams/types/deepseek.py +69 -0
  20. modelparams-0.0.1/src/modelparams/types/google.py +388 -0
  21. modelparams-0.0.1/src/modelparams/types/groq.py +33 -0
  22. modelparams-0.0.1/src/modelparams/types/meta.py +78 -0
  23. modelparams-0.0.1/src/modelparams/types/minimax.py +214 -0
  24. modelparams-0.0.1/src/modelparams/types/mistral.py +250 -0
  25. modelparams-0.0.1/src/modelparams/types/moonshot.py +154 -0
  26. modelparams-0.0.1/src/modelparams/types/nvidia.py +244 -0
  27. modelparams-0.0.1/src/modelparams/types/openai.py +610 -0
  28. modelparams-0.0.1/src/modelparams/types/perplexity.py +98 -0
  29. modelparams-0.0.1/src/modelparams/types/thinking_machines.py +28 -0
  30. modelparams-0.0.1/src/modelparams/types/xai.py +174 -0
  31. modelparams-0.0.1/src/modelparams/types/xiaomi.py +59 -0
  32. modelparams-0.0.1/src/modelparams/types/z_ai.py +331 -0
  33. modelparams-0.0.1/src/modelparams/validation.py +19 -0
@@ -0,0 +1,21 @@
1
+ node_modules/
2
+ /dist/
3
+ /build/
4
+ packages/*/dist/
5
+ packages/*/*.tsbuildinfo
6
+ .cache/
7
+ .venv/
8
+ .mypy_cache/
9
+ .pytest_cache/
10
+ .ruff_cache/
11
+ __pycache__/
12
+ *.py[cod]
13
+ *.log
14
+ .DS_Store
15
+ .env
16
+ .env.local
17
+ .vercel/
18
+ coverage/
19
+ .vscode/
20
+ .idea/
21
+ .gstack/
@@ -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.
@@ -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,74 @@
1
+ # modelparams
2
+
3
+ Typed model parameters for Python, generated from the open
4
+ [modelparams.dev](https://modelparams.dev) catalog.
5
+
6
+ ```bash
7
+ pip install modelparams
8
+ ```
9
+
10
+ ## Typed request parameters
11
+
12
+ Generated `TypedDict` definitions provide autocomplete and static errors for unsupported keys,
13
+ incorrect value types, and invalid enum values:
14
+
15
+ ```python
16
+ from modelparams import validate_params
17
+ from modelparams.types.openai import Gpt_4_1Params
18
+
19
+ params: Gpt_4_1Params = {
20
+ "max_tokens": 1024,
21
+ "temperature": 0.7,
22
+ }
23
+
24
+ validated = validate_params("openai/gpt-4.1", params)
25
+ ```
26
+
27
+ `validate_params` uses a cached strict Pydantic adapter. It returns a provider-keyed dictionary or
28
+ raises `pydantic.ValidationError` for unknown parameters, coercions, invalid enum values, or values
29
+ outside the catalog range.
30
+
31
+ ```python
32
+ from openai import OpenAI
33
+
34
+ OpenAI().chat.completions.create(model="gpt-4.1", messages=messages, **validated)
35
+ ```
36
+
37
+ Provider-specific dot paths remain literal dictionary keys:
38
+
39
+ ```python
40
+ from modelparams.types.anthropic import Claude_Haiku_4_5_20251001Params
41
+
42
+ params: Claude_Haiku_4_5_20251001Params = {
43
+ "thinking.type": "enabled",
44
+ "thinking.budget_tokens": 4096,
45
+ }
46
+ ```
47
+
48
+ ## Catalog helpers
49
+
50
+ ```python
51
+ from modelparams import get_defaults, get_model, get_param, list_models
52
+
53
+ model = get_model("anthropic/claude-haiku-4-5-20251001")
54
+ print(model.auth_type, model.params)
55
+
56
+ defaults = get_defaults("anthropic/claude-haiku-4-5-20251001")
57
+ thinking = get_param("anthropic/claude-haiku-4-5-20251001", "thinking.type")
58
+ anthropic_models = list_models("anthropic")
59
+ ```
60
+
61
+ The catalog is bundled with the package. No network request is made at runtime.
62
+
63
+ ## Development
64
+
65
+ From the repository root:
66
+
67
+ ```bash
68
+ npm run codegen:python
69
+ uv sync --project packages/modelparams-python --extra dev
70
+ uv run --project packages/modelparams-python pytest packages/modelparams-python/tests
71
+ ```
72
+
73
+ Generated catalog and type files are committed and verified in CI. Python releases use independent
74
+ `modelparams-py@x.y.z` tags and publish to PyPI through the repository's trusted-publisher workflow.
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "modelparams"
7
+ version = "0.0.1"
8
+ description = "Typed model parameters for Python, generated from the modelparams.dev catalog."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "modelparams.dev contributors" }]
14
+ keywords = ["ai", "llm", "model-parameters", "pydantic", "typing"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Typing :: Typed",
24
+ ]
25
+ dependencies = ["pydantic>=2.10,<3", "typing-extensions>=4.12"]
26
+
27
+ [project.urls]
28
+ Homepage = "https://modelparams.dev"
29
+ Repository = "https://github.com/mnfst/modelparameters.dev"
30
+ Issues = "https://github.com/mnfst/modelparameters.dev/issues"
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "build>=1.2",
35
+ "mypy>=1.13",
36
+ "pytest>=8.3",
37
+ "ruff>=0.9",
38
+ "twine>=6.0",
39
+ ]
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/modelparams"]
43
+
44
+ [tool.hatch.build.targets.sdist]
45
+ include = ["/LICENSE", "/README.md", "/pyproject.toml", "/src"]
46
+
47
+ [tool.pytest.ini_options]
48
+ addopts = "-q"
49
+ testpaths = ["tests"]
50
+
51
+ [tool.ruff]
52
+ target-version = "py310"
53
+ line-length = 100
54
+ extend-exclude = ["src/modelparams/_generated", "src/modelparams/types"]
55
+
56
+ [tool.ruff.lint]
57
+ select = ["B", "E", "F", "I", "UP"]
58
+
59
+ [tool.mypy]
60
+ python_version = "3.10"
61
+ strict = true
62
+ warn_unused_ignores = true
63
+ files = ["src/modelparams", "tests/typecheck"]
@@ -0,0 +1,60 @@
1
+ from importlib import metadata
2
+
3
+ from ._generated.model_ids import MODEL_IDS, PROVIDERS, ModelId, Provider
4
+ from .catalog import (
5
+ BY_ID,
6
+ CATALOG,
7
+ DEFAULTS,
8
+ get_defaults,
9
+ get_model,
10
+ get_param,
11
+ list_all_models,
12
+ list_models,
13
+ )
14
+ from .models import (
15
+ Applicability,
16
+ ApplicabilityCondition,
17
+ CatalogEntry,
18
+ JsonPrimitive,
19
+ Parameter,
20
+ ParamGroup,
21
+ ParamRange,
22
+ ParamType,
23
+ )
24
+ from .validation import params_adapter, validate_params
25
+
26
+
27
+ def _package_version() -> str:
28
+ try:
29
+ return metadata.version("modelparams")
30
+ except metadata.PackageNotFoundError:
31
+ return "0+unknown"
32
+
33
+
34
+ __version__ = _package_version()
35
+
36
+ __all__ = [
37
+ "BY_ID",
38
+ "CATALOG",
39
+ "DEFAULTS",
40
+ "MODEL_IDS",
41
+ "PROVIDERS",
42
+ "Applicability",
43
+ "ApplicabilityCondition",
44
+ "CatalogEntry",
45
+ "JsonPrimitive",
46
+ "ModelId",
47
+ "Parameter",
48
+ "ParamGroup",
49
+ "ParamRange",
50
+ "ParamType",
51
+ "Provider",
52
+ "__version__",
53
+ "get_defaults",
54
+ "get_model",
55
+ "get_param",
56
+ "list_all_models",
57
+ "list_models",
58
+ "params_adapter",
59
+ "validate_params",
60
+ ]
@@ -0,0 +1,2 @@
1
+ # AUTO-GENERATED by packages/modelparams-python/scripts/codegen.ts.
2
+ # Do not edit by hand; the YAML catalog under /models is the source of truth.