dot-inference 4.3.0__tar.gz → 4.4.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 (63) hide show
  1. {dot_inference-4.3.0 → dot_inference-4.4.0}/CHANGELOG.md +17 -1
  2. {dot_inference-4.3.0 → dot_inference-4.4.0}/PKG-INFO +2 -2
  3. {dot_inference-4.3.0 → dot_inference-4.4.0}/README.md +1 -1
  4. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/provider-quirks/tool-choice.md +22 -6
  5. {dot_inference-4.3.0 → dot_inference-4.4.0}/pyproject.toml +1 -1
  6. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/models.yaml +12 -1
  7. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_llm_registry.py +8 -1
  8. {dot_inference-4.3.0 → dot_inference-4.4.0}/uv.lock +1 -1
  9. {dot_inference-4.3.0 → dot_inference-4.4.0}/.env.template +0 -0
  10. {dot_inference-4.3.0 → dot_inference-4.4.0}/.gitignore +0 -0
  11. {dot_inference-4.3.0 → dot_inference-4.4.0}/.gitlab-ci.yml +0 -0
  12. {dot_inference-4.3.0 → dot_inference-4.4.0}/.pre-commit-config.yaml +0 -0
  13. {dot_inference-4.3.0 → dot_inference-4.4.0}/.python-version +0 -0
  14. {dot_inference-4.3.0 → dot_inference-4.4.0}/AUTHORS.md +0 -0
  15. {dot_inference-4.3.0 → dot_inference-4.4.0}/CONTRIBUTING.md +0 -0
  16. {dot_inference-4.3.0 → dot_inference-4.4.0}/LICENSE.md +0 -0
  17. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/ARCHITECTURE.md +0 -0
  18. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/DEVELOPMENT.md +0 -0
  19. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/PUBLISHING.md +0 -0
  20. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/VERSIONING.md +0 -0
  21. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/provider-quirks/openrouter-errors.md +0 -0
  22. {dot_inference-4.3.0 → dot_inference-4.4.0}/docs/provider-quirks/strict-schemas.md +0 -0
  23. {dot_inference-4.3.0 → dot_inference-4.4.0}/examples/demo.py +0 -0
  24. {dot_inference-4.3.0 → dot_inference-4.4.0}/examples/demo_streaming.py +0 -0
  25. {dot_inference-4.3.0 → dot_inference-4.4.0}/examples/doc_stream.md +0 -0
  26. {dot_inference-4.3.0 → dot_inference-4.4.0}/scripts/provider-quirks/tool-choice/mistral_compare.sh +0 -0
  27. {dot_inference-4.3.0 → dot_inference-4.4.0}/scripts/provider-quirks/tool-choice/mistral_runaway.sh +0 -0
  28. {dot_inference-4.3.0 → dot_inference-4.4.0}/scripts/provider-quirks/tool-choice/openrouter_compare.sh +0 -0
  29. {dot_inference-4.3.0 → dot_inference-4.4.0}/scripts/provider-quirks/tool-choice/openrouter_runaway.sh +0 -0
  30. {dot_inference-4.3.0 → dot_inference-4.4.0}/scripts/test_all_models.py +0 -0
  31. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/README.md +0 -0
  32. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/__init__.py +0 -0
  33. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_client.py +0 -0
  34. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_context_window.py +0 -0
  35. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_cost_tracker.py +0 -0
  36. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_llm_registry.py +0 -0
  37. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_local_check.py +0 -0
  38. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_mistral_compat.py +0 -0
  39. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_openai_compat.py +0 -0
  40. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_rate_limit.py +0 -0
  41. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_retry.py +0 -0
  42. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_routes.py +0 -0
  43. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_strict_schema.py +0 -0
  44. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_sync.py +0 -0
  45. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/_types.py +0 -0
  46. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/mock.py +0 -0
  47. {dot_inference-4.3.0 → dot_inference-4.4.0}/src/dot_inference/settings.py +0 -0
  48. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/__init__.py +0 -0
  49. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_constrained_live.py +0 -0
  50. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_cost_tracker.py +0 -0
  51. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_factories.py +0 -0
  52. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_images.py +0 -0
  53. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_local_check.py +0 -0
  54. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_mistral_compat.py +0 -0
  55. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_mistral_live.py +0 -0
  56. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_openai_compat.py +0 -0
  57. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_rate_limit.py +0 -0
  58. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_retry.py +0 -0
  59. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_routes.py +0 -0
  60. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_settings.py +0 -0
  61. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_strict_schema.py +0 -0
  62. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_sync.py +0 -0
  63. {dot_inference-4.3.0 → dot_inference-4.4.0}/tests/test_types.py +0 -0
