dot-inference 4.0.0__tar.gz → 4.2.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.
Files changed (64) hide show
  1. {dot_inference-4.0.0 → dot_inference-4.2.0}/CHANGELOG.md +77 -3
  2. {dot_inference-4.0.0 → dot_inference-4.2.0}/PKG-INFO +44 -6
  3. {dot_inference-4.0.0 → dot_inference-4.2.0}/README.md +43 -5
  4. {dot_inference-4.0.0 → dot_inference-4.2.0}/docs/PUBLISHING.md +3 -2
  5. dot_inference-4.2.0/docs/VERSIONING.md +164 -0
  6. {dot_inference-4.0.0 → dot_inference-4.2.0}/pyproject.toml +1 -1
  7. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/__init__.py +5 -1
  8. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_client.py +4 -4
  9. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_llm_registry.py +55 -23
  10. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_local_check.py +17 -2
  11. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_openai_compat.py +15 -2
  12. dot_inference-4.2.0/src/dot_inference/_sync.py +51 -0
  13. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/models.yaml +96 -11
  14. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/settings.py +3 -1
  15. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_factories.py +14 -0
  16. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_llm_registry.py +78 -4
  17. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_local_check.py +21 -0
  18. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_openai_compat.py +59 -1
  19. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_routes.py +25 -0
  20. dot_inference-4.2.0/tests/test_sync.py +114 -0
  21. {dot_inference-4.0.0 → dot_inference-4.2.0}/uv.lock +1 -1
  22. dot_inference-4.0.0/docs/VERSIONING.md +0 -120
  23. dot_inference-4.0.0/src/dot_inference/_sync.py +0 -46
  24. {dot_inference-4.0.0 → dot_inference-4.2.0}/.env.template +0 -0
  25. {dot_inference-4.0.0 → dot_inference-4.2.0}/.gitignore +0 -0
  26. {dot_inference-4.0.0 → dot_inference-4.2.0}/.gitlab-ci.yml +0 -0
  27. {dot_inference-4.0.0 → dot_inference-4.2.0}/.pre-commit-config.yaml +0 -0
  28. {dot_inference-4.0.0 → dot_inference-4.2.0}/.python-version +0 -0
  29. {dot_inference-4.0.0 → dot_inference-4.2.0}/AUTHORS.md +0 -0
  30. {dot_inference-4.0.0 → dot_inference-4.2.0}/CONTRIBUTING.md +0 -0
  31. {dot_inference-4.0.0 → dot_inference-4.2.0}/LICENSE.md +0 -0
  32. {dot_inference-4.0.0 → dot_inference-4.2.0}/docs/ARCHITECTURE.md +0 -0
  33. {dot_inference-4.0.0 → dot_inference-4.2.0}/docs/DEVELOPMENT.md +0 -0
  34. {dot_inference-4.0.0 → dot_inference-4.2.0}/docs/provider-quirks/openrouter-errors.md +0 -0
  35. {dot_inference-4.0.0 → dot_inference-4.2.0}/docs/provider-quirks/strict-schemas.md +0 -0
  36. {dot_inference-4.0.0 → dot_inference-4.2.0}/docs/provider-quirks/tool-choice.md +0 -0
  37. {dot_inference-4.0.0 → dot_inference-4.2.0}/examples/demo.py +0 -0
  38. {dot_inference-4.0.0 → dot_inference-4.2.0}/examples/demo_streaming.py +0 -0
  39. {dot_inference-4.0.0 → dot_inference-4.2.0}/examples/doc_stream.md +0 -0
  40. {dot_inference-4.0.0 → dot_inference-4.2.0}/scripts/provider-quirks/tool-choice/mistral_compare.sh +0 -0
  41. {dot_inference-4.0.0 → dot_inference-4.2.0}/scripts/provider-quirks/tool-choice/mistral_runaway.sh +0 -0
  42. {dot_inference-4.0.0 → dot_inference-4.2.0}/scripts/provider-quirks/tool-choice/openrouter_compare.sh +0 -0
  43. {dot_inference-4.0.0 → dot_inference-4.2.0}/scripts/provider-quirks/tool-choice/openrouter_runaway.sh +0 -0
  44. {dot_inference-4.0.0 → dot_inference-4.2.0}/scripts/test_all_models.py +0 -0
  45. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/README.md +0 -0
  46. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_cost_tracker.py +0 -0
  47. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_mistral_compat.py +0 -0
  48. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_rate_limit.py +0 -0
  49. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_retry.py +0 -0
  50. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_routes.py +0 -0
  51. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_strict_schema.py +0 -0
  52. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/_types.py +0 -0
  53. {dot_inference-4.0.0 → dot_inference-4.2.0}/src/dot_inference/mock.py +0 -0
  54. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/__init__.py +0 -0
  55. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_constrained_live.py +0 -0
  56. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_cost_tracker.py +0 -0
  57. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_images.py +0 -0
  58. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_mistral_compat.py +0 -0
  59. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_mistral_live.py +0 -0
  60. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_rate_limit.py +0 -0
  61. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_retry.py +0 -0
  62. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_settings.py +0 -0
  63. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_strict_schema.py +0 -0
  64. {dot_inference-4.0.0 → dot_inference-4.2.0}/tests/test_types.py +0 -0
