Skip to content

armgit / strix

Public Imported from GitHub
0

Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.

chore(llm): shorten timeout helper docstring; update tests

Ahmed Allam7d5a67d234bd
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