@@ -8,6 +8,21 @@ in alpha, a minor release may contain breaking changes, each marked **Breaking**
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [4.4.0] - 2026-11-17
12
+
13
+ ### Changed
14
+
15
+ - **Breaking:** `mistral/mistral-large-4` and `mistral/mistral-large-latest`
16
+ are registered `supports_forced_tool_choice: false`, as Claude Opus 5.5 and
17
+ Sonnet 5.5 are: `tool_choice="required"` or a tool name now raises
18
+ `ValueError` before the call. Mistral accepts `"required"` on Large 4 but
19
+ does not honour it: when the model would rather answer in text, it cannot
20
+ stop, and the reply runs to `max_tokens`, or for as long as the stream lasts
21
+ when none is set. An agent loop that forces every step hits it once its
22
+ work is done. Send `"auto"` instead, and take a text reply as the answer
23
+ ([tool-choice.md](docs/provider-quirks/tool-choice.md)). Mistral Small 4 is
24
+ unchanged.
25
+
11
26
  ## [4.3.0] - 2026-11-14
12
27
 
13
28
  ### Added
@@ -389,7 +404,8 @@ this release.
389
404
  - `LLMCallable` and `EmbeddingCallable` return a `Coroutine` rather than the
390
405
  looser `Awaitable`, matching what `asyncio.run_coroutine_threadsafe` accepts.
391
406
 