@@ -2,11 +2,83 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+ Versions follow [docs/VERSIONING.md](docs/VERSIONING.md): while the package is
7
+ in alpha, a minor release may contain breaking changes, each marked **Breaking**.
7
8
 
8
9
  ## [Unreleased]
9
10
 
11
+ ## [4.2.0] - 2026-11-12
12
+
13
+ ### Added
14
+
15
+ - `reasoning_chat_template_kwargs`, per provider in the registry
16
+ (`ProviderModelConfig`): for a self-hosted model whose chat template does not
17
+ read `reasoning_effort`, the `chat_template_kwargs` each effort stands for.
18
+ The client sends them in place of `reasoning_effort`; `chat_template_kwargs`
19
+ passed in `extra_body` win, one variable at a time.
20
+ - `LocalEndpointCheck.context_window`: the context window the local server
21
+ serves the model with (`max_model_len`, as vLLM and SGLang report it), `None`
22
+ when the server does not say. A self-hosted server is often started with less
23
+ than the model's limit.
24
+ - `get_max_context_window(model)`: the model's limit, as the registry declares
25
+ it.
26
+ - `nvidia/nemotron-3.5-super-vl-120b-a12b-local`: Nemotron 3.5 Super VL served
27
+ by vLLM. Its reasoning efforts are `none`, `medium` and `high` (the levels of
28
+ its chat template); with no effort chosen, the server's default applies.
29
+ - `lightonai/lightonocr-3-0.8b-local`: the LightOnOCR-3 OCR model served by
30
+ vLLM.
31
+
32
+ ### Changed
33
+
34
+ - Versioning: while the package is in alpha, breaking changes are released in
35
+ minor versions, each marked **Breaking** here, and no longer need a major.
36
+ Patch releases never break. A range such as `>=4,<5` therefore no longer rules
37
+ out a breaking change: see [docs/VERSIONING.md](docs/VERSIONING.md).
38
+ - **Breaking:** no reasoning effort is sent unless one is chosen.
39
+ `GenerationSettings.reasoning_effort` (`DOTI_GENERATION__REASONING_EFFORT`)
40
+ defaults to `None`, no longer to `medium`: a call that names no effort is left
41
+ to the provider's default, or the local server's, unless the model's registry
42
+ entry sets one (`default_reasoning_effort`). `medium` did not mean the same
43
+ thing from one model to the next, and overrode each provider's own default.
44
+ Set `DOTI_GENERATION__REASONING_EFFORT=medium` to keep sending it.
45
+ - **Breaking:** a reasoning model declares the efforts it accepts.
46
+ `reasoning_effort_options` is required with `supports_reasoning`, in a
47
+ `DOTI_CUSTOM_MODELS` file and in `ModelConfig`, which raise `ValueError`
48
+ without it; `[low, medium, high]` is no longer assumed. The built-in entries
49
+ that relied on it now list efforts that OpenRouter's model list gives them
50
+ (`reasoning.supported_efforts`).
51
+ - **Breaking:** `nvidia/nemotron-3-super-120b-a12b` accepts `none`, `low` and
52
+ `medium`, no longer `high`, which OpenRouter does not list for it.
53
+ - **Breaking:** `google/gemma-4-31b-it`, `minimax/minimax-m2.7`,
54
+ `qwen/qwen3.5-9b`, `qwen/qwen3.5-27b` and `anthropic/claude-haiku-4.5` no
55
+ longer take a reasoning effort (`supports_reasoning: false`): they reason, but
56
+ OpenRouter gives them no effort to choose, and the one sent made no difference.
57
+
58
+ ### Deprecated
59
+
60
+ - `get_context_window(model)`: use `get_max_context_window(model)`, the same
61
+ value under a name that says what it is. Removed in 5.0.
62
+
63
+ ## [4.1.0] - 2026-11-09
64
+
65
+ ### Added
66
+
67
+ - `run_sync(coro)` is public: it runs a coroutine from synchronous code on the
68
+ event loop that `call_sync`, `embed_sync` and `make_sync` share, so a client
69
+ created during one call can be used or closed during a later one. Libraries
70
+ driving `EmbeddingClient.embed` or `LLMClient.call` from sync code can use it
71
+ rather than `asyncio.run()`, which creates and closes a loop per call.
72
+
73
+ ### Fixed
74
+
75
+ - A forked process no longer blocks on its first sync call (`call_sync`,
76
+ `embed_sync`, `make_sync`): it used the parent's loop, whose thread does not
77
+ exist in the child. It now starts its own.
78
+ - Two sync calls made before the shared loop's thread had started it could
79
+ start two loops, splitting the clients between them. The loop is now started
80
+ once per process.
81
+
10
82
  ## [4.0.0] - 2026-11-04
