Files
litellm/tests/test_litellm
mateo-berri e5d5e842e8 feat(translation): response and stream paths, async engine, and the flag-gated completion() seam
Phase 3 of the anthropic port (M3):

- ir.py gains the response IR (ChatResponse, ResponseUsage, finish reasons)
  and stream-event union; providers/anthropic parse_response/parse_stream
  reproduce v1 exactly for the v2-reachable surface (tool-name reverse
  mapping recomputed from the request, json_tool_call rewrite, usage cache
  folding, redacted thinking) and fail loudly on block types a v2-sent
  request cannot trigger
- inbound/openai_chat serialize_response/serialize_stream mirror v1's
  ModelResponse / CustomStreamWrapper shapes chunk-for-chunk (role on first
  chunk, tool-index counting, thinking provider fields, finish chunk)
- engine/: pipeline.py (prepare -> send split so the fallback decision
  happens before any I/O; async-first, sync is one asyncio.run wrapper at
  the seam), http.py (injected HttpPort + ExecuteError values), stream.py
  (the ONE accumulator: provider lines -> IR events -> chunk bodies)
- litellm/translation_seam.py (outside the package) adapts deps from litellm
  ambient state, ModelResponse/ModelResponseStream envelopes, and owns the
  completion() fork; litellm.translation_v2_providers allowlist global
  seeded from LITELLM_TRANSLATION_V2_PROVIDERS (off by default, yaml-
  configurable via the litellm_settings setattr fallback)
- main.py anthropic branch forks to the seam; streaming and modify_params
  traffic stay on v1 (documented follow-ups); once sent, provider errors
  raise the v1 exception contract, never a silent re-send
- differential gates: responses (4 full-cycle shapes incl. sanitized tool
  names and json_tool_call), streams (3 SSE replays vs the real
  CustomStreamWrapper), seam tests over respx (serve, fallback, 429
  contract, async path); DIFFERENTIAL_REPORT.md committed as the merge
  artifact: 53 rows, 0 divergent
2026-06-11 20:42:54 +00:00
..
2026-06-10 10:34:07 -07:00
2026-06-08 13:49:52 -07:00
2026-03-27 21:21:43 +05:30
2026-02-27 13:33:34 +05:30
2026-05-18 16:27:44 -07:00
2026-06-10 10:34:07 -07:00
2026-03-28 19:17:38 -07:00

Testing for litellm/

This directory 1:1 maps the the litellm/ directory, and can only contain mocked tests.

The point of this is to:

  1. Increase test coverage of litellm/
  2. Make it easy for contributors to add tests for the litellm/ package and easily run tests without needing LLM API keys.

File name conventions

  • litellm/proxy/test_caching_routes.py maps to litellm/proxy/caching_routes.py
  • test_<filename>.py maps to litellm/<filename>.py