392
- [Unreleased]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/compare/v4.3.0...main
407
+ [Unreleased]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/compare/v4.4.0...main
408
+ [4.4.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.4.0
393
409
  [4.3.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.3.0
394
410
  [4.2.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.2.0
395
411
  [4.1.0]: https://gitlab.com/deepika6190303/deepika-open-toolbox/dot-inference/-/tags/v4.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dot-inference
3
- Version: 4.3.0
3
+ Version: 4.4.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
@@ -361,7 +361,7 @@ args = tools[0].parse_arguments(response.tool_calls[0].arguments) # WeatherArgs
361
361
 
362
362
  `parameters` is a JSON schema dict, sent as written, or a Pydantic model. A model's schema is sent, rewritten to OpenAI's strict rules when `strict=True` (for every provider: OpenAI and Claude both reject a strict tool with an open object). A call's `arguments` stays the JSON string the provider sent; `ToolDef.parse_arguments()` validates it into the model, raising `ValidationError` when it does not match.
363
363
 
364
- `strict=True` asks the server to constrain the arguments to the schema exactly; it is only sent when set, and OpenAI then imposes its own schema rules ([strict-schemas.md](docs/provider-quirks/strict-schemas.md)). Some models cannot be forced to call a tool (Claude Opus 5.5 and Sonnet 5.5): `"required"` or a tool name raises `ValueError` there ([tool-choice.md](docs/provider-quirks/tool-choice.md)). `extra_body` fields win over those the client adds itself (OpenRouter routing, `cache_control`); the Mistral client rejects `extra_body`.
364
+ `strict=True` asks the server to constrain the arguments to the schema exactly; it is only sent when set, and OpenAI then imposes its own schema rules ([strict-schemas.md](docs/provider-quirks/strict-schemas.md)). Some models cannot be forced to call a tool (Claude Opus 5.5 and Sonnet 5.5, which reject it, and Mistral Large 4, which accepts `"required"` but does not honour it): `"required"` or a tool name raises `ValueError` there ([tool-choice.md](docs/provider-quirks/tool-choice.md)). `extra_body` fields win over those the client adds itself (OpenRouter routing, `cache_control`); the Mistral client rejects `extra_body`.
365
365
 
366
366
  ## On-premise inference (vLLM, SGLang, Ollama)
367
367
 
@@ -334,7 +334,7 @@ args = tools[0].parse_arguments(response.tool_calls[0].arguments) # WeatherArgs
334
334
 
335
335
  `parameters` is a JSON schema dict, sent as written, or a Pydantic model. A model's schema is sent, rewritten to OpenAI's strict rules when `strict=True` (for every provider: OpenAI and Claude both reject a strict tool with an open object). A call's `arguments` stays the JSON string the provider sent; `ToolDef.parse_arguments()` validates it into the model, raising `ValidationError` when it does not match.
336
336
 
337
- `strict=True` asks the server to constrain the arguments to the schema exactly; it is only sent when set, and OpenAI then imposes its own schema rules ([strict-schemas.md](docs/provider-quirks/strict-schemas.md)). Some models cannot be forced to call a tool (Claude Opus 5.5 and Sonnet 5.5): `"required"` or a tool name raises `ValueError` there ([tool-choice.md](docs/provider-quirks/tool-choice.md)). `extra_body` fields win over those the client adds itself (OpenRouter routing, `cache_control`); the Mistral client rejects `extra_body`.
337
+ `strict=True` asks the server to constrain the arguments to the schema exactly; it is only sent when set, and OpenAI then imposes its own schema rules ([strict-schemas.md](docs/provider-quirks/strict-schemas.md)). Some models cannot be forced to call a tool (Claude Opus 5.5 and Sonnet 5.5, which reject it, and Mistral Large 4, which accepts `"required"` but does not honour it): `"required"` or a tool name raises `ValueError` there ([tool-choice.md](docs/provider-quirks/tool-choice.md)). `extra_body` fields win over those the client adds itself (OpenRouter routing, `cache_control`); the Mistral client rejects `extra_body`.
338
338
 
339
339
  ## On-premise inference (vLLM, SGLang, Ollama)
340
340
 
@@ -96,13 +96,22 @@ calls for a tool is fine. It fails where forcing is the point:
96
96
 
97
97
  - a user message unrelated to the tools (a greeting, a thank-you, a general
98
98
  question);
99
- - an agent loop that keeps `"required"` after tool results, when the model
100
- would rather answer (not tested);
99
+ - an agent loop that keeps `"required"` after tool results, once the model
100
+ would rather answer (seen on Large 4, below);
101
101
  - a "final answer" tool forced to get a structured reply.
102
102
 
103
103
  A failed call costs the whole `max_tokens` (dot-inference sets no default) and
104
104
  comes back with no `tool_calls` and `finish_reason` `"length"` or `"error"`.
105
105
 
106
+ **In an agent loop.** Seen in production on Large 4 (Mistral API, 2026-11-16
107
+ and 17), in an agent that sends `"required"` at every step and no
108
+ `max_tokens`: once its tool calls were done, the model wrote its conclusion as
109
+ text instead of calling the tool that concludes, and kept writing. About 2.5%
110
+ of the calls ran away, for minutes up to most of an hour each, and ended with
111
+ `finish_reason` `"length"` (262,144 tokens), `"error"`, or a stream closed
112
+ with no finish reason. The same agent sending `"auto"`, and taking a text
113
+ reply as its answer, made 193 calls to Large 4 with none over 75 s.
114
+
106
115
  **A tool name stops working with `strict`.** Without `strict`, naming the tool
107
116
  forced a call every time on every model. With `ToolDef(strict=True)`, it fails
108
117
  the same way on Medium 3.1 (3/5), Medium 3.5 (4/5) and Large 4 (1/5, and 2/3
@@ -110,12 +119,19 @@ in an earlier run); Small 4 and Large 3 still call 5/5. Tokyo prompt, five runs
110
119
  each, 2026-10-27. On those three models, a forced call and strict arguments
111
120
  cannot be had together.
112
121
 
122
+ **What dot-inference does.** The registry marks Large 4 and
123
+ `mistral-large-latest` `supports_forced_tool_choice: false`, as it does Claude
124
+ Opus 5.5 and Sonnet 5.5: `"required"` or a tool name raises `ValueError`
125
+ before the call. A tool name without `strict` would still hold on Large 4, but
126
+ the flag does not tell the two apart. Small 4 stays forceable: a tool name
127
+ holds there, `strict` or not.
128
+
113
129
  **What to do on these models:**
114
130
 
115
- 1. One tool: pass its name, not `"required"`, and leave `strict` off on Medium
116
- 3.1, Medium 3.5 and Large 4.
117
- 2. Several tools: `"auto"` with a clear instruction in the prompt is as
118
- reliable, without the runaway reply.
131
+ 1. One tool, on Small 4: pass its name, not `"required"`.
132
+ 2. Several tools, or Large 4: `"auto"` with a clear instruction in the prompt
133
+ is as reliable, without the runaway reply. In an agent loop, take a text
134
+ reply as the answer.
119
135
  3. Always set `max_tokens`, to cap the cost of a miss.
120
136
 
121
137
  Two runs per cell and four prompts show a trend, not a rate: test the requests
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dot-inference"
3
- version = "4.3.0"
3
+ version = "4.4.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" }]
@@ -56,7 +56,9 @@
56
56
  # - Whether tool_choice can force a tool call ("required" or a tool
57
57
  # name). When false, such a request raises ValueError before anything
58
58
  # is sent; "auto" and "none" still work. Claude Opus 5.5 and Sonnet
59
- # 5.5 reject forced tool use (see docs/provider-quirks/tool-choice.md).
59
+ # 5.5 reject forced tool use; Mistral Large 4 accepts "required" but
60
+ # does not honour it, and writes text until max_tokens instead (see
61
+ # docs/provider-quirks/tool-choice.md).
60
62
  #
61
63
  # reasoning_effort_options: list[str] (required when supports_reasoning)
62
64
  # - The reasoning_effort values this model actually accepts. Lets a
@@ -331,6 +333,8 @@ mistral/mistral-large-latest:
331
333
  supports_reasoning: true
332
334
  reasoning_effort_options: [low, medium, high]
333
335
  default_reasoning_effort: medium
336
+ # Forced tool use: see mistral/mistral-large-4.
337
+ supports_forced_tool_choice: false
334
338
  input_token_cost: 7e-7 # $0.70/M
335
339
  output_token_cost: 2.1e-6 # $2.10/M
336
340
  context_window: 1048576
@@ -359,6 +363,13 @@ mistral/mistral-large-4:
359
363
  supports_reasoning: true
360
364
  reasoning_effort_options: [low, medium, high]
361
365
  default_reasoning_effort: medium
366
+ # tool_choice "required" is accepted but does not force a call: when the
367
+ # model would rather answer in text, it cannot stop, and the reply runs to
368
+ # max_tokens (finish_reason "length" or "error"), on La Plateforme and
369
+ # through OpenRouter. Forcing is refused here, a tool name too (it holds
370
+ # only while the tool is not strict): send "auto"
371
+ # (docs/provider-quirks/tool-choice.md).
372
+ supports_forced_tool_choice: false
362
373
  input_token_cost: 7e-7 # $0.70/M
363
374
  output_token_cost: 2.1e-6 # $2.10/M
364
375
  context_window: 1048576
@@ -355,12 +355,19 @@ def test_supports_temperature_provider_override():
355
355
 
356
356
 
357
357
  def test_supports_forced_tool_choice_registry_values():
358
- """Claude Opus 5.5 and Sonnet 5.5 reject a forced tool call; Haiku 5.5 accepts it."""
358
+ """Claude Opus 5.5 and Sonnet 5.5 reject a forced tool call; Haiku 5.5 accepts it.
359
+ Mistral Large 4 (and the alias that resolves to it) accepts "required" without
360
+ honouring it, on both of its routes.
361
+ """
359
362
  for model in ("anthropic/claude-opus-5.5", "anthropic/claude-sonnet-5.5"):
360
363
  config = get_model_config(model, provider="openrouter")
361
364
  assert config is not None and not config.supports_forced_tool_choice
362
365
  haiku = get_model_config("anthropic/claude-haiku-5.5", provider="openrouter")
363
366
  assert haiku is not None and haiku.supports_forced_tool_choice
367
+ for model in ("mistral/mistral-large-4", "mistral/mistral-large-latest"):
368
+ for provider in ("mistral", "openrouter"):
369
+ config = get_model_config(model, provider=provider)
370
+ assert config is not None and not config.supports_forced_tool_choice
364
371
 
365
372
 
366
373
  def test_supports_forced_tool_choice_defaults_true():
@@ -119,7 +119,7 @@ wheels = [
119
119
 
120
120
  [[package]]
121
121
  name = "dot-inference"
122
- version = "4.3.0"
122
+ version = "4.4.0"
123
123
  source = { editable = "." }
124
124
  dependencies = [
125
125
  { name = "httpx" },
File without changes
File without changes
File without changes