11
83
 
12
84
  ### Added
@@ -223,7 +295,9 @@ this release.
223
295
  - `LLMCallable` and `EmbeddingCallable` return a `Coroutine` rather than the
224
296
  looser `Awaitable`, matching what `asyncio.run_coroutine_threadsafe` accepts.
225
297
 
226
- [Unreleased]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/compare/v4.0.0...main
298
+ [Unreleased]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/compare/v4.2.0...main
299
+ [4.2.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.2.0
300
+ [4.1.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.1.0
227
301
  [4.0.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.0.0
228
302
  [3.1.1]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v3.1.1
229
303
  [3.1.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v3.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dot-inference
3
- Version: 4.0.0
3
+ Version: 4.2.0
4
4
  Summary: Unified async Python library for LLM inference and embeddings across multiple providers
5
5
  Project-URL: Homepage, https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference
6
6
  Project-URL: Repository, https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference
@@ -72,7 +72,8 @@ instead of silently doing nothing.
72
72
  - Per-model default provider resolution — pick a model, let the registry choose the provider
73
73
  - Configurable HTTP timeouts (`DOTI_GENERATION__TIMEOUT`, `DOTI_EMBEDDING__TIMEOUT`)
74
74
  - Mock clients for testing without API calls
75
- - Sync wrappers (`call_sync`, `embed_sync`) for non-async codebases
75
+ - Sync wrappers (`call_sync`, `embed_sync`) for non-async codebases, and `run_sync`
76
+ for your own coroutines, on one event loop shared by the process
76
77
 
77
78
  ## Installation
78
79
 
@@ -155,6 +156,13 @@ client = get_llm_client(
155
156
  response = asyncio.run(client.call([Message(role=Role.USER, content="Solve this step by step...")]))
156
157
  ```
157
158
 
159
+ When no effort is chosen, none is sent: the provider, or the local server,
160
+ applies its own default. A model's registry entry may set one
161
+ (`default_reasoning_effort`), and so may the settings, for every model
162
+ (`DOTI_GENERATION__REASONING_EFFORT`). An effort name is not shared from one
163
+ model to the next: `allowed_reasoning_efforts(model)` returns those a model
164
+ accepts, and another one raises a `ValueError`.
165
+
158
166
  ### Structured output
159
167
 
160
168
  ```python
@@ -398,12 +406,40 @@ served = (await list_served_models(base_url))[0]
398
406
  register_model(ModelConfig(
399
407
  model_id=served,
400
408
  supports_reasoning=True,
409
+ reasoning_effort_options=["low", "medium", "high"], # those the served model accepts
401
410
  supports_vision=True, # if the served model reads images
402
411
  default_provider="local",
403
412
  providers={"local": ProviderModelConfig(api_model_name=served)},
404
413
  ))
405
414
  ```
406
415
 
416
+ Some self-hosted models do not read `reasoning_effort`: their chat template has
417
+ its own variables (`enable_thinking`…), which vLLM and SGLang take as
418
+ `chat_template_kwargs`. The registry then declares, for the `local` provider,
419
+ the variables each effort stands for (`reasoning_chat_template_kwargs`), and
420
+ the client sends those in place of `reasoning_effort`. The caller chooses an
421
+ effort as for any other model:
422
+
423
+ ```python
424
+ client = get_llm_client(settings, model="nvidia/nemotron-3.5-super-vl-120b-a12b-local")
425
+ await client.call(messages, reasoning_effort="none") # sends enable_thinking: false
426
+ ```
427
+
428
+ `chat_template_kwargs` passed in `extra_body` win over those of the effort, one
429
+ variable at a time.
430
+
431
+ The registry's `context_window` is the model's limit
432
+ (`get_max_context_window(model)`). A self-hosted server is started with the
433
+ window its hardware holds, often a smaller one, and vLLM and SGLang report it:
434
+ `check_local_endpoint(model)` returns it as `.context_window` (`None` when the
435
+ server does not say). Size prompts from that one:
436
+
437
+ ```python
438
+ model = "nvidia/nemotron-3.5-super-vl-120b-a12b-local"
439
+ check = await check_local_endpoint(model)
440
+ window = (check and check.context_window) or get_max_context_window(model)
441
+ ```
442
+
407
443
  ## Testing without API calls
408
444
 
409
445
  ```python
@@ -415,12 +451,14 @@ your Pydantic schema — so tests never reach a provider.
415
451
 
416
452
  ## Stability
417
453
 
418
- `dot-inference` follows semantic versioning: everything exported from the top-level
419
- package is covered, anything underscore-prefixed is internal and may change in
420
- any release. Public names are never removed without a deprecation period.
454
+ `dot-inference` is in alpha, and its API still moves. A patch release only
455
+ fixes; a minor release may break, and says so under **Breaking** in the
456
+ [changelog](CHANGELOG.md); a major is kept for a redesign. Everything exported
457
+ from the top-level package is covered, anything underscore-prefixed is internal
458
+ and may change in any release.
421
459
 
422
460
  ```toml
423
- dependencies = ["dot-inference>=3.0,<4"]
461
+ dependencies = ["dot-inference>=4.2,<4.3"] # patches only
424
462
  ```
425
463
 
426
464
  See [docs/VERSIONING.md](docs/VERSIONING.md) for the full policy.
@@ -45,7 +45,8 @@ instead of silently doing nothing.
45
45
  - Per-model default provider resolution — pick a model, let the registry choose the provider
46
46
  - Configurable HTTP timeouts (`DOTI_GENERATION__TIMEOUT`, `DOTI_EMBEDDING__TIMEOUT`)
47
47
  - Mock clients for testing without API calls
48
- - Sync wrappers (`call_sync`, `embed_sync`) for non-async codebases
48
+ - Sync wrappers (`call_sync`, `embed_sync`) for non-async codebases, and `run_sync`
49
+ for your own coroutines, on one event loop shared by the process
49
50
 
50
51
  ## Installation
51
52
 
@@ -128,6 +129,13 @@ client = get_llm_client(
128
129
  response = asyncio.run(client.call([Message(role=Role.USER, content="Solve this step by step...")]))
129
130
  ```
130
131
 
132
+ When no effort is chosen, none is sent: the provider, or the local server,
133
+ applies its own default. A model's registry entry may set one
134
+ (`default_reasoning_effort`), and so may the settings, for every model
135
+ (`DOTI_GENERATION__REASONING_EFFORT`). An effort name is not shared from one
136
+ model to the next: `allowed_reasoning_efforts(model)` returns those a model
137
+ accepts, and another one raises a `ValueError`.
138
+
131
139
  ### Structured output
132
140
 
133
141
  ```python
@@ -371,12 +379,40 @@ served = (await list_served_models(base_url))[0]
371
379
  register_model(ModelConfig(
372
380
  model_id=served,
373
381
  supports_reasoning=True,
382
+ reasoning_effort_options=["low", "medium", "high"], # those the served model accepts
374
383
  supports_vision=True, # if the served model reads images
375
384
  default_provider="local",
376
385
  providers={"local": ProviderModelConfig(api_model_name=served)},
377
386
  ))
378
387
  ```
379
388
 
389
+ Some self-hosted models do not read `reasoning_effort`: their chat template has
390
+ its own variables (`enable_thinking`…), which vLLM and SGLang take as
391
+ `chat_template_kwargs`. The registry then declares, for the `local` provider,
392
+ the variables each effort stands for (`reasoning_chat_template_kwargs`), and
393
+ the client sends those in place of `reasoning_effort`. The caller chooses an
394
+ effort as for any other model:
395
+
396
+ ```python
397
+ client = get_llm_client(settings, model="nvidia/nemotron-3.5-super-vl-120b-a12b-local")
398
+ await client.call(messages, reasoning_effort="none") # sends enable_thinking: false
399
+ ```
400
+
401
+ `chat_template_kwargs` passed in `extra_body` win over those of the effort, one
402
+ variable at a time.
403
+
404
+ The registry's `context_window` is the model's limit
405
+ (`get_max_context_window(model)`). A self-hosted server is started with the
406
+ window its hardware holds, often a smaller one, and vLLM and SGLang report it:
407
+ `check_local_endpoint(model)` returns it as `.context_window` (`None` when the
408
+ server does not say). Size prompts from that one:
409
+
410
+ ```python
411
+ model = "nvidia/nemotron-3.5-super-vl-120b-a12b-local"
412
+ check = await check_local_endpoint(model)
413
+ window = (check and check.context_window) or get_max_context_window(model)
414
+ ```
415
+
380
416
  ## Testing without API calls
381
417
 
382
418
  ```python
@@ -388,12 +424,14 @@ your Pydantic schema — so tests never reach a provider.
388
424
 
389
425
  ## Stability
390
426
 
391
- `dot-inference` follows semantic versioning: everything exported from the top-level
392
- package is covered, anything underscore-prefixed is internal and may change in
393
- any release. Public names are never removed without a deprecation period.
427
+ `dot-inference` is in alpha, and its API still moves. A patch release only
428
+ fixes; a minor release may break, and says so under **Breaking** in the
429
+ [changelog](CHANGELOG.md); a major is kept for a redesign. Everything exported
430
+ from the top-level package is covered, anything underscore-prefixed is internal
431
+ and may change in any release.
394
432
 
395
433
  ```toml
396
- dependencies = ["dot-inference>=3.0,<4"]
434
+ dependencies = ["dot-inference>=4.2,<4.3"] # patches only
397
435
  ```
398
436
 
399
437
  See [docs/VERSIONING.md](docs/VERSIONING.md) for the full policy.
@@ -61,8 +61,9 @@ It has to be declared once on each index, *before* the first upload.
61
61
  uv version --bump major # 2.0.0 -> 3.0.0
62
62
  ```
63
63
 
64
- Semantic versioning: breaking changes go in `major`, new features in `minor`,
65
- fixes in `patch`.
64
+ Fixes go in `patch`; new features and breaking changes in `minor`, the
65
+ breaking ones listed as **Breaking** in the changelog; `major` is kept for a
66
+ redesign ([VERSIONING.md](VERSIONING.md)).
66
67
 
67
68
  3. Commit, tag and push:
68
69
 
@@ -0,0 +1,164 @@
1
+ # Versioning and stability
2
+
3
+ `dot-inference` is in alpha (`Development Status :: 3 - Alpha` in
4
+ `pyproject.toml`): its API still moves. Versions are `MAJOR.MINOR.PATCH`, and
5
+ while the alpha lasts they mean this:
6
+
7
+ | Release | What it may contain |
8
+ |---|---|
9
+ | patch (`4.2.0` → `4.2.1`) | Fixes only. Never a breaking change. |
10
+ | minor (`4.2.0` → `4.3.0`) | New features, and breaking changes, each one listed as **Breaking** in the changelog with what to do about it. |
11
+ | major (`4.x` → `5.0.0`) | A redesign that touches most callers, or the end of the alpha. Rare. |
12
+
13
+ This is not [Semantic Versioning](https://semver.org/spec/v2.0.0.html), where
14
+ only a major may break: an API that moves this often would get a new major every
15
+ few weeks, and the number would say nothing. The release that ends the alpha is a
16
+ major, and from then on breaking changes are made in majors only.
17
+
18
+ ## What is public
19
+
20
+ **Public API** — everything exported from the top-level package:
21
+
22
+ ```python
23
+ import dot_inference
24
+ dot_inference.__all__ # this, and nothing else
25
+ ```
26
+
27
+ Public names are covered by the rules below: they never break in a patch, and
28
+ never without a **Breaking** entry in the changelog.
29
+
30
+ **Internal** — everything else, including:
31
+
32
+ - any module whose name starts with an underscore (`_client.py`, `_types.py`, `_openai_compat.py`)
33
+ - any attribute or method starting with an underscore, even on a public class
34
+ (`client._model_config`)
35
+ - the exact wording of log messages and exception text
36
+
37
+ Internals can change in any release, including a patch. If you find yourself
38
+ reaching for one, open an issue — that is usually a sign something is missing
39
+ from the public API.
40
+
41
+ **The model registry is data, not API.** What `models.yaml` says of a model
42
+ (its prices, its context window, its capabilities, the reasoning efforts it
43
+ accepts) follows the providers, which change them without notice. A registry
44
+ change ships in a minor, or in a patch when it only corrects a figure. One that
45
+ takes something away from a model is listed as **Breaking**, with no deprecation
46
+ period: the provider has already made the change.
47
+
48
+ ## What triggers which bump
49
+
50
+ | Change | Bump |
51
+ |---|---|
52
+ | Removing or renaming a public name | minor, **Breaking** |
53
+ | Removing a parameter, or making an optional one required | minor, **Breaking** |
54
+ | Narrowing an accepted type, or widening a return type | minor, **Breaking** |
55
+ | Changing documented behaviour in a way existing code would notice | minor, **Breaking** |
56
+ | Removing a deprecated name after its grace period | minor, **Breaking** |
57
+ | Adding a new public name | minor |
58
+ | Adding an optional parameter with a backward-compatible default | minor |
59
+ | Deprecating something (it still works) | minor |
60
+ | New optional dependency or extra | minor |
61
+ | Bug fix that restores documented behaviour | patch |
62
+ | Performance work, internal refactor, doc or typo fix | patch |
63
+ | Widening an accepted type, or narrowing a return type | patch |
64
+
65
+ Two cases worth spelling out, because they are easy to pass off as fixes and
66
+ put in a patch:
67
+
68
+ - **Raising instead of silently degrading is a breaking change.** Code that used
69
+ to get a truncated result and now gets an exception is broken code, even
70
+ though the new behaviour is more correct.
71
+ - **Tightening validation is a breaking change.** Input that used to be accepted
72
+ and is now rejected breaks callers, however wrong that input was.
73
+
74
+ ## Breaking changes
75
+
76
+ A breaking change is announced where the person upgrading will read it: under
77
+ `### Changed` or `### Removed` in the changelog, starting with **Breaking:**,
78
+ saying what changes and what to do (the setting that restores the former
79
+ behaviour, the name to use instead).
80
+
81
+ Deprecate first when the old and the new can live side by side: a renamed
82
+ function, a replaced parameter. A change of default or of validation cannot be
83
+ deprecated, and goes in directly.
84
+
85
+ ## Deprecation policy
86
+
87
+ The cycle is:
88
+
89
+ 1. **Deprecate in a minor release.** The old name keeps working, and is marked
90
+ with `@deprecated` from PEP 702:
91
+
92
+ ```python
93
+ from typing_extensions import deprecated
94
+
95
+
96
+ @deprecated("Use search_all() instead; removed in 4.4.")
97
+ def search_everything() -> list[str]:
98
+ return search_all()
99
+ ```
100
+
101
+ This is not just a runtime `DeprecationWarning`: type checkers (`ty`, mypy,
102
+ pyright) report the call site, so users see it in their editor and their CI
103
+ rather than only when warnings happen to be enabled.
104
+
105
+ 2. **Say so in the changelog**, under `### Deprecated`, naming the replacement
106
+ and the version that will remove it.
107
+
108
+ 3. **Remove in a later minor or major**, never sooner than one minor release
109
+ after the deprecation, and never before the version the message names. A name
110
+ deprecated in 4.2.0 can go in 4.3.0, but a name deprecated in the same release
111
+ that drops it never gets a grace period.
112
+
113
+ The message is part of the contract: it must name the replacement and the
114
+ removal version, so a user can act without reading the source.
115
+
116
+ > `typing_extensions` is a direct dependency for this reason — `typing.deprecated`
117
+ > only exists from Python 3.13, and this package supports 3.12.
118
+
119
+ ## Release candidates
120
+
121
+ Tags shaped `vX.Y.Z-rc.N` build and publish to TestPyPI only; the PyPI job stays
122
+ manual. Use them to validate a release without committing to it.
123
+
124
+ ## Consuming dot-inference
125
+
126
+ ### From PyPI — the supported way
127
+
128
+ An application commits its lock file (`uv.lock`): the lock is what keeps it on
129
+ the version it was tested with, whatever gets published. The range in
130
+ `pyproject.toml` only decides what a lock refresh may bring in:
131
+
132
+ ```toml
133
+ dependencies = ["dot-inference>=4.2,<4.3"] # patches only: nothing breaks
134
+ dependencies = ["dot-inference>=4.2,<5"] # minors too: read the Breaking entries first
135
+ ```
136
+
137
+ A library that depends on `dot-inference` has no lock file to ship: only its range
138
+ counts. Give it the wide one (`>=4.2,<5`):
139
+
140
+ - With a narrow range (`<4.3`), the library would have to publish a new
141
+ version at every minor of `dot-inference`, only to allow it.
142
+ - In return, run the library's tests with the latest minor of `dot-inference`, so
143
+ that a break shows up there first.
144
+ - Raise the lower bound only when the library starts using something a newer
145
+ version added.
146
+
147
+ ### From git — development only
148
+
149
+ Pinning a branch:
150
+
151
+ ```toml
152
+ [tool.uv.sources]
153
+ dot-inference = { git = "...", rev = "main" } # don't do this in a published package
154
+ ```
155
+
156
+ means accepting whatever lands on `main`, breaking changes included, with no
157
+ changelog entry yet to tell you so.
158
+
159
+ It is fine while developing two packages side by side — but keep it out of any
160
+ `pyproject.toml` you publish. Prefer a local, uncommitted override:
161
+
162
+ ```shell
163
+ uv pip install -e ../dot-inference
164
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dot-inference"
3
- version = "4.0.0"
3
+ version = "4.2.0"
4
4
  description = "Unified async Python library for LLM inference and embeddings across multiple providers"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Kannon For Deep Tech", email = "louis.letarnec@deepika.ai" }]
@@ -11,7 +11,8 @@ from dot_inference._llm_registry import (
11
11
  ResolvedModelConfig,
12
12
  allowed_reasoning_efforts,
13
13
  default_reasoning_effort,
14
- get_context_window,
14
+ get_context_window, # ty: ignore[deprecated]
15
+ get_max_context_window,
15
16
  get_model_config,
16
17
  list_models,
17
18
  register_model,
@@ -26,6 +27,7 @@ from dot_inference._local_check import (
26
27
  from dot_inference._rate_limit import with_rate_limit
27
28
  from dot_inference._routes import ModelRoute, resolve_embedding_route, resolve_llm_route
28
29
  from dot_inference._strict_schema import to_strict_schema
30
+ from dot_inference._sync import run_sync
29
31
  from dot_inference._types import (
30
32
  EmbeddingCallable,
31
33
  ImageDetail,
@@ -89,6 +91,7 @@ __all__ = [
89
91
  "get_context_window",
90
92
  "get_embedding_client",
91
93
  "get_llm_client",
94
+ "get_max_context_window",
92
95
  "get_model_config",
93
96
  "has_images",
94
97
  "image_part",
@@ -99,6 +102,7 @@ __all__ = [
99
102
  "resolve_embedding_route",
100
103
  "resolve_llm_route",
101
104
  "resolve_model_config",
105
+ "run_sync",
102
106
  "text_part",
103
107
  "text_stream",
104
108
  "to_strict_schema",
@@ -415,8 +415,8 @@ def _validate_reasoning_effort_for_model(
415
415
  """Raise ValueError if *reasoning_effort* isn't accepted by *model_id*.
416
416
 
417
417
  A no-op for non-reasoning models (the value is ignored downstream), for
418
- ``None`` (means "use instance default"), and for models that declare no
419
- restricted option set.
418
+ ``None`` (means "use instance default"), and for models the registry does
419
+ not know.
420
420
  """
421
421
  if reasoning_effort is None or not supports_reasoning:
422
422
  return
@@ -515,8 +515,8 @@ def get_llm_client(
515
515
  resolve_llm_route(resolved_model, settings, provider=resolved_provider)
516
516
  resolved_temperature = gen_settings.temperature if temperature is None else temperature
517
517
  # Precedence: explicit call arg > the model's declared default > global
518
- # default. The per-model default lets a restricted model (e.g. Mistral
519
- # Medium 3.5, which rejects the global "medium") pick a value it accepts.
518
+ # default (none unless the settings give one). With none of the three, no
519
+ # effort is sent: the provider, or the local server, applies its own.
520
520
  if reasoning_effort is not None:
521
521
  resolved_reasoning_effort = reasoning_effort
522
522
  else: