From 7d5a67d234bd3faef34d22be8c6f5a9607de41a3 Mon Sep 17 00:00:00 2001 From: Ahmed Allam Date: Sat, 18 Jul 2026 02:42:23 +0000 Subject: [PATCH] chore(llm): shorten timeout helper docstring; update tests --- strix/config/models.py | 14 +------------- tests/test_inputs.py | 4 ++-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/strix/config/models.py b/strix/config/models.py index df26deac..0ce107f5 100644 --- a/strix/config/models.py +++ b/strix/config/models.py @@ -22,19 +22,7 @@ if TYPE_CHECKING: def request_timeout_extra_args(timeout_s: float | None) -> dict[str, float] | None: - """Per-request model timeout as ``extra_args``, forwarded to the provider call. - - A stalled stream trips the timeout and is retried by ``DEFAULT_MODEL_RETRY``, - restoring pre-v1's per-turn inactivity guard. - - The value MUST be a plain ``float``, not an ``httpx.Timeout``. The Chat - Completions and LiteLLM model paths build their tracing generation span from - ``ModelSettings.to_json_dict()``, which pydantic-serializes ``extra_args`` in - JSON mode; an ``httpx.Timeout`` is not JSON-serializable and raises - ``PydanticSerializationError`` there, failing every turn on those paths. A - scalar serializes cleanly and, on httpx-based clients, is applied as the read - (inactivity) timeout — not a total-duration deadline. - """ + """Per-request model timeout; a plain float so ``ModelSettings.to_json_dict()`` stays serializable.""" # noqa: E501 if not timeout_s or timeout_s <= 0: return None return {"timeout": timeout_s} diff --git a/tests/test_inputs.py b/tests/test_inputs.py index b14280c1..bde83bd9 100644 --- a/tests/test_inputs.py +++ b/tests/test_inputs.py @@ -165,7 +165,7 @@ def test_make_model_settings_sets_request_timeout() -> None: ) assert settings.extra_args is not None - assert settings.extra_args["timeout"].read == 300.0 + assert settings.extra_args["timeout"] == 300.0 def test_make_model_settings_omits_timeout_when_unset() -> None: @@ -184,4 +184,4 @@ def test_make_model_settings_timeout_survives_reasoning_resolve() -> None: ) assert settings.extra_args is not None - assert settings.extra_args["timeout"].read == 120.0 + assert settings.extra_args["timeout"] == 120.0