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]

refactor: strip PR-introduced docstrings and explanatory comments

Mateo Wangf9485f1bf6d9
diff --git a/tests/llm_translation/reasoning_effort_grid/conftest.py b/tests/llm_translation/reasoning_effort_grid/conftest.py
index aad85307cc6..4ea2cd1d9b9 100644
--- a/tests/llm_translation/reasoning_effort_grid/conftest.py
+++ b/tests/llm_translation/reasoning_effort_grid/conftest.py
@@ -1,12 +1,3 @@
-"""Shared fixtures for the reasoning_effort grid e2e suite.
-
-VCR wiring (Redis-backed cassette persister, auto-application of
-``@pytest.mark.vcr`` to every collected item, cassette-cache health summary)
-is inherited from ``tests/llm_translation/conftest.py``. This file only
-contributes the ``wire_capture`` fixture, which records the wire body
-LiteLLM sends upstream so each cell can inspect it.
-"""
-
from typing import Any, Dict, List, Optional
import pytest
@@ -16,14 +7,6 @@ from litellm.integrations.custom_logger import CustomLogger
class _WireBodyCapture(CustomLogger):
- """Pre-call hook that records the outgoing wire body LiteLLM sends upstream.
-
- ``complete_input_dict`` is the fully transformed provider request as set
- by every provider transformation in ``litellm/llms/**``. Capturing it here
- means a regression anywhere in the transformation chain (strip, rename,
- drop) surfaces as an assertion failure on the cell that depends on it.
- """
-
def __init__(self) -> None:
super().__init__()
self.records: List[Dict[str, Any]] = []
diff --git a/tests/llm_translation/reasoning_effort_grid/grid_spec.py b/tests/llm_translation/reasoning_effort_grid/grid_spec.py
index 58cff57f7c3..ed5346dad71 100644
--- a/tests/llm_translation/reasoning_effort_grid/grid_spec.py
+++ b/tests/llm_translation/reasoning_effort_grid/grid_spec.py
@@ -1,15 +1,3 @@
-"""
-Canonical post-fix expectations for the reasoning_effort grid sweep.
-
-The original QA sweep on
-https://github.com/BerriAI/litellm/pull/27039#issuecomment-4363363610
-covered 21 (provider x model) combos x 11 effort values (231 cells). The
-follow-up PR https://github.com/BerriAI/litellm/pull/27074 closed nine bugs
-surfaced by that sweep. This module encodes the post-fix expectations as a
-small rule set keyed by (model_mode, effort) and per-model capability
-overrides, then expands them across the model x effort matrix per route.
-"""
-
from dataclasses import dataclass, field
from typing import Dict, FrozenSet, List, Optional, Tuple
@@ -19,8 +7,6 @@ OMIT = object()
@dataclass(frozen=True)
class CellExpectation:
- """Expected post-fix behavior for a single grid cell."""
-
status: int
thinking_type: object
output_config_effort: object = OMIT
@@ -77,7 +63,6 @@ _BAD_REQUEST_EFFORTS: FrozenSet[str] = frozenset({"disabled", "invalid", ""})
def expected(model: ModelEntry, effort: str) -> CellExpectation:
- """Compute the post-fix expected cell for a (model, effort) pair."""
if effort in ("__omit__", "none"):
if model.mode == "budget":
return CellExpectation(status=200, thinking_type=OMIT, max_tokens=8192)
diff --git a/tests/llm_translation/reasoning_effort_grid/test_reasoning_effort_grid.py b/tests/llm_translation/reasoning_effort_grid/test_reasoning_effort_grid.py
index 4f2b6f09550..28e2e402d67 100644
--- a/tests/llm_translation/reasoning_effort_grid/test_reasoning_effort_grid.py
+++ b/tests/llm_translation/reasoning_effort_grid/test_reasoning_effort_grid.py
@@ -1,26 +1,3 @@
-"""
-End-to-end regression suite for reasoning_effort mapping across the
-Anthropic-backed routes covered by the original QA sweep.
-
-Encodes the 21 (provider x model) x 11 effort matrix (231 cells) from the
-QA sweep on https://github.com/BerriAI/litellm/pull/27039#issuecomment-4363363610
-that the fix in https://github.com/BerriAI/litellm/pull/27074 was validated
-against. Each cell asserts:
-
- - Wire body shape captured pre-call (thinking.type, output_config.effort,
- thinking.budget_tokens, max_tokens) -- the regression signal for silent
- drops/strips anywhere in the transformation chain.
- - Status code returned by LiteLLM (200 vs BadRequestError -> 400) -- the
- regression signal for clean-error vs leaked-500 mappings.
-
-Calls go to real provider endpoints, but the parent
-``tests/llm_translation/conftest.py`` auto-applies ``@pytest.mark.vcr`` to
-every collected item, so first run records cassettes (Redis-backed) and
-subsequent CI runs replay them with no live spend. Each route still skips at
-runtime when its required env vars are absent, so PR builds without provider
-credentials no-op gracefully.
-"""
-
import json
import os
from typing import Any, Dict, List, Optional, Tuple
@@ -73,7 +50,6 @@ def _build_completion_kwargs(model: ModelEntry, effort: str) -> Dict[str, Any]:
def _converse_subbody(body: Dict[str, Any]) -> Dict[str, Any]:
- """Return the dict that holds thinking/output_config for a Converse wire body."""
return body.get("additionalModelRequestFields", body)
@@ -92,7 +68,6 @@ def _assert_cell(
assert status == cell.status, f"expected status={cell.status}, got status={status}"
if cell.status != 200:
- # Bad-request paths short-circuit before the wire body matters.
return
assert body is not None, "wire body was not captured for a 200-status cell"
@@ -150,14 +125,6 @@ _PARAM_IDS: List[str] = [_cell_id(case) for case in _PARAMS]
def _classify_status(exc: Exception) -> int:
- """Map an exception to the HTTP status the QA grid would have observed.
-
- The Anthropic Messages route (litellm.anthropic_messages) wraps client-side
- BadRequestError as ``AnthropicError`` with ``status_code=400`` rather than
- re-raising the BadRequestError class directly, so isinstance() alone misses
- those cells. Read the ``status_code`` attribute when present (set by every
- BaseLLMException subclass) and fall through to 500 otherwise.
- """
if isinstance(exc, BadRequestError):
return 400
code = getattr(exc, "status_code", None)
@@ -208,9 +175,6 @@ async def test_reasoning_effort_grid(
record = wire_capture.latest()
body = record["body"] if record else None
- # Bedrock Converse logs `complete_input_dict` as a JSON string (see
- # litellm/llms/bedrock/chat/converse_handler.py); parse it so the dict
- # accessors in `_assert_cell` work uniformly across routes.
if route_name == "bedrock_converse" and isinstance(body, str):
body = json.loads(body)
@@ -225,7 +189,6 @@ async def test_reasoning_effort_grid(
def test_grid_cell_count() -> None:
- """Guard against accidental drops or duplicates in the grid spec."""
assert len(_PARAMS) == 21 * 11, (
f"expected 231 cells (21 provider x model combos x 11 efforts), "
f"got {len(_PARAMS)}"
@@ -233,7 +196,6 @@ def test_grid_cell_count() -> None:
def test_grid_route_coverage() -> None:
- """The grid must cover every route the original QA sweep covered."""
route_names = {route.name for route in ROUTES}
assert route_names == {
"anthropic_direct",
diff --git a/tests/llm_translation/test_gemini.py b/tests/llm_translation/test_gemini.py
index b6a9b763086..a02a1ffe60b 100644
--- a/tests/llm_translation/test_gemini.py
+++ b/tests/llm_translation/test_gemini.py
@@ -1629,11 +1629,6 @@ def test_gemini_image_size_limit_exceeded():
completion(model="gemini/gemini-2.5-flash-lite", messages=messages)
error_message = str(excinfo.value)
- # Wikimedia rate-limits CI runners (HTTP 429) for the Blue Marble image,
- # so the size-limit check never gets a chance to fire and we instead
- # capture the 429-wrapped ImageFetchError. Skip rather than fail when
- # the upstream host blocks us -- the intent here is to exercise the
- # size cap, not to test against Wikimedia availability.
if "Status code: 429" in error_message or "Too Many Requests" in error_message:
pytest.skip(f"Wikimedia rate-limited the test fixture image: {error_message}")
assert "Image size" in error_message
diff --git a/tests/test_litellm/interactions/test_openapi_compliance.py b/tests/test_litellm/interactions/test_openapi_compliance.py
index ce74bf150a1..a89e4c9dd55 100644
--- a/tests/test_litellm/interactions/test_openapi_compliance.py
+++ b/tests/test_litellm/interactions/test_openapi_compliance.py
@@ -157,11 +157,6 @@ class TestResponseCompliance:
# Check CreateModelInteractionParams which includes output fields
schema = spec_dict["components"]["schemas"]["CreateModelInteractionParams"]
- # Output fields (readOnly). Google's live spec has churned through
- # both `outputs` and `steps` for the per-turn output array and at the
- # moment carries neither -- only the stable response-level fields
- # below are guaranteed. Re-add the per-turn key once upstream
- # stabilizes on a name.
output_fields = [
"id",
"status",