mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
test(e2e): shorten the new helper docstrings
This commit is contained in:
parent
0d3be46456
commit
e18fb87f69
4 changed files with 5 additions and 23 deletions
|
|
@ -356,15 +356,8 @@ def tolerate_provider_rate_limit[R: BaseModel](
|
|||
attempts: int = PROVIDER_RATE_LIMIT_ATTEMPTS,
|
||||
sleep: Callable[[float], None] = time.sleep,
|
||||
) -> Result[R]:
|
||||
"""Bounded, opt-in retry of one call the PROVIDER throttled, for a deployment
|
||||
with no fallback group whose provider key is shared with the suites that run
|
||||
alongside this one. The transport never retries a 429 (see request_with_retry),
|
||||
and this helper only absorbs the 429s the proxy relayed from the provider, which
|
||||
litellm's exception mapping prefixes with its exception class; the proxy's own
|
||||
limiter and budget 429s never carry that prefix and come back untouched, so
|
||||
every assertion on those still sees them. The wait honors Retry-After when the
|
||||
provider sent one and backs off geometrically otherwise, and every retry prints
|
||||
so the throttling stays visible in the run log instead of vanishing into green."""
|
||||
"""Retry a call up to `attempts` times while the proxy relays the provider's own 429;
|
||||
any other outcome, the proxy's own 429 included, comes back at once."""
|
||||
for attempt in range(1, attempts):
|
||||
match issue():
|
||||
case RateLimitedError(body=body, retry_after_seconds=retry_after) if PROVIDER_RATE_LIMIT_MARKER in body:
|
||||
|
|
|
|||
|
|
@ -11,11 +11,6 @@ well-formed OCR document comes back. Per the e2e hard-fail contract, a case
|
|||
fails when no proxy answers and also fails once a request reaches it: the proxy
|
||||
fetches each provider's referenced secrets, so a
|
||||
missing credential surfaces as a live provider error rather than silent green.
|
||||
|
||||
The Mistral key is shared with the suites that run alongside this one and the
|
||||
deployment has no fallback group, so the OCR call tolerates a bounded number of
|
||||
provider 429s the proxy relays (tolerate_provider_rate_limit); a 429 the proxy
|
||||
issues itself still fails the case at once.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
|
|||
|
|
@ -377,13 +377,8 @@ class _AzureAnnotatedChatBody(BaseModel):
|
|||
|
||||
|
||||
def azure_prompt_filter_skipped(resp: StreamingResponse) -> bool:
|
||||
"""True when Azure answered without running its prompt content filter: the body
|
||||
carries ``prompt_filter_results`` whose ``content_filter_results`` are all empty,
|
||||
where a filter that ran records a verdict per category (jailbreak included).
|
||||
Azure does this intermittently and it says nothing about the prompt, so a test
|
||||
that needs the filter's verdict sends the prompt again instead of reading a
|
||||
skipped filter as a pass. A body without the field (an OpenAI completion served
|
||||
by a fallback, or an error body) is not a skipped filter."""
|
||||
"""True when Azure's 200 recorded no prompt-filter verdict (every `content_filter_results`
|
||||
empty), so the prompt has to be sent again."""
|
||||
try:
|
||||
annotated: Final = _AzureAnnotatedChatBody.model_validate_json(resp.body)
|
||||
except ValidationError:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""Unit tests for the reliability helpers that read provider bodies, driven with
|
||||
the verbatim shapes the proxy relays; nothing here needs a proxy or a provider."""
|
||||
"""Contract tests for the helpers that read provider bodies; no proxy or provider needed."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue