Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: replace assert with RuntimeError and fix return type annotation

Julio Quinteros0133d11eb204
diff --git a/litellm/a2a_protocol/main.py b/litellm/a2a_protocol/main.py
index 1ff2d93f839..8ee433516b3 100644
--- a/litellm/a2a_protocol/main.py
+++ b/litellm/a2a_protocol/main.py
@@ -198,7 +198,10 @@ async def _execute_a2a_send_with_retry(
continue
except Exception:
raise
- assert a2a_response is not None
+ if a2a_response is None:
+ raise RuntimeError(
+ "A2A send_message failed: no response received after retry attempts."
+ )
return a2a_response
diff --git a/litellm/fine_tuning/main.py b/litellm/fine_tuning/main.py
index 9b69a7a5bb1..9743d9028c4 100644
--- a/litellm/fine_tuning/main.py
+++ b/litellm/fine_tuning/main.py
@@ -129,13 +129,13 @@ async def acreate_fine_tuning_job(
def _resolve_fine_tuning_timeout(
timeout: Any,
custom_llm_provider: str,
-) -> float:
+) -> Union[float, httpx.Timeout]:
"""Normalise a raw timeout value to a float (seconds) for fine-tuning calls."""
timeout = timeout or 600.0
if isinstance(timeout, httpx.Timeout):
if not supports_httpx_timeout(custom_llm_provider):
return float(timeout.read or 600)
- return timeout # type: ignore[return-value]
+ return timeout
return float(timeout)