model-library 0.1.0__tar.gz → 0.1.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.
- {model_library-0.1.0 → model_library-0.1.1}/.github/workflows/publish.yml +1 -1
- {model_library-0.1.0 → model_library-0.1.1}/PKG-INFO +36 -7
- {model_library-0.1.0 → model_library-0.1.1}/README.md +34 -6
- {model_library-0.1.0 → model_library-0.1.1}/examples/setup.py +1 -11
- {model_library-0.1.0 → model_library-0.1.1}/model_library/__init__.py +7 -3
- model_library-0.1.1/model_library/logging.py +30 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library.egg-info/PKG-INFO +36 -7
- {model_library-0.1.0 → model_library-0.1.1}/model_library.egg-info/SOURCES.txt +1 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library.egg-info/requires.txt +1 -0
- {model_library-0.1.0 → model_library-0.1.1}/pyproject.toml +1 -2
- {model_library-0.1.0 → model_library-0.1.1}/uv.lock +3 -3
- {model_library-0.1.0 → model_library-0.1.1}/.gitattributes +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/.github/workflows/style.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/.github/workflows/test.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/.github/workflows/typecheck.yml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/.gitignore +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/LICENSE +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/Makefile +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/README.md +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/advanced/batch.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/advanced/custom_retrier.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/advanced/deep_research.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/advanced/stress.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/advanced/structured_output.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/advanced/web_search.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/basics.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/data/files.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/data/images.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/embeddings.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/files.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/images.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/prompt_caching.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/examples/tool_calls.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/base.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/ai21labs_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/alibaba_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/all_models.json +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/amazon_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/anthropic_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/cohere_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/deepseek_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/dummy_model.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/fireworks_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/google_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/inception_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/kimi_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/mistral_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/openai_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/perplexity_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/together_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/xai_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/config/zai_models.yaml +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/exceptions.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/file_utils.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/model_utils.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/ai21labs.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/alibaba.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/amazon.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/anthropic.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/azure.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/cohere.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/deepseek.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/fireworks.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/google/__init__.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/google/batch.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/google/google.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/inception.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/kimi.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/mistral.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/openai.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/perplexity.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/together.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/vals.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/xai.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/providers/zai.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/py.typed +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/register_models.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/registry_utils.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/settings.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library/utils.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library.egg-info/dependency_links.txt +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/model_library.egg-info/top_level.txt +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/scripts/config.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/scripts/explore_models.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/scripts/publish.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/scripts/run_models.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/setup.cfg +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/README.md +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/__init__.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/conftest.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/__init__.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/conftest.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_batch.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_completion.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_files.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_reasoning.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_retry.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_streaming.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_structured_output.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/integration/test_tools.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/test_helpers.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/__init__.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/conftest.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/providers/__init__.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/providers/test_fireworks_provider.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/providers/test_google_provider.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_batch.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_context_window.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_deep_research.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_model_registry.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_perplexity_provider.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_prompt_caching.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_retry.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_streaming.py +0 -0
- {model_library-0.1.0 → model_library-0.1.1}/tests/unit/test_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: model-library
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Model Library for vals.ai
|
|
5
5
|
Author-email: "Vals AI, Inc." <contact@vals.ai>
|
|
6
6
|
License: MIT
|
|
@@ -10,6 +10,7 @@ License-File: LICENSE
|
|
|
10
10
|
Requires-Dist: typing-extensions<5.0,>=4.14.1
|
|
11
11
|
Requires-Dist: pydantic<3.0,>=2.11.7
|
|
12
12
|
Requires-Dist: pyyaml>=6.0.2
|
|
13
|
+
Requires-Dist: rich
|
|
13
14
|
Requires-Dist: backoff<3.0,>=2.2.1
|
|
14
15
|
Requires-Dist: redis<7.0,>=6.2.0
|
|
15
16
|
Requires-Dist: tiktoken==0.11.0
|
|
@@ -53,7 +54,14 @@ Open-source model library for interacting with a variety of LLM providers. Origi
|
|
|
53
54
|
- X AI
|
|
54
55
|
- ZhipuAI (zai)
|
|
55
56
|
|
|
56
|
-
Run `python -m scripts.browse_models` to browse the model registry
|
|
57
|
+
Run `python -m scripts.browse_models` to browse the model registry or
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from model_library.registry_utils import get_model_names_by_provider, get_provider_names
|
|
61
|
+
|
|
62
|
+
print(get_provider_names())
|
|
63
|
+
print(get_model_names_by_provider("chosen-provider"))
|
|
64
|
+
```
|
|
57
65
|
|
|
58
66
|
### Supported Input
|
|
59
67
|
|
|
@@ -70,16 +78,26 @@ Here is a basic example of how to query a model:
|
|
|
70
78
|
|
|
71
79
|
```python
|
|
72
80
|
import asyncio
|
|
73
|
-
from model_library
|
|
81
|
+
from model_library import model
|
|
74
82
|
|
|
75
83
|
async def main():
|
|
76
84
|
# Load a model from the registry
|
|
77
|
-
|
|
85
|
+
llm = model("anthropic/claude-opus-4-1-20250805-thinking")
|
|
86
|
+
|
|
87
|
+
# Display the LLM instance
|
|
88
|
+
llm.logger.info(llm)
|
|
89
|
+
# or print(llm)
|
|
78
90
|
|
|
79
91
|
# Query the model with a simple text input
|
|
80
|
-
|
|
92
|
+
result = await llm.query(
|
|
93
|
+
"What is QSBS? Explain your thinking in detail and make it concise."
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Logger automatically logs the result
|
|
97
|
+
|
|
98
|
+
# Display only the output text
|
|
99
|
+
llm.logger.info(result.output_text)
|
|
81
100
|
|
|
82
|
-
# Logger automatically logs the response
|
|
83
101
|
|
|
84
102
|
if __name__ == "__main__":
|
|
85
103
|
asyncio.run(main())
|
|
@@ -88,7 +106,18 @@ if __name__ == "__main__":
|
|
|
88
106
|
The model registry holds model attributes, ex. reasoning, file support, tool support, max tokens. You may also use models not included in the registry.
|
|
89
107
|
|
|
90
108
|
```python
|
|
91
|
-
|
|
109
|
+
from model_library import raw_model
|
|
110
|
+
from model_library.base import LLMConfig
|
|
111
|
+
|
|
112
|
+
model = raw_model("grok/grok-code-fast", LLMConfig(max_tokens=10000))
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Root logger is named "llm". To disable logging:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from model_library import set_logging
|
|
119
|
+
|
|
120
|
+
set_logging(enable=False)
|
|
92
121
|
```
|
|
93
122
|
|
|
94
123
|
### Environment Setup
|
|
@@ -26,7 +26,14 @@ Open-source model library for interacting with a variety of LLM providers. Origi
|
|
|
26
26
|
- X AI
|
|
27
27
|
- ZhipuAI (zai)
|
|
28
28
|
|
|
29
|
-
Run `python -m scripts.browse_models` to browse the model registry
|
|
29
|
+
Run `python -m scripts.browse_models` to browse the model registry or
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from model_library.registry_utils import get_model_names_by_provider, get_provider_names
|
|
33
|
+
|
|
34
|
+
print(get_provider_names())
|
|
35
|
+
print(get_model_names_by_provider("chosen-provider"))
|
|
36
|
+
```
|
|
30
37
|
|
|
31
38
|
### Supported Input
|
|
32
39
|
|
|
@@ -43,16 +50,26 @@ Here is a basic example of how to query a model:
|
|
|
43
50
|
|
|
44
51
|
```python
|
|
45
52
|
import asyncio
|
|
46
|
-
from model_library
|
|
53
|
+
from model_library import model
|
|
47
54
|
|
|
48
55
|
async def main():
|
|
49
56
|
# Load a model from the registry
|
|
50
|
-
|
|
57
|
+
llm = model("anthropic/claude-opus-4-1-20250805-thinking")
|
|
58
|
+
|
|
59
|
+
# Display the LLM instance
|
|
60
|
+
llm.logger.info(llm)
|
|
61
|
+
# or print(llm)
|
|
51
62
|
|
|
52
63
|
# Query the model with a simple text input
|
|
53
|
-
|
|
64
|
+
result = await llm.query(
|
|
65
|
+
"What is QSBS? Explain your thinking in detail and make it concise."
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Logger automatically logs the result
|
|
69
|
+
|
|
70
|
+
# Display only the output text
|
|
71
|
+
llm.logger.info(result.output_text)
|
|
54
72
|
|
|
55
|
-
# Logger automatically logs the response
|
|
56
73
|
|
|
57
74
|
if __name__ == "__main__":
|
|
58
75
|
asyncio.run(main())
|
|
@@ -61,7 +78,18 @@ if __name__ == "__main__":
|
|
|
61
78
|
The model registry holds model attributes, ex. reasoning, file support, tool support, max tokens. You may also use models not included in the registry.
|
|
62
79
|
|
|
63
80
|
```python
|
|
64
|
-
|
|
81
|
+
from model_library import raw_model
|
|
82
|
+
from model_library.base import LLMConfig
|
|
83
|
+
|
|
84
|
+
model = raw_model("grok/grok-code-fast", LLMConfig(max_tokens=10000))
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Root logger is named "llm". To disable logging:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from model_library import set_logging
|
|
91
|
+
|
|
92
|
+
set_logging(enable=False)
|
|
65
93
|
```
|
|
66
94
|
|
|
67
95
|
### Environment Setup
|
|
@@ -4,22 +4,12 @@ from typing import Any
|
|
|
4
4
|
from rich.console import Console
|
|
5
5
|
from rich.logging import RichHandler
|
|
6
6
|
|
|
7
|
-
console = Console()
|
|
8
|
-
|
|
9
|
-
# llm logger
|
|
10
|
-
llm_logger = logging.getLogger("llm")
|
|
11
|
-
llm_logger.setLevel(logging.INFO)
|
|
12
|
-
llm_logger.handlers.clear()
|
|
13
|
-
handler = RichHandler(console=console, markup=True, show_time=False)
|
|
14
|
-
handler.setFormatter(logging.Formatter(("%(name)s - %(levelname)s - %(message)s")))
|
|
15
|
-
llm_logger.addHandler(handler)
|
|
16
|
-
|
|
17
7
|
# console logger (if you want to print specific colors)
|
|
18
8
|
console_logger = logging.getLogger("console")
|
|
19
9
|
console_logger.setLevel(logging.INFO)
|
|
20
10
|
console_logger.handlers.clear()
|
|
21
11
|
console_logger.addHandler(
|
|
22
|
-
RichHandler(console=
|
|
12
|
+
RichHandler(console=Console(), markup=True, show_time=False, rich_tracebacks=True)
|
|
23
13
|
)
|
|
24
14
|
|
|
25
15
|
# all other logs
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
from model_library.settings import ModelLibrarySettings
|
|
2
1
|
from model_library.base import LLM, LLMConfig
|
|
2
|
+
from model_library.logging import set_logging
|
|
3
|
+
from model_library.settings import ModelLibrarySettings
|
|
3
4
|
|
|
4
5
|
model_library_settings: ModelLibrarySettings = ModelLibrarySettings()
|
|
5
6
|
|
|
7
|
+
set_logging()
|
|
8
|
+
|
|
6
9
|
|
|
7
10
|
def model(model_str: str, override_config: LLMConfig | None = None) -> LLM:
|
|
8
11
|
from model_library.registry_utils import get_registry_model
|
|
@@ -10,14 +13,15 @@ def model(model_str: str, override_config: LLMConfig | None = None) -> LLM:
|
|
|
10
13
|
return get_registry_model(model_str, override_config)
|
|
11
14
|
|
|
12
15
|
|
|
13
|
-
def raw_model(model_str: str,
|
|
16
|
+
def raw_model(model_str: str, config: LLMConfig | None = None) -> LLM:
|
|
14
17
|
from model_library.registry_utils import get_raw_model
|
|
15
18
|
|
|
16
|
-
return get_raw_model(model_str, config=
|
|
19
|
+
return get_raw_model(model_str, config=config)
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
__all__ = [
|
|
20
23
|
"model_library_settings",
|
|
21
24
|
"model",
|
|
22
25
|
"raw_model",
|
|
26
|
+
"set_logging",
|
|
23
27
|
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
from rich.logging import RichHandler
|
|
5
|
+
|
|
6
|
+
_llm_logger = logging.getLogger("llm")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def set_logging(enable: bool = True, handler: logging.Handler | None = None):
|
|
10
|
+
"""
|
|
11
|
+
Sets up logging for the model library
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
enable (bool): Enable or disable logging.
|
|
15
|
+
handler (logging.Handler, optional): A custom logging handler. Defaults to RichHandler.
|
|
16
|
+
"""
|
|
17
|
+
if enable:
|
|
18
|
+
_llm_logger.setLevel(logging.INFO)
|
|
19
|
+
else:
|
|
20
|
+
_llm_logger.setLevel(logging.CRITICAL)
|
|
21
|
+
|
|
22
|
+
if not enable or _llm_logger.hasHandlers():
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
if handler is None:
|
|
26
|
+
console = Console()
|
|
27
|
+
handler = RichHandler(console=console, markup=True, show_time=False)
|
|
28
|
+
|
|
29
|
+
handler.setFormatter(logging.Formatter("%(name)s - %(levelname)s - %(message)s"))
|
|
30
|
+
_llm_logger.addHandler(handler)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: model-library
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Model Library for vals.ai
|
|
5
5
|
Author-email: "Vals AI, Inc." <contact@vals.ai>
|
|
6
6
|
License: MIT
|
|
@@ -10,6 +10,7 @@ License-File: LICENSE
|
|
|
10
10
|
Requires-Dist: typing-extensions<5.0,>=4.14.1
|
|
11
11
|
Requires-Dist: pydantic<3.0,>=2.11.7
|
|
12
12
|
Requires-Dist: pyyaml>=6.0.2
|
|
13
|
+
Requires-Dist: rich
|
|
13
14
|
Requires-Dist: backoff<3.0,>=2.2.1
|
|
14
15
|
Requires-Dist: redis<7.0,>=6.2.0
|
|
15
16
|
Requires-Dist: tiktoken==0.11.0
|
|
@@ -53,7 +54,14 @@ Open-source model library for interacting with a variety of LLM providers. Origi
|
|
|
53
54
|
- X AI
|
|
54
55
|
- ZhipuAI (zai)
|
|
55
56
|
|
|
56
|
-
Run `python -m scripts.browse_models` to browse the model registry
|
|
57
|
+
Run `python -m scripts.browse_models` to browse the model registry or
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from model_library.registry_utils import get_model_names_by_provider, get_provider_names
|
|
61
|
+
|
|
62
|
+
print(get_provider_names())
|
|
63
|
+
print(get_model_names_by_provider("chosen-provider"))
|
|
64
|
+
```
|
|
57
65
|
|
|
58
66
|
### Supported Input
|
|
59
67
|
|
|
@@ -70,16 +78,26 @@ Here is a basic example of how to query a model:
|
|
|
70
78
|
|
|
71
79
|
```python
|
|
72
80
|
import asyncio
|
|
73
|
-
from model_library
|
|
81
|
+
from model_library import model
|
|
74
82
|
|
|
75
83
|
async def main():
|
|
76
84
|
# Load a model from the registry
|
|
77
|
-
|
|
85
|
+
llm = model("anthropic/claude-opus-4-1-20250805-thinking")
|
|
86
|
+
|
|
87
|
+
# Display the LLM instance
|
|
88
|
+
llm.logger.info(llm)
|
|
89
|
+
# or print(llm)
|
|
78
90
|
|
|
79
91
|
# Query the model with a simple text input
|
|
80
|
-
|
|
92
|
+
result = await llm.query(
|
|
93
|
+
"What is QSBS? Explain your thinking in detail and make it concise."
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Logger automatically logs the result
|
|
97
|
+
|
|
98
|
+
# Display only the output text
|
|
99
|
+
llm.logger.info(result.output_text)
|
|
81
100
|
|
|
82
|
-
# Logger automatically logs the response
|
|
83
101
|
|
|
84
102
|
if __name__ == "__main__":
|
|
85
103
|
asyncio.run(main())
|
|
@@ -88,7 +106,18 @@ if __name__ == "__main__":
|
|
|
88
106
|
The model registry holds model attributes, ex. reasoning, file support, tool support, max tokens. You may also use models not included in the registry.
|
|
89
107
|
|
|
90
108
|
```python
|
|
91
|
-
|
|
109
|
+
from model_library import raw_model
|
|
110
|
+
from model_library.base import LLMConfig
|
|
111
|
+
|
|
112
|
+
model = raw_model("grok/grok-code-fast", LLMConfig(max_tokens=10000))
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Root logger is named "llm". To disable logging:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from model_library import set_logging
|
|
119
|
+
|
|
120
|
+
set_logging(enable=False)
|
|
92
121
|
```
|
|
93
122
|
|
|
94
123
|
### Environment Setup
|
|
@@ -14,6 +14,7 @@ dependencies = [
|
|
|
14
14
|
"typing-extensions>=4.14.1,<5.0",
|
|
15
15
|
"pydantic>=2.11.7,<3.0",
|
|
16
16
|
"pyyaml>=6.0.2",
|
|
17
|
+
"rich",
|
|
17
18
|
# core
|
|
18
19
|
"backoff>=2.2.1,<3.0",
|
|
19
20
|
"redis>=6.2.0,<7.0",
|
|
@@ -39,8 +40,6 @@ dev = [
|
|
|
39
40
|
# style
|
|
40
41
|
"ruff",
|
|
41
42
|
"basedpyright",
|
|
42
|
-
# log
|
|
43
|
-
"rich",
|
|
44
43
|
# tui
|
|
45
44
|
"inquirerpy",
|
|
46
45
|
# env
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
version = 1
|
|
2
|
-
revision =
|
|
2
|
+
revision = 2
|
|
3
3
|
requires-python = ">=3.11"
|
|
4
4
|
resolution-markers = [
|
|
5
5
|
"python_full_version >= '3.13'",
|
|
@@ -796,6 +796,7 @@ dependencies = [
|
|
|
796
796
|
{ name = "pydantic" },
|
|
797
797
|
{ name = "pyyaml" },
|
|
798
798
|
{ name = "redis" },
|
|
799
|
+
{ name = "rich" },
|
|
799
800
|
{ name = "tiktoken" },
|
|
800
801
|
{ name = "together" },
|
|
801
802
|
{ name = "typing-extensions" },
|
|
@@ -810,7 +811,6 @@ dev = [
|
|
|
810
811
|
{ name = "inquirerpy" },
|
|
811
812
|
{ name = "pytest" },
|
|
812
813
|
{ name = "pytest-asyncio" },
|
|
813
|
-
{ name = "rich" },
|
|
814
814
|
{ name = "ruff" },
|
|
815
815
|
]
|
|
816
816
|
|
|
@@ -828,6 +828,7 @@ requires-dist = [
|
|
|
828
828
|
{ name = "pydantic", specifier = ">=2.11.7,<3.0" },
|
|
829
829
|
{ name = "pyyaml", specifier = ">=6.0.2" },
|
|
830
830
|
{ name = "redis", specifier = ">=6.2.0,<7.0" },
|
|
831
|
+
{ name = "rich" },
|
|
831
832
|
{ name = "tiktoken", specifier = "==0.11.0" },
|
|
832
833
|
{ name = "together", specifier = ">=1.5.25,<2.0" },
|
|
833
834
|
{ name = "typing-extensions", specifier = ">=4.14.1,<5.0" },
|
|
@@ -842,7 +843,6 @@ dev = [
|
|
|
842
843
|
{ name = "inquirerpy" },
|
|
843
844
|
{ name = "pytest" },
|
|
844
845
|
{ name = "pytest-asyncio" },
|
|
845
|
-
{ name = "rich" },
|
|
846
846
|
{ name = "ruff" },
|
|
847
847
|
]
|
|
848
848
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|