Repository navigation
refactor(anthropic): rename experimental_pass_through to pass_through - #43329
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
|
| ) | ||
| from .llms.cohere.chat.transformation import CohereChatConfig as CohereChatConfig | ||
| from .llms.anthropic.experimental_pass_through.messages.transformation import ( | ||
| from .llms.anthropic.pass_through.messages.transformation import ( |
There was a problem hiding this comment.
If an existing SDK integration imports AnthropicMessagesConfig from litellm.llms.anthropic.experimental_pass_through.messages.transformation, it now gets ModuleNotFoundError: the package was moved without keeping the old import path. This violates the repository directive to avoid backwards-incompatible changes without a user-controlled flag. Keep the former path working during migration.
Rule Used: What: avoid backwards-incompatible changes without user-controlled flags Why: This breaks current behaviour for users using existing functionality Example of BAD: this PR (#22164) introduced run_post_custom... (source)
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…path Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit aca4cca. Configure here.
Main renamed litellm/llms/anthropic/experimental_pass_through to pass_through (#43329), so the Gemini count builder and its oracle test import the adapter and the messages handler from the new path
TLDR
Problem this solves:
litellm/llms/anthropic/experimental_pass_throughis the production/v1/messagespath, not experimentalpass_throughnaming used elsewhereHow it solves it:
git mvthe package tolitellm/llms/anthropic/pass_through, same for itstests/unitmirrorPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/unit/llms/anthropic/pass_throughruns unchanged, 1044 passed)uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Proxy started DB-free from the branch tip with the repo dev config and a real
ANTHROPIC_API_KEY:After (ced64c3)
Native Anthropic path, POST /v1/messages
curl -s http://localhost:4010/v1/messages -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model": "anthropic-sonnet-5", "max_tokens": 50, "messages": [{"role":"user","content":"Say hi in three words"}]}'{"model":"anthropic-sonnet-5","id":"msg_011CfSXUPSbKPQsDUXrCJ5Ef","type":"message","role":"assistant","content":[...,{"type":"text","text":"Hi there, friend!"}],"stop_reason":"end_turn",...,"usage":{"input_tokens":13,...,"output_tokens":29,...}}OpenAI-compatible path, POST /v1/chat/completions
curl -s http://localhost:4010/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model": "anthropic-sonnet-5", "max_tokens": 50, "messages": [{"role":"user","content":"Say hi in three words"}]}'{"id":"chatcmpl-32053d6f-b2df-4f08-be18-65b67c49c1e1","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Hi there, friend!","role":"assistant",...}}],"usage":{"completion_tokens":10,"prompt_tokens":13,"total_tokens":23,...}}Renamed module resolves
uv run --no-sync python -c "import litellm.llms.anthropic.pass_through.messages.handler as h; print(h.__file__)"/home/ubuntu/repos/litellm/litellm/llms/anthropic/pass_through/messages/handler.pyNo Before section: the merge base serves the same responses from the old path, and this PR only moves files
Type
🧹 Refactoring
Caveats (if any)
Medium
litellm.llms.anthropic.experimental_pass_through.*breaks; no compat shim is addedLow
litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_throughis untouched on purposeexperimental_pass_through; they are names, not pathspass_through/architecture.mdis moved verbatim and is stale on the Responses API bridge, interceptors, MCP and websearch paths; tracked separatelyFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/45f1fdb83a7040cea2155b5022189c92
Open in Devin Desktop: https://app.devin.ai/desktop/session/45f1fdb83a7040cea2155b5022189c92?variant=devin
Requested by: @kerry-berri
Note
Low Risk
Mechanical rename with no logic changes; risk is limited to broken third-party imports of the old module path.
Overview
Renames the production Anthropic
/v1/messagesimplementation fromlitellm.llms.anthropic.experimental_pass_throughtolitellm.llms.anthropic.pass_through, aligning the package name with how the feature is used elsewhere.The change is a path-only refactor: imports, lazy-import registry entries, ruff dispatch rules, architecture docs, e2e coverage registry
sourcepaths, and unit tests are updated to the new module prefix. Runtime behavior is unchanged (symmetric ~413 line churn).Breaking: any external code importing
experimental_pass_throughmust switch topass_through; there is no compatibility shim. Vertex partner code undervertex_ai/.../experimental_pass_throughis intentionally left as-is.Reviewed by Cursor Bugbot for commit aca4cca. Bugbot is set up for automated code reviews on this repo. Configure here.