From 69ad0040158a0d0074073b2bdadc2834ded12ee2 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 26 Sep 2026 13:00:50 -0700 Subject: [PATCH] refactor(anthropic): rename experimental_pass_through to pass_through (#43329) * refactor(anthropic): rename experimental_pass_through to pass_through Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(anthropic): point compact patch targets at renamed pass_through path Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: kerry Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- ARCHITECTURE.md | 2 +- litellm/__init__.py | 2 +- litellm/_lazy_imports_registry.py | 2 +- litellm/caching/caching_handler.py | 8 +- litellm/integrations/shadow_eval_logger.py | 2 +- .../websearch_interception/ARCHITECTURE.md | 2 +- .../chat/guardrail_translation/handler.py | 4 +- .../adapters/__init__.py | 0 .../adapters/handler.py | 16 +- .../adapters/streaming_iterator.py | 8 +- .../adapters/transformation.py | 8 +- .../architecture.md | 0 .../context_management/__init__.py | 0 .../context_management/constants.py | 0 .../context_management/dispatcher.py | 0 .../context_management/editors/__init__.py | 0 .../editors/clear_tool_uses.py | 0 .../context_management/editors/compact.py | 4 +- .../context_management/errors.py | 0 .../context_management/placeholders.py | 0 .../context_management/result.py | 0 .../messages/agentic_streaming_iterator.py | 4 +- .../messages/fake_stream_iterator.py | 0 .../messages/handler.py | 4 +- .../messages/interceptors/README.md | 0 .../messages/interceptors/__init__.py | 0 .../messages/interceptors/advisor.py | 2 +- .../messages/interceptors/base.py | 0 .../messages/mcp_handler.py | 2 +- .../messages/mid_conversation_system.py | 0 .../messages/response_cache.py | 2 +- .../messages/streaming_iterator.py | 2 +- .../messages/transformation.py | 2 +- .../messages/utils.py | 0 .../responses_adapters/__init__.py | 0 .../responses_adapters/handler.py | 2 +- .../responses_adapters/streaming_iterator.py | 2 +- .../responses_adapters/transformation.py | 6 +- .../utils.py | 0 .../llms/anthropic/prompt_cache_prediction.py | 2 +- .../anthropic/messages_transformation.py | 2 +- .../bedrock/chat/converse_transformation.py | 2 +- .../messages_transformation.py | 2 +- .../anthropic_claude3_transformation.py | 4 +- .../bedrock/messages/mantle_transformation.py | 2 +- litellm/llms/custom_httpx/llm_http_handler.py | 8 +- .../llms/deepseek/messages/transformation.py | 2 +- .../github_copilot/messages/transformation.py | 2 +- .../llms/minimax/messages/transformation.py | 2 +- .../openai_like/messages/transformation.py | 2 +- .../llms/tencent/messages/transformation.py | 2 +- .../transformation.py | 2 +- litellm/messages/dispatch.py | 2 +- .../proxy/anthropic_endpoints/endpoints.py | 2 +- litellm/proxy/guardrails/anthropic_sse.py | 4 +- .../guardrail_hooks/straiker/straiker.py | 2 +- .../streaming_handler.py | 2 +- litellm/router.py | 20 +- .../rust_bridge/callbacks_legacy_python.py | 2 +- litellm/rust_bridge/messages/route_host.py | 4 +- ruff-strict.toml | 4 +- .../coverage_registry/quota_management.yaml | 4 +- .../base_anthropic_unified_messages_test.py | 2 +- .../test_anthropic_messages_passthrough.py | 2 +- .../test_context_management_polyfill.py | 2 +- .../test_websearch_interception_e2e.py | 2 +- .../guardrail_hooks/test_headroom.py | 2 +- .../test_spend_tracking_utils.py | 2 +- .../proxy/test_budget_reservation.py | 4 +- .../proxy_logging/test_streaming_hooks.py | 2 +- .../test_websearch_agentic_loop_cap.py | 2 +- .../test_websearch_short_circuit.py | 16 +- .../test_websearch_streaming_wrap.py | 2 +- .../test_anthropic_chat_transformation.py | 4 +- .../messages/test_advisor_orchestration.py | 136 ++++++------ .../__init__.py | 0 .../adapters/__init__.py | 0 ...al_pass_through_adapters_transformation.py | 12 +- .../test_handler_output_config_passthrough.py | 2 +- .../adapters/test_handler_prompt_cache_key.py | 2 +- ..._handler_reasoning_effort_normalization.py | 2 +- .../test_streaming_iterator_combined_chunk.py | 2 +- .../test_streaming_iterator_compaction.py | 2 +- .../test_streaming_iterator_empty_choices.py | 2 +- .../test_streaming_iterator_first_delta.py | 2 +- .../test_streaming_iterator_message_id.py | 4 +- ...est_streaming_iterator_mid_stream_error.py | 2 +- .../test_streaming_iterator_stop_reason.py | 2 +- .../test_streaming_iterator_tool_args.py | 2 +- .../context_management/__init__.py | 0 .../test_clear_tool_uses.py | 4 +- .../context_management/test_compact.py | 202 +++++++++--------- .../context_management/test_dispatcher.py | 2 +- .../messages/__init__.py | 0 .../messages/test_advisor_integration.py | 24 +-- .../test_agentic_streaming_iterator.py | 2 +- ...erimental_pass_through_messages_handler.py | 84 ++++---- .../test_anthropic_messages_effort.py | 2 +- ..._anthropic_messages_encrypted_reasoning.py | 2 +- ...est_anthropic_messages_per_turn_control.py | 2 +- .../messages/test_anthropic_messages_speed.py | 4 +- ...t_anthropic_messages_structured_outputs.py | 2 +- .../test_content_after_stop_reason.py | 2 +- .../messages/test_mcp_handler.py | 16 +- .../messages/test_mid_conversation_system.py | 2 +- .../messages/test_parallel_tool_calls.py | 2 +- .../test_reasoning_auto_summary_messages.py | 6 +- .../test_reasoning_effort_translation.py | 2 +- .../test_request_optional_param_utils.py | 2 +- .../messages/test_response_cache.py | 6 +- .../messages/test_sse_wrapper.py | 2 +- .../messages/test_streaming_iterator.py | 8 +- .../responses_adapters/__init__.py | 0 .../test_responses_adapters_handler.py | 2 +- ...t_responses_adapters_streaming_iterator.py | 6 +- .../test_responses_adapters_transformation.py | 6 +- .../test_reasoning_effort_fields.py | 10 +- .../anthropic/test_anthropic_common_utils.py | 16 +- .../test_anthropic_prompt_cache_prediction.py | 2 +- .../test_anthropic_claude3_transformation.py | 2 +- .../custom_httpx/test_llm_http_handler.py | 12 +- ...pseek_anthropic_messages_transformation.py | 2 +- ..._github_copilot_messages_transformation.py | 2 +- ..._like_anthropic_messages_transformation.py | 2 +- ...ncent_anthropic_messages_transformation.py | 2 +- ...test_vertex_and_google_ai_studio_gemini.py | 6 +- tests/unit/messages/test_dispatch.py | 2 +- .../unit/rust_bridge/messages/test_secrets.py | 2 +- tests/unit/test_router/test_router.py | 2 +- 129 files changed, 417 insertions(+), 417 deletions(-) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/adapters/__init__.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/adapters/handler.py (98%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/adapters/streaming_iterator.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/adapters/transformation.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/architecture.md (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/__init__.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/constants.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/dispatcher.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/editors/__init__.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/editors/clear_tool_uses.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/editors/compact.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/errors.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/placeholders.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/context_management/result.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/agentic_streaming_iterator.py (98%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/fake_stream_iterator.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/handler.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/interceptors/README.md (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/interceptors/__init__.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/interceptors/advisor.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/interceptors/base.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/mcp_handler.py (98%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/mid_conversation_system.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/response_cache.py (98%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/streaming_iterator.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/transformation.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/messages/utils.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/__init__.py (100%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/handler.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/streaming_iterator.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/transformation.py (99%) rename litellm/llms/anthropic/{experimental_pass_through => pass_through}/utils.py (100%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/__init__.py (100%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/__init__.py (100%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_handler_output_config_passthrough.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_handler_prompt_cache_key.py (97%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_handler_reasoning_effort_normalization.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_combined_chunk.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_compaction.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_empty_choices.py (97%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_first_delta.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_message_id.py (95%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_mid_stream_error.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_stop_reason.py (96%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/adapters/test_streaming_iterator_tool_args.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/context_management/__init__.py (100%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/context_management/test_clear_tool_uses.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/context_management/test_compact.py (89%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/context_management/test_dispatcher.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/__init__.py (100%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_advisor_integration.py (91%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_agentic_streaming_iterator.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_anthropic_experimental_pass_through_messages_handler.py (94%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_anthropic_messages_effort.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_anthropic_messages_encrypted_reasoning.py (95%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_anthropic_messages_per_turn_control.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_anthropic_messages_speed.py (96%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_anthropic_messages_structured_outputs.py (97%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_content_after_stop_reason.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_mcp_handler.py (93%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_mid_conversation_system.py (96%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_parallel_tool_calls.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_reasoning_auto_summary_messages.py (96%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_reasoning_effort_translation.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_request_optional_param_utils.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_response_cache.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_sse_wrapper.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/messages/test_streaming_iterator.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/__init__.py (100%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/test_responses_adapters_handler.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/test_responses_adapters_streaming_iterator.py (98%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/responses_adapters/test_responses_adapters_transformation.py (99%) rename tests/unit/llms/anthropic/{experimental_pass_through => pass_through}/test_reasoning_effort_fields.py (96%) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index c9e046748e8..8e88c0ea15b 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -336,7 +336,7 @@ Each translation is isolated in its own file, making it easy to test and modify | `/v1/chat/completions` | Gemini | `llms/gemini/chat/transformation.py` | | `/v1/chat/completions` | Vertex AI | `llms/vertex_ai/gemini/transformation.py` | | `/v1/chat/completions` | OpenAI | `llms/openai/chat/gpt_transformation.py` | -| `/v1/messages` (passthrough) | Anthropic | `llms/anthropic/experimental_pass_through/messages/transformation.py` | +| `/v1/messages` (passthrough) | Anthropic | `llms/anthropic/pass_through/messages/transformation.py` | | `/v1/messages` (passthrough) | Bedrock | `llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py` | | `/v1/messages` (passthrough) | Vertex AI | `llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py` | | Passthrough endpoints | All | `proxy/pass_through_endpoints/llm_provider_handlers/` | diff --git a/litellm/__init__.py b/litellm/__init__.py index 676c735b9e8..5a7d6e8125d 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -1691,7 +1691,7 @@ if TYPE_CHECKING: SagemakerNovaConfig as SagemakerNovaConfig, ) 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 ( AnthropicMessagesConfig as AnthropicMessagesConfig, ) from .llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation import ( diff --git a/litellm/_lazy_imports_registry.py b/litellm/_lazy_imports_registry.py index 42513321391..aef3cbd9414 100644 --- a/litellm/_lazy_imports_registry.py +++ b/litellm/_lazy_imports_registry.py @@ -742,7 +742,7 @@ _LLM_CONFIGS_IMPORT_MAP: Final = { ), "CohereChatConfig": (".llms.cohere.chat.transformation", "CohereChatConfig"), "AnthropicMessagesConfig": ( - ".llms.anthropic.experimental_pass_through.messages.transformation", + ".llms.anthropic.pass_through.messages.transformation", "AnthropicMessagesConfig", ), "BedrockClaudePlatformMessagesConfig": ( diff --git a/litellm/caching/caching_handler.py b/litellm/caching/caching_handler.py index cfc9edd7158..0e4f444224b 100644 --- a/litellm/caching/caching_handler.py +++ b/litellm/caching/caching_handler.py @@ -52,7 +52,7 @@ from litellm.types.utils import ( if TYPE_CHECKING: from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj - from litellm.llms.anthropic.experimental_pass_through.messages.response_cache import ( + from litellm.llms.anthropic.pass_through.messages.response_cache import ( AnthropicMessagesStreamCacheWriter, ) from litellm.types.utils import PromptTokensDetailsWrapper @@ -127,7 +127,7 @@ def _should_defer_streaming_cache_hit_callbacks(*, cached_result: object) -> boo spend and callback records. A plain (non-stream) replay logs here, since nothing else will. """ - from litellm.llms.anthropic.experimental_pass_through.messages.response_cache import ( + from litellm.llms.anthropic.pass_through.messages.response_cache import ( CachedAnthropicMessagesStreamIterator, ) from litellm.responses.streaming_iterator import BaseResponsesAPIStreamingIterator @@ -930,7 +930,7 @@ class LLMCachingHandler: elif ( call_type == CallTypes.anthropic_messages.value or call_type == CallTypes.aanthropic_messages.value ) and isinstance(cached_result, dict): - from litellm.llms.anthropic.experimental_pass_through.messages.response_cache import ( + from litellm.llms.anthropic.pass_through.messages.response_cache import ( convert_cached_anthropic_messages_result, ) @@ -1150,7 +1150,7 @@ class LLMCachingHandler: return result if not isinstance(result, AsyncIterator): return result - from litellm.llms.anthropic.experimental_pass_through.messages.response_cache import ( + from litellm.llms.anthropic.pass_through.messages.response_cache import ( AnthropicMessagesStreamCacheWriter, ) diff --git a/litellm/integrations/shadow_eval_logger.py b/litellm/integrations/shadow_eval_logger.py index 19d9bee7493..4ff49f3cb84 100644 --- a/litellm/integrations/shadow_eval_logger.py +++ b/litellm/integrations/shadow_eval_logger.py @@ -111,7 +111,7 @@ def _chat_request_from_anthropic_messages( because the logged optional_params switch dialect per provider path (the bridge's inner completion rewrites them to chat shape mid-flight); the adapter translates them alongside the messages, and sampling params copy through untranslated.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) diff --git a/litellm/integrations/websearch_interception/ARCHITECTURE.md b/litellm/integrations/websearch_interception/ARCHITECTURE.md index 4ea7a7ae527..255c1f1adb2 100644 --- a/litellm/integrations/websearch_interception/ARCHITECTURE.md +++ b/litellm/integrations/websearch_interception/ARCHITECTURE.md @@ -70,7 +70,7 @@ Claude Code (Anthropic's official CLI) sends web search requests using Anthropic Native tools are converted to LiteLLM standard format **before** sending to the provider: -1. **Conversion Point** (`litellm/llms/anthropic/experimental_pass_through/messages/handler.py`): +1. **Conversion Point** (`litellm/llms/anthropic/pass_through/messages/handler.py`): - In `anthropic_messages()` function (lines 60-127) - Runs BEFORE the API request is made - Detects native web search tools using `is_web_search_tool()` diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.py index e1c727ad235..15380f57d17 100644 --- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py +++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py @@ -25,7 +25,7 @@ from typing_extensions import ReadOnly, TypedDict, assert_never from litellm._logging import verbose_proxy_logger from litellm.llms.anthropic.chat.transformation import AnthropicConfig -from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( +from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, is_provider_native_tool_dict, ) @@ -365,7 +365,7 @@ class AnthropicMessagesHandler(BaseTranslation): def _standalone_block_chunks(self, exc: "ModifyResponseException") -> list[bytes]: import uuid - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) from litellm.llms.base_llm.guardrail_translation.utils import ( diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/__init__.py b/litellm/llms/anthropic/pass_through/adapters/__init__.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/adapters/__init__.py rename to litellm/llms/anthropic/pass_through/adapters/__init__.py diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py b/litellm/llms/anthropic/pass_through/adapters/handler.py similarity index 98% rename from litellm/llms/anthropic/experimental_pass_through/adapters/handler.py rename to litellm/llms/anthropic/pass_through/adapters/handler.py index 116f96cf00c..5bda3437a40 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py +++ b/litellm/llms/anthropic/pass_through/adapters/handler.py @@ -11,15 +11,15 @@ from typing_extensions import TypedDict import litellm from litellm._logging import verbose_logger from litellm.litellm_core_utils.asyncify import run_async_function -from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( +from litellm.llms.anthropic.pass_through.adapters.transformation import ( AnthropicAdapter, ) -from litellm.llms.anthropic.experimental_pass_through.context_management import ( +from litellm.llms.anthropic.pass_through.context_management import ( AnthropicContextManagementError, PolyfillResult, apply_context_management, ) -from litellm.llms.anthropic.experimental_pass_through.utils import ( +from litellm.llms.anthropic.pass_through.utils import ( is_reasoning_auto_summary_enabled, litellm_logging_obj_from_kwargs, local_model_name, @@ -102,7 +102,7 @@ async def _prepare_context_managed_request( user_api_key_auth: "UserAPIKeyAuth | None" = None, ) -> PolyfillResult | None: """Apply client compaction history, then optional context_management polyfill.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( apply_client_compaction_block_history, ) @@ -179,7 +179,7 @@ def _polyfill_will_run( if edits is None: return False - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_EDIT_TYPE, ) @@ -205,7 +205,7 @@ def _spec_has_non_compact_edits( if edits is None: return False - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_EDIT_TYPE, ) @@ -240,7 +240,7 @@ def _normalize_spec_edits( if _context_management_explicitly_dropped(additional_drop_params): return None - from litellm.llms.anthropic.experimental_pass_through.context_management.dispatcher import ( + from litellm.llms.anthropic.pass_through.context_management.dispatcher import ( _normalize_spec, ) @@ -437,7 +437,7 @@ class LiteLLMMessagesToCompletionTransformationHandler: Handles both string ("max") and dict ({"effort": "max", "summary": ...}) formats. Uses model registry to check supports_xhigh/supports_minimal. """ - from litellm.llms.anthropic.experimental_pass_through.utils import ( + from litellm.llms.anthropic.pass_through.utils import ( normalize_reasoning_effort_value, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/pass_through/adapters/streaming_iterator.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py rename to litellm/llms/anthropic/pass_through/adapters/streaming_iterator.py index 24d5b7f366e..12eee663ca5 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/pass_through/adapters/streaming_iterator.py @@ -118,7 +118,7 @@ class _CombinedChunkSplitter: @staticmethod def _is_combined(chunk: "ModelResponseStream") -> bool: """True if ``chunk`` carries response content AND a finish_reason.""" - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( openai_chat_refusal_text, ) @@ -1029,7 +1029,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): delta: Final = processed_chunk["delta"] if delta.get("stop_reason") == "max_tokens": return processed_chunk - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( refusal_stop_details, ) @@ -1083,7 +1083,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): @staticmethod def _is_blank_delta(chunk: "ModelResponseStream") -> bool: from litellm.llms.anthropic.common_utils import is_empty_unsigned_thinking_block - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( openai_chat_refusal_text, ) @@ -1120,7 +1120,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): - Different content types in the response - Specific markers in the content """ - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( openai_chat_refusal_text, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/pass_through/adapters/transformation.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py rename to litellm/llms/anthropic/pass_through/adapters/transformation.py index 85431a5a637..2bb081bd0a4 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/pass_through/adapters/transformation.py @@ -8,7 +8,7 @@ from typing import TYPE_CHECKING, Any, Final, Literal, TypeAlias, TypeVar, cast from pydantic import JsonValue, TypeAdapter import litellm -from litellm.llms.anthropic.experimental_pass_through.utils import ( +from litellm.llms.anthropic.pass_through.utils import ( is_reasoning_auto_summary_enabled, prompt_cache_key_from_user_id, ) @@ -134,14 +134,14 @@ from litellm.llms.anthropic.common_utils import ( normalize_anthropic_tool_use_id, strip_encrypted_reasoning_blocks_from_anthropic_messages, ) -from litellm.llms.anthropic.experimental_pass_through.context_management import ( +from litellm.llms.anthropic.pass_through.context_management import ( PolyfillResult, ) -from litellm.llms.anthropic.experimental_pass_through.messages.mid_conversation_system import ( +from litellm.llms.anthropic.pass_through.messages.mid_conversation_system import ( convert_mid_conversation_system_turns, is_system_role_message, ) -from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( +from litellm.llms.anthropic.pass_through.messages.utils import ( openai_chat_refusal_text, refusal_stop_details, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/architecture.md b/litellm/llms/anthropic/pass_through/architecture.md similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/architecture.md rename to litellm/llms/anthropic/pass_through/architecture.md diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/__init__.py b/litellm/llms/anthropic/pass_through/context_management/__init__.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/__init__.py rename to litellm/llms/anthropic/pass_through/context_management/__init__.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/constants.py b/litellm/llms/anthropic/pass_through/context_management/constants.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/constants.py rename to litellm/llms/anthropic/pass_through/context_management/constants.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/dispatcher.py b/litellm/llms/anthropic/pass_through/context_management/dispatcher.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/dispatcher.py rename to litellm/llms/anthropic/pass_through/context_management/dispatcher.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/__init__.py b/litellm/llms/anthropic/pass_through/context_management/editors/__init__.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/editors/__init__.py rename to litellm/llms/anthropic/pass_through/context_management/editors/__init__.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/clear_tool_uses.py b/litellm/llms/anthropic/pass_through/context_management/editors/clear_tool_uses.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/editors/clear_tool_uses.py rename to litellm/llms/anthropic/pass_through/context_management/editors/clear_tool_uses.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py b/litellm/llms/anthropic/pass_through/context_management/editors/compact.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py rename to litellm/llms/anthropic/pass_through/context_management/editors/compact.py index ef9d209a867..62826865894 100644 --- a/litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py +++ b/litellm/llms/anthropic/pass_through/context_management/editors/compact.py @@ -798,7 +798,7 @@ def _count_effective_tokens( threshold check matches the downstream ``input_tokens`` metric. """ # Local import to avoid pulling the adapter at module load time. - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -955,7 +955,7 @@ def _build_summary_messages( system prompt); the conversation history is translated to OpenAI shape; the summarization prompt is appended as a final user turn. """ - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/errors.py b/litellm/llms/anthropic/pass_through/context_management/errors.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/errors.py rename to litellm/llms/anthropic/pass_through/context_management/errors.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/placeholders.py b/litellm/llms/anthropic/pass_through/context_management/placeholders.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/placeholders.py rename to litellm/llms/anthropic/pass_through/context_management/placeholders.py diff --git a/litellm/llms/anthropic/experimental_pass_through/context_management/result.py b/litellm/llms/anthropic/pass_through/context_management/result.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/context_management/result.py rename to litellm/llms/anthropic/pass_through/context_management/result.py diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/agentic_streaming_iterator.py b/litellm/llms/anthropic/pass_through/messages/agentic_streaming_iterator.py similarity index 98% rename from litellm/llms/anthropic/experimental_pass_through/messages/agentic_streaming_iterator.py rename to litellm/llms/anthropic/pass_through/messages/agentic_streaming_iterator.py index 306041d9949..922a6e21bae 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/agentic_streaming_iterator.py +++ b/litellm/llms/anthropic/pass_through/messages/agentic_streaming_iterator.py @@ -336,7 +336,7 @@ class AgenticAnthropicStreamingIterator: await task async def aclose(self) -> None: - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( aclose_if_supported, ) @@ -379,7 +379,7 @@ class AgenticAnthropicStreamingIterator: if hasattr(result, "__aiter__"): self._follow_up_iterator = result.__aiter__() elif isinstance(result, dict): - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) from litellm.types.llms.anthropic_messages.anthropic_response import ( diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/fake_stream_iterator.py b/litellm/llms/anthropic/pass_through/messages/fake_stream_iterator.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/messages/fake_stream_iterator.py rename to litellm/llms/anthropic/pass_through/messages/fake_stream_iterator.py diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py b/litellm/llms/anthropic/pass_through/messages/handler.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/messages/handler.py rename to litellm/llms/anthropic/pass_through/messages/handler.py index ac4240690c1..3068a7eb3ab 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py +++ b/litellm/llms/anthropic/pass_through/messages/handler.py @@ -215,7 +215,7 @@ async def _try_websearch_short_circuit( if response is not None: anthropic_response = cast(AnthropicMessagesResponse, response) if stream: - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) @@ -531,7 +531,7 @@ def anthropic_messages_handler( # reference the provider cannot resolve. Popped from kwargs so it never reaches the provider. skip_mcp_handler: Final = kwargs.pop("_skip_mcp_handler", False) if not skip_mcp_handler and tools: - from litellm.llms.anthropic.experimental_pass_through.messages.mcp_handler import ( + from litellm.llms.anthropic.pass_through.messages.mcp_handler import ( anthropic_messages_with_mcp, ) from litellm.responses.mcp.litellm_proxy_mcp_handler import ( diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/interceptors/README.md b/litellm/llms/anthropic/pass_through/messages/interceptors/README.md similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/messages/interceptors/README.md rename to litellm/llms/anthropic/pass_through/messages/interceptors/README.md diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/interceptors/__init__.py b/litellm/llms/anthropic/pass_through/messages/interceptors/__init__.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/messages/interceptors/__init__.py rename to litellm/llms/anthropic/pass_through/messages/interceptors/__init__.py diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py b/litellm/llms/anthropic/pass_through/messages/interceptors/advisor.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py rename to litellm/llms/anthropic/pass_through/messages/interceptors/advisor.py index 090cd6b0971..0f833ccb4b8 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py +++ b/litellm/llms/anthropic/pass_through/messages/interceptors/advisor.py @@ -67,7 +67,7 @@ class AdvisorOrchestrationHandler(MessagesInterceptor): custom_llm_provider: str | None, **kwargs, ) -> AnthropicMessagesResponse | AsyncIterator: - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/interceptors/base.py b/litellm/llms/anthropic/pass_through/messages/interceptors/base.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/messages/interceptors/base.py rename to litellm/llms/anthropic/pass_through/messages/interceptors/base.py diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/mcp_handler.py b/litellm/llms/anthropic/pass_through/messages/mcp_handler.py similarity index 98% rename from litellm/llms/anthropic/experimental_pass_through/messages/mcp_handler.py rename to litellm/llms/anthropic/pass_through/messages/mcp_handler.py index a0585dfb369..ab722a60ca5 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/mcp_handler.py +++ b/litellm/llms/anthropic/pass_through/messages/mcp_handler.py @@ -180,7 +180,7 @@ async def anthropic_messages_with_mcp( ) if stream: - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/mid_conversation_system.py b/litellm/llms/anthropic/pass_through/messages/mid_conversation_system.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/messages/mid_conversation_system.py rename to litellm/llms/anthropic/pass_through/messages/mid_conversation_system.py diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/response_cache.py b/litellm/llms/anthropic/pass_through/messages/response_cache.py similarity index 98% rename from litellm/llms/anthropic/experimental_pass_through/messages/response_cache.py rename to litellm/llms/anthropic/pass_through/messages/response_cache.py index b60458f8401..1a8b041e674 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/response_cache.py +++ b/litellm/llms/anthropic/pass_through/messages/response_cache.py @@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Final import litellm from litellm._logging import verbose_logger from litellm.caching.caching_handler import create_cache_write_task -from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( AnthropicMessagesStreamingResponse, BaseAnthropicMessagesStreamingIterator, _is_message_stop_chunk, diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/streaming_iterator.py b/litellm/llms/anthropic/pass_through/messages/streaming_iterator.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/messages/streaming_iterator.py rename to litellm/llms/anthropic/pass_through/messages/streaming_iterator.py index 5550590d0c0..81d51cc40d5 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/streaming_iterator.py +++ b/litellm/llms/anthropic/pass_through/messages/streaming_iterator.py @@ -16,7 +16,7 @@ from litellm.litellm_core_utils.core_helpers import process_response_headers from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKER from litellm.llms.anthropic.common_utils import ANTHROPIC_ERROR_STATUS_CODE_MAP -from litellm.llms.anthropic.experimental_pass_through.messages.utils import INCOMPLETE_STREAM_ERROR_MESSAGE +from litellm.llms.anthropic.pass_through.messages.utils import INCOMPLETE_STREAM_ERROR_MESSAGE from litellm.proxy.pass_through_endpoints.success_handler import ( PassThroughEndpointLogging, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/pass_through/messages/transformation.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/messages/transformation.py rename to litellm/llms/anthropic/pass_through/messages/transformation.py index a83e23d83d5..1f604cfb8d7 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py +++ b/litellm/llms/anthropic/pass_through/messages/transformation.py @@ -590,7 +590,7 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): litellm_logging_obj: LiteLLMLoggingObj, ) -> AsyncIterator: """Helper function to handle Anthropic streaming responses using the existing logging handlers""" - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( BaseAnthropicMessagesStreamingIterator, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/utils.py b/litellm/llms/anthropic/pass_through/messages/utils.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/messages/utils.py rename to litellm/llms/anthropic/pass_through/messages/utils.py diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/__init__.py b/litellm/llms/anthropic/pass_through/responses_adapters/__init__.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/responses_adapters/__init__.py rename to litellm/llms/anthropic/pass_through/responses_adapters/__init__.py diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py b/litellm/llms/anthropic/pass_through/responses_adapters/handler.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py rename to litellm/llms/anthropic/pass_through/responses_adapters/handler.py index 7731c883d9f..627a027b72e 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py +++ b/litellm/llms/anthropic/pass_through/responses_adapters/handler.py @@ -109,7 +109,7 @@ def _build_responses_kwargs( if isinstance(reasoning, dict): effort: Final[object] = reasoning.get("effort") if isinstance(effort, str): - from litellm.llms.anthropic.experimental_pass_through.utils import ( + from litellm.llms.anthropic.pass_through.utils import ( normalize_reasoning_effort_value, ) diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py b/litellm/llms/anthropic/pass_through/responses_adapters/streaming_iterator.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py rename to litellm/llms/anthropic/pass_through/responses_adapters/streaming_iterator.py index 59ccde872fc..db70f855223 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/pass_through/responses_adapters/streaming_iterator.py @@ -15,7 +15,7 @@ from litellm.exceptions import MidStreamFallbackError from litellm.litellm_core_utils.prompt_templates.common_utils import ( encrypted_reasoning_signature, ) -from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( +from litellm.llms.anthropic.pass_through.messages.utils import ( INCOMPLETE_STREAM_ERROR_MESSAGE, refusal_stop_details, responses_output_refusal_text, diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py b/litellm/llms/anthropic/pass_through/responses_adapters/transformation.py similarity index 99% rename from litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py rename to litellm/llms/anthropic/pass_through/responses_adapters/transformation.py index 6a31173a9c6..26f82d66bfc 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py +++ b/litellm/llms/anthropic/pass_through/responses_adapters/transformation.py @@ -20,11 +20,11 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import ( from litellm.litellm_core_utils.reasoning_effort_utils import ( reasoning_effort_from_thinking_budget, ) -from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( +from litellm.llms.anthropic.pass_through.messages.utils import ( refusal_stop_details, responses_output_refusal_text, ) -from litellm.llms.anthropic.experimental_pass_through.utils import ( +from litellm.llms.anthropic.pass_through.utils import ( is_reasoning_auto_summary_enabled, prompt_cache_key_from_user_id, ) @@ -69,7 +69,7 @@ class LiteLLMAnthropicToResponsesAPIAdapter: if raw_usage is None: return AnthropicUsage(input_tokens=0, output_tokens=0) - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) from litellm.responses.utils import ResponseAPILoggingUtils diff --git a/litellm/llms/anthropic/experimental_pass_through/utils.py b/litellm/llms/anthropic/pass_through/utils.py similarity index 100% rename from litellm/llms/anthropic/experimental_pass_through/utils.py rename to litellm/llms/anthropic/pass_through/utils.py diff --git a/litellm/llms/anthropic/prompt_cache_prediction.py b/litellm/llms/anthropic/prompt_cache_prediction.py index 447cefb1c45..ca0bebf124a 100644 --- a/litellm/llms/anthropic/prompt_cache_prediction.py +++ b/litellm/llms/anthropic/prompt_cache_prediction.py @@ -16,7 +16,7 @@ import litellm from litellm.llms.anthropic.common_utils import AnthropicModelInfo, is_anthropic_oauth_key from litellm.llms.anthropic.count_tokens.handler import AnthropicCountTokensHandler from litellm.llms.anthropic.count_tokens.transformation import COUNT_TOKEN_OPTION_NAMES -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( DEFAULT_ANTHROPIC_API_VERSION, AnthropicMessagesConfig, ) diff --git a/litellm/llms/azure_ai/anthropic/messages_transformation.py b/litellm/llms/azure_ai/anthropic/messages_transformation.py index 36164106a5a..3d8b574e8c0 100644 --- a/litellm/llms/azure_ai/anthropic/messages_transformation.py +++ b/litellm/llms/azure_ai/anthropic/messages_transformation.py @@ -4,7 +4,7 @@ Azure Anthropic messages transformation config - extends AnthropicMessagesConfig from typing import Any, Final -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.azure.common_utils import BaseAzureLLM diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py index 2a2f3052b2a..30ea85db4d4 100644 --- a/litellm/llms/bedrock/chat/converse_transformation.py +++ b/litellm/llms/bedrock/chat/converse_transformation.py @@ -1831,7 +1831,7 @@ class AmazonConverseConfig(BaseConfig): anthropic_beta_list: list, ) -> None: """Keep only compact_20260112 edits for Bedrock; add beta header or drop field.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_EDIT_TYPE, ) from litellm.types.llms.anthropic import ANTHROPIC_BETA_HEADER_VALUES diff --git a/litellm/llms/bedrock/claude_platform/messages_transformation.py b/litellm/llms/bedrock/claude_platform/messages_transformation.py index f423d22589b..1469f6a6935 100644 --- a/litellm/llms/bedrock/claude_platform/messages_transformation.py +++ b/litellm/llms/bedrock/claude_platform/messages_transformation.py @@ -1,7 +1,7 @@ from typing import Any, Final import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( DEFAULT_ANTHROPIC_API_VERSION, AnthropicMessagesConfig, ) diff --git a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py index cefc8afed25..94eb0c92e40 100644 --- a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py +++ b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py @@ -18,7 +18,7 @@ from litellm.llms.anthropic.chat.transformation import ( AnthropicConfig, ) from litellm.llms.anthropic.common_utils import AnthropicModelInfo -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.base_llm.anthropic_messages.transformation import ( @@ -798,7 +798,7 @@ class AmazonAnthropicClaudeMessagesConfig( merge them from ``message_start`` so logging/cost sees a consistent usage object (fixes negative input costs: LIT-2411). """ - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( BaseAnthropicMessagesStreamingIterator, ) diff --git a/litellm/llms/bedrock/messages/mantle_transformation.py b/litellm/llms/bedrock/messages/mantle_transformation.py index 66744275778..62956dd4582 100644 --- a/litellm/llms/bedrock/messages/mantle_transformation.py +++ b/litellm/llms/bedrock/messages/mantle_transformation.py @@ -14,7 +14,7 @@ from typing import TYPE_CHECKING, Any, Final import httpx from pydantic import TypeAdapter -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( DEFAULT_ANTHROPIC_API_VERSION, AnthropicMessagesConfig, ) diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index 2f97e306437..0cb1416db3f 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -204,7 +204,7 @@ if TYPE_CHECKING: from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj from litellm.litellm_core_utils.tokenizer import Encoding as Tokenizer - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) from litellm.llms.base_llm.passthrough.transformation import BasePassthroughConfig @@ -2124,7 +2124,7 @@ class BaseLLMHTTPHandler: initial_response: AsyncIterator | AnthropicMessagesResponse if stream: - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( AnthropicMessagesStreamingResponse, anthropic_messages_stream_hidden_params, ) @@ -2148,7 +2148,7 @@ class BaseLLMHTTPHandler: hidden_params=stream_hidden_params, ) - from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( AgenticAnthropicStreamingIterator, ) @@ -5540,7 +5540,7 @@ class BaseLLMHTTPHandler: from typing import cast from litellm._logging import verbose_logger - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) from litellm.types.llms.anthropic_messages.anthropic_response import ( diff --git a/litellm/llms/deepseek/messages/transformation.py b/litellm/llms/deepseek/messages/transformation.py index 8dd720c464a..85b9ac66b5f 100644 --- a/litellm/llms/deepseek/messages/transformation.py +++ b/litellm/llms/deepseek/messages/transformation.py @@ -5,7 +5,7 @@ DeepSeek Anthropic-compatible messages transformation config. from typing import Any, Final import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.secret_managers.main import get_secret_str diff --git a/litellm/llms/github_copilot/messages/transformation.py b/litellm/llms/github_copilot/messages/transformation.py index 142df6a5a0c..b36b437e2e5 100644 --- a/litellm/llms/github_copilot/messages/transformation.py +++ b/litellm/llms/github_copilot/messages/transformation.py @@ -1,7 +1,7 @@ from typing import Any, Final from litellm.exceptions import AuthenticationError -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) diff --git a/litellm/llms/minimax/messages/transformation.py b/litellm/llms/minimax/messages/transformation.py index d4c24c65cfa..d62b88a24c6 100644 --- a/litellm/llms/minimax/messages/transformation.py +++ b/litellm/llms/minimax/messages/transformation.py @@ -5,7 +5,7 @@ MiniMax Anthropic transformation config - extends AnthropicConfig for MiniMax's from typing import Any, Final # noqa: TID251 # override below must mirror the legacy base signature import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.secret_managers.main import get_secret_str diff --git a/litellm/llms/openai_like/messages/transformation.py b/litellm/llms/openai_like/messages/transformation.py index bae190c88c0..2e9a300e2fd 100644 --- a/litellm/llms/openai_like/messages/transformation.py +++ b/litellm/llms/openai_like/messages/transformation.py @@ -2,7 +2,7 @@ from typing import Any, Final import litellm from litellm.llms.anthropic.common_utils import normalize_cache_control_in_anthropic_payload -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.openai_like.json_loader import SimpleProviderConfig diff --git a/litellm/llms/tencent/messages/transformation.py b/litellm/llms/tencent/messages/transformation.py index f1d9ee966ff..c56ecaeb51c 100644 --- a/litellm/llms/tencent/messages/transformation.py +++ b/litellm/llms/tencent/messages/transformation.py @@ -8,7 +8,7 @@ alongside its standard OpenAI-compatible chat completions endpoint. from typing import Any import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.secret_managers.main import get_secret_str diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py index 785f4dcefce..38376ea17c3 100644 --- a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py +++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py @@ -1,7 +1,7 @@ from typing import Any, Final from litellm.llms.anthropic.common_utils import AnthropicModelInfo -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.types.llms.anthropic import ( diff --git a/litellm/messages/dispatch.py b/litellm/messages/dispatch.py index 13a030e7ebe..28339ac5c94 100644 --- a/litellm/messages/dispatch.py +++ b/litellm/messages/dispatch.py @@ -5,7 +5,7 @@ from typing import Final, TypeAlias, cast # noqa: TID251 # native binding sele from litellm.exceptions import BadRequestError from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider -from litellm.llms.anthropic.experimental_pass_through.messages import handler as main +from litellm.llms.anthropic.pass_through.messages import handler as main from litellm.rust_bridge.catalog import Delivery, Route, RouteContext from litellm.rust_bridge.dispatch import PublicDispatch, call_hook from litellm.rust_bridge.messages.entrypoints import ( diff --git a/litellm/proxy/anthropic_endpoints/endpoints.py b/litellm/proxy/anthropic_endpoints/endpoints.py index d9558b86e95..2911e7801f7 100644 --- a/litellm/proxy/anthropic_endpoints/endpoints.py +++ b/litellm/proxy/anthropic_endpoints/endpoints.py @@ -14,7 +14,7 @@ from litellm.anthropic_interface.exceptions import ( AnthropicExceptionMapping, ) from litellm.integrations.custom_guardrail import ModifyResponseException -from litellm.llms.anthropic.experimental_pass_through.context_management import ( +from litellm.llms.anthropic.pass_through.context_management import ( AnthropicContextManagementError, ) from litellm.llms.base_llm.guardrail_translation.utils import ( diff --git a/litellm/proxy/guardrails/anthropic_sse.py b/litellm/proxy/guardrails/anthropic_sse.py index 26dd2a95dc4..c446cfaa815 100644 --- a/litellm/proxy/guardrails/anthropic_sse.py +++ b/litellm/proxy/guardrails/anthropic_sse.py @@ -167,10 +167,10 @@ def is_sse_error_stream(all_chunks: Sequence[object]) -> bool: def anthropic_sse_chunks_from_response(assembled: ModelResponse) -> tuple[bytes, ...]: - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) diff --git a/litellm/proxy/guardrails/guardrail_hooks/straiker/straiker.py b/litellm/proxy/guardrails/guardrail_hooks/straiker/straiker.py index 46fcbd8cc49..e46458dfe5b 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/straiker/straiker.py +++ b/litellm/proxy/guardrails/guardrail_hooks/straiker/straiker.py @@ -535,7 +535,7 @@ def _v3_answer(request_data: Mapping[str, object], model: str | None) -> Mapping return _v3_text_completion_as_chat(response) if not isinstance(response, ModelResponse) or not _v3_anthropic_messages_route(request_data): return _jsonable_dict(response) - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) diff --git a/litellm/proxy/pass_through_endpoints/streaming_handler.py b/litellm/proxy/pass_through_endpoints/streaming_handler.py index 8f0f87e6e69..19d8b063dd7 100644 --- a/litellm/proxy/pass_through_endpoints/streaming_handler.py +++ b/litellm/proxy/pass_through_endpoints/streaming_handler.py @@ -294,7 +294,7 @@ class PassThroughStreamingHandler: - Vertex AI - OpenAI """ - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( _is_message_stop_chunk, # pyright: ignore[reportPrivateUsage] # both native stream paths share terminal-event detection _is_provider_error_chunk, # pyright: ignore[reportPrivateUsage] # provider errors must not become cache evidence ) diff --git a/litellm/router.py b/litellm/router.py index 6f416c416c0..a2144819911 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -525,7 +525,7 @@ MAX_BUFFERED_PRE_CONTENT_ANTHROPIC_CHUNKS: Final = 200 def _anthropic_stream_should_drop_pre_content_ping(chunk: object, has_generated_content: bool) -> bool: """A `ping` keepalive seen before any real content is dropped outright - it recurs indefinitely on a slow-starting connection and carries nothing worth buffering toward a possible fallback.""" - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import is_anthropic_ping_chunk + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import is_anthropic_ping_chunk if has_generated_content: return False @@ -536,7 +536,7 @@ def _anthropic_stream_forwards_ping_live(chunk: object, has_generated_content: b """A `ping` that no lifecycle frame precedes reaches the client live: a fallback's own message_start can still follow it without overlapping lifecycles, and AgenticAnthropicStreamingIterator's hold-back keepalive is exactly such a ping.""" - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import is_anthropic_ping_chunk + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import is_anthropic_ping_chunk if has_generated_content or buffered_chunk_count: return False @@ -550,7 +550,7 @@ def _is_retriable_anthropic_status(status_code: int) -> bool: def _anthropic_stream_error_is_gateway_verdict(chunk: object) -> bool: """AgenticAnthropicStreamingIterator's own retrieval-failure frame is the gateway's verdict, not a provider failure: another deployment would rerun the same failed hook, so it reaches the client instead of falling back.""" - from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( is_server_fulfilled_tool_leak_error, ) @@ -605,7 +605,7 @@ def _anthropic_stream_commits_now(chunk: object, has_generated_content: bool, bu pre-content buffer cap was hit) rather than keep buffering lifecycle frames toward a possible fallback. """ - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( is_anthropic_content_delta_chunk, ) @@ -5354,7 +5354,7 @@ class Router: response=response, kwargs=kwargs, ): - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( safeguard_refusal_error, ) @@ -5464,12 +5464,12 @@ class Router: anyway) or once the stream ends without ever producing content or an error. """ - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( aclose_if_supported, parse_anthropic_error_event, parse_anthropic_refusal_stop_details, ) - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( safeguard_refusal_error, ) @@ -5626,7 +5626,7 @@ class Router: budget. """ from litellm.exceptions import MidStreamFallbackError - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( aclose_if_supported, anthropic_messages_response_as_sse_events, ) @@ -8466,7 +8466,7 @@ class Router: when a content-policy fallback is configured; a plain refusal without stop_details, or any response with nothing configured, is returned to the client unchanged. """ - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( get_safeguard_refusal_stop_details, ) @@ -12206,7 +12206,7 @@ class Router: `tools` (Chat Completions, Responses and Anthropic Messages shapes) and the Anthropic Messages top-level `system` block. """ - from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( + from litellm.llms.anthropic.pass_through.messages.utils import ( anthropic_system_to_openai_message, ) diff --git a/litellm/rust_bridge/callbacks_legacy_python.py b/litellm/rust_bridge/callbacks_legacy_python.py index e39324d3348..8ce11491277 100644 --- a/litellm/rust_bridge/callbacks_legacy_python.py +++ b/litellm/rust_bridge/callbacks_legacy_python.py @@ -326,7 +326,7 @@ def stream_success( end: datetime.datetime, first_chunk: datetime.datetime | None, ) -> None: - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( GLOBAL_PASS_THROUGH_SUCCESS_HANDLER_OBJ, ) from litellm.proxy.pass_through_endpoints.streaming_handler import PassThroughStreamingHandler diff --git a/litellm/rust_bridge/messages/route_host.py b/litellm/rust_bridge/messages/route_host.py index 0a23989a59c..caae9916ffa 100644 --- a/litellm/rust_bridge/messages/route_host.py +++ b/litellm/rust_bridge/messages/route_host.py @@ -9,7 +9,7 @@ from pydantic import TypeAdapter, ValidationError import litellm from litellm.litellm_core_utils.core_helpers import normalize_drop_params -from litellm.llms.anthropic.experimental_pass_through.utils import is_reasoning_auto_summary_enabled +from litellm.llms.anthropic.pass_through.utils import is_reasoning_auto_summary_enabled from litellm.rust_bridge import failures from litellm.rust_bridge.messages.entrypoints import LiteLLMMessagesRequest from litellm.types.llms.anthropic_messages.anthropic_response import AnthropicMessagesResponse @@ -55,7 +55,7 @@ def response(value: Mapping[str, object]) -> AnthropicMessagesResponse: def stream_hidden_params(headers: Sequence[tuple[str, str]]) -> Mapping[str, object]: - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( anthropic_messages_stream_hidden_params, ) diff --git a/ruff-strict.toml b/ruff-strict.toml index 39b3df2e385..899a8ff3af5 100644 --- a/ruff-strict.toml +++ b/ruff-strict.toml @@ -63,7 +63,7 @@ max-args = 5 # directly, each with a `# noqa: TID251 # `. "litellm.responses.main.responses".msg = "Import litellm.responses.dispatch.responses so the call routes through dispatch." "litellm.responses.main.aresponses".msg = "Import litellm.responses.dispatch.aresponses so the call routes through dispatch." -"litellm.llms.anthropic.experimental_pass_through.messages.handler.anthropic_messages".msg = "Import litellm.messages.anthropic_messages so the call routes through dispatch." -"litellm.llms.anthropic.experimental_pass_through.messages.handler.anthropic_messages_handler".msg = "Import litellm.messages.anthropic_messages_handler so the call routes through dispatch." +"litellm.llms.anthropic.pass_through.messages.handler.anthropic_messages".msg = "Import litellm.messages.anthropic_messages so the call routes through dispatch." +"litellm.llms.anthropic.pass_through.messages.handler.anthropic_messages_handler".msg = "Import litellm.messages.anthropic_messages_handler so the call routes through dispatch." "litellm.main.completion".msg = "Import litellm.completion so the call routes through dispatch." "litellm.main.acompletion".msg = "Import litellm.acompletion so the call routes through dispatch." diff --git a/tests/e2e/coverage_registry/quota_management.yaml b/tests/e2e/coverage_registry/quota_management.yaml index 6c34e5daa5c..1051bf0bda9 100644 --- a/tests/e2e/coverage_registry/quota_management.yaml +++ b/tests/e2e/coverage_registry/quota_management.yaml @@ -41,7 +41,7 @@ - {id: quota_management.budget.spend_counter.reseed_matches_db, module: quota_management, tier: P2, behavior: budget, variant: spend_counter, assertions: [reseed_matches_db], exercised_on: [chat_completions], source: "proxy/spend_tracking/budget_reservation.py", rationale: "Concurrent cold-counter reseeds keep the enforcement counter equal to DB spend (#26829)"} - {id: quota_management.spend_tracking.chat_completions.logs_cost, module: quota_management, tier: P0, behavior: spend_tracking, variant: chat_completions, assertions: [logs_cost], exercised_on: [chat_completions], source: "proxy/spend_tracking/spend_tracking_utils.py", rationale: "A paid chat call writes a nonzero spend row"} - {id: quota_management.spend_tracking.stream.logs_cost, module: quota_management, tier: P1, behavior: spend_tracking, variant: stream, assertions: [logs_cost], exercised_on: [chat_completions], source: "proxy/spend_tracking/spend_tracking_utils.py", rationale: "Streaming responses aggregate token counts into a spend row"} -- {id: quota_management.spend_tracking.messages_bridge.logs_cost, module: quota_management, tier: P1, behavior: spend_tracking, variant: messages_bridge, assertions: [logs_cost], exercised_on: [messages], source: "llms/anthropic/experimental_pass_through/responses_adapters/handler.py", rationale: "A streaming /v1/messages request served by an openai-provider model is bridged through the anthropic-messages -> Responses adapter and must aggregate the consumed SSE stream into one spend row with nonzero cost and token counts, attributed to custom_llm_provider openai under call_type anthropic_messages"} +- {id: quota_management.spend_tracking.messages_bridge.logs_cost, module: quota_management, tier: P1, behavior: spend_tracking, variant: messages_bridge, assertions: [logs_cost], exercised_on: [messages], source: "llms/anthropic/pass_through/responses_adapters/handler.py", rationale: "A streaming /v1/messages request served by an openai-provider model is bridged through the anthropic-messages -> Responses adapter and must aggregate the consumed SSE stream into one spend row with nonzero cost and token counts, attributed to custom_llm_provider openai under call_type anthropic_messages"} - {id: quota_management.spend_tracking.embeddings.logs_cost, module: quota_management, tier: P1, behavior: spend_tracking, variant: embeddings, assertions: [logs_cost], exercised_on: [embeddings], source: "proxy/spend_tracking/spend_tracking_utils.py", rationale: "Embedding calls write nonzero spend rows"} - {id: quota_management.spend_tracking.cache_hit.zero_cost, module: quota_management, tier: P1, behavior: spend_tracking, variant: cache_hit, assertions: [zero_cost], exercised_on: [chat_completions], source: "proxy/spend_tracking/spend_tracking_utils.py", rationale: "A response-cache hit logs at zero cost with the cache-hit marker"} - {id: quota_management.spend_tracking.key_rollup.matches_sum_of_logs, module: quota_management, tier: P1, behavior: spend_tracking, variant: key_rollup, assertions: [matches_sum_of_logs], exercised_on: [chat_completions], source: "proxy/db/db_spend_update_writer.py", rationale: "A key's rolled-up spend equals the sum of its log rows"} @@ -59,7 +59,7 @@ - {id: quota_management.spend_tracking.cache_write.bills_cache_creation_rate, module: quota_management, tier: P1, behavior: spend_tracking, variant: cache_write, assertions: [bills_cache_creation_rate], exercised_on: [chat_completions], source: "litellm_core_utils/llm_cost_calc/utils.py", rationale: "OpenAI cache-write tokens land on the spend row as cache-creation tokens billed at the cache-creation rate, not silently at the input rate (#34046)"} - {id: quota_management.spend_tracking.cost_breakdown.reports_component_costs, module: quota_management, tier: P1, behavior: spend_tracking, variant: cost_breakdown, assertions: [reports_component_costs], exercised_on: [chat_completions], source: "proxy/spend_tracking/spend_tracking_utils.py", rationale: "The spend row's metadata.cost_breakdown itemizes cache-read, cache-creation, output, and reasoning costs at the deployment's own rates and they sum to the row's spend (#31686)"} - {id: quota_management.spend_tracking.stream_cache_read.bills_cache_read_rate, module: quota_management, tier: P1, behavior: spend_tracking, variant: stream_cache_read, assertions: [bills_cache_read_rate], exercised_on: [chat_completions], source: "litellm_core_utils/streaming_chunk_builder_utils.py", rationale: "A streamed call's reassembled usage keeps the cached-token detail so cache reads bill at the cache-read discount, not full input price (#34812)"} -- {id: quota_management.spend_tracking.messages_bridge.keeps_cache_tokens, module: quota_management, tier: P1, behavior: spend_tracking, variant: messages_bridge, assertions: [keeps_cache_tokens], exercised_on: [messages], source: "llms/anthropic/experimental_pass_through/responses_adapters/handler.py", rationale: "A /v1/messages request served by a Responses-only OpenAI model keeps its cache-read tokens and their discounted billing across the bridge (#34957)"} +- {id: quota_management.spend_tracking.messages_bridge.keeps_cache_tokens, module: quota_management, tier: P1, behavior: spend_tracking, variant: messages_bridge, assertions: [keeps_cache_tokens], exercised_on: [messages], source: "llms/anthropic/pass_through/responses_adapters/handler.py", rationale: "A /v1/messages request served by a Responses-only OpenAI model keeps its cache-read tokens and their discounted billing across the bridge (#34957)"} - {id: quota_management.spend_tracking.service_tier.bills_tier_rates, module: quota_management, tier: P1, behavior: spend_tracking, variant: service_tier, assertions: [bills_tier_rates], exercised_on: [chat_completions], source: "cost_calculator.py", rationale: "A priority service_tier call bills input, output, and reasoning at the deployment's *_priority rates and records the tier on the row (#35923, #35925)"} - {id: quota_management.spend_tracking.cost_headers.additive_components, module: quota_management, tier: P1, behavior: spend_tracking, variant: cost_headers, assertions: [additive_components], exercised_on: [chat_completions], source: "proxy/common_request_processing.py", rationale: "The x-litellm-response-cost-* component headers sum to the total, input covers only fresh tokens, and reasoning stays a subset of output (#36965)"} - {id: quota_management.spend_tracking.passthrough_stream.injects_usage_cost, module: quota_management, tier: P1, behavior: spend_tracking, variant: passthrough_stream, assertions: [injects_usage_cost], exercised_on: [openai_passthrough], source: "proxy/pass_through_endpoints/streaming_handler.py", rationale: "With include_cost_in_streaming_usage on, the /openai passthrough's final streaming usage frame carries the proxy-computed cost (#36503). Uncovered: the flag is only settable in litellm_settings, and the shared e2e stack does not turn it on yet"} diff --git a/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py b/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py index 153c72e4a11..ae8404cd6f9 100644 --- a/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py +++ b/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py @@ -8,7 +8,7 @@ from unittest.mock import AsyncMock, MagicMock import litellm import pytest from dotenv import load_dotenv -from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( +from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) diff --git a/tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py b/tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py index 940c9624ec4..d354ddafd00 100644 --- a/tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py +++ b/tests/pass_through_unit_tests/test_anthropic_messages_passthrough.py @@ -9,7 +9,7 @@ from unittest.mock import AsyncMock, MagicMock import litellm import pytest from dotenv import load_dotenv -from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( +from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) diff --git a/tests/pass_through_unit_tests/test_context_management_polyfill.py b/tests/pass_through_unit_tests/test_context_management_polyfill.py index 564dbe36f66..38e48417791 100644 --- a/tests/pass_through_unit_tests/test_context_management_polyfill.py +++ b/tests/pass_through_unit_tests/test_context_management_polyfill.py @@ -6,7 +6,7 @@ from unittest.mock import patch import pytest import litellm -from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( +from litellm.llms.anthropic.pass_through.context_management.constants import ( CLEARED_TOOL_RESULT_PLACEHOLDER, ) from litellm.types.utils import ( diff --git a/tests/pass_through_unit_tests/test_websearch_interception_e2e.py b/tests/pass_through_unit_tests/test_websearch_interception_e2e.py index fd95b7fa8f2..ca8f7baf01b 100644 --- a/tests/pass_through_unit_tests/test_websearch_interception_e2e.py +++ b/tests/pass_through_unit_tests/test_websearch_interception_e2e.py @@ -993,7 +993,7 @@ async def test_pre_request_hook_modifies_request_body(): # Patch the anthropic_messages_handler function (called after hooks) with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.handler.anthropic_messages_handler", + "litellm.llms.anthropic.pass_through.messages.handler.anthropic_messages_handler", side_effect=mock_anthropic_messages_handler, ), patch( # test-quality-ok: the hook imports this process-global router at call time; no injection seam exists to register search_tools "litellm.proxy.proxy_server.llm_router", diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py index bcecb5b27db..f3456f6b60c 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/test_headroom.py @@ -2650,7 +2650,7 @@ async def test_retrieved_content_protected_when_mcp_tool_name_is_truncated(guard the OpenAI-translated view the guardrail scans, dropping the suffix. The call id read from the request's own Anthropic tool_use (never truncated) still pairs the retrieved row so it is held back.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( truncate_tool_name, ) diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py b/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py index 2f284447dd6..00223f192ec 100644 --- a/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py +++ b/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py @@ -4089,7 +4089,7 @@ async def test_spend_log_request_id_is_the_message_id_a_bridged_streaming_caller adapter mints itself, and it is the only request id that call ever shows the caller, so GET /spend/logs?request_id=msg_... has to land on the row.""" from litellm.litellm_core_utils.litellm_logging import Logging - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.responses_adapters.streaming_iterator import ( AnthropicResponsesStreamWrapper, ) from litellm.types.llms.openai import ( diff --git a/tests/test_litellm/proxy/test_budget_reservation.py b/tests/test_litellm/proxy/test_budget_reservation.py index b3913079bb2..18b046cd83c 100644 --- a/tests/test_litellm/proxy/test_budget_reservation.py +++ b/tests/test_litellm/proxy/test_budget_reservation.py @@ -13,10 +13,10 @@ import litellm from litellm.caching.dual_cache import DualCache from litellm.types.caching import RedisPipelineIncrementOperation from litellm.constants import STREAM_SSE_KEEPALIVE_PING_BYTES -from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( AgenticAnthropicStreamingIterator, ) -from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( AnthropicMessagesStreamingResponse, ) from litellm.proxy._types import ( diff --git a/tests/test_litellm/proxy/utils/proxy_logging/test_streaming_hooks.py b/tests/test_litellm/proxy/utils/proxy_logging/test_streaming_hooks.py index 5132aeb02e8..50f50478ad3 100644 --- a/tests/test_litellm/proxy/utils/proxy_logging/test_streaming_hooks.py +++ b/tests/test_litellm/proxy/utils/proxy_logging/test_streaming_hooks.py @@ -23,7 +23,7 @@ from litellm.exceptions import GuardrailRaisedException from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj -from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( BaseAnthropicMessagesStreamingIterator, ) from litellm.proxy._types import UserAPIKeyAuth diff --git a/tests/unit/integrations/websearch_interception/test_websearch_agentic_loop_cap.py b/tests/unit/integrations/websearch_interception/test_websearch_agentic_loop_cap.py index b7326b9048b..64c49f03732 100644 --- a/tests/unit/integrations/websearch_interception/test_websearch_agentic_loop_cap.py +++ b/tests/unit/integrations/websearch_interception/test_websearch_agentic_loop_cap.py @@ -25,7 +25,7 @@ from litellm.integrations.websearch_interception.handler import ( ) from litellm.integrations.websearch_interception.tools import get_litellm_web_search_tool from litellm.litellm_core_utils.agentic_loop_settings import DEFAULT_MAX_AGENTIC_LOOPS -from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( +from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) from litellm.llms.base_llm.search.transformation import SearchResponse, SearchResult diff --git a/tests/unit/integrations/websearch_interception/test_websearch_short_circuit.py b/tests/unit/integrations/websearch_interception/test_websearch_short_circuit.py index 7de8892b8fc..8294add60c7 100644 --- a/tests/unit/integrations/websearch_interception/test_websearch_short_circuit.py +++ b/tests/unit/integrations/websearch_interception/test_websearch_short_circuit.py @@ -229,7 +229,7 @@ class TestShortCircuitEntryPoint: @pytest.mark.asyncio async def test_returns_none_when_no_callbacks(self): """No callbacks configured → returns None""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( _try_websearch_short_circuit, ) @@ -246,7 +246,7 @@ class TestShortCircuitEntryPoint: @pytest.mark.asyncio async def test_returns_dict_when_not_streaming(self): """Non-streaming short-circuit → returns dict""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( _try_websearch_short_circuit, ) @@ -271,10 +271,10 @@ class TestShortCircuitEntryPoint: @pytest.mark.asyncio async def test_returns_stream_iterator_when_streaming(self): """Streaming short-circuit → returns FakeAnthropicMessagesStreamIterator""" - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( _try_websearch_short_circuit, ) @@ -313,7 +313,7 @@ class TestShortCircuitEntryPoint: """Non-WebSearchInterceptionLogger callbacks are ignored""" from unittest.mock import MagicMock - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( _try_websearch_short_circuit, ) @@ -336,10 +336,10 @@ class TestShortCircuitEntryPoint: loop. The short-circuit must use the ORIGINAL stream value so streaming callers get SSE events instead of a plain dict. """ - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( _try_websearch_short_circuit, ) @@ -369,7 +369,7 @@ class TestShortCircuitEntryPoint: still fire the short-circuit when the caller propagates the derived provider. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( _try_websearch_short_circuit, ) diff --git a/tests/unit/integrations/websearch_interception/test_websearch_streaming_wrap.py b/tests/unit/integrations/websearch_interception/test_websearch_streaming_wrap.py index f221e07a57d..f4a46efaa1d 100644 --- a/tests/unit/integrations/websearch_interception/test_websearch_streaming_wrap.py +++ b/tests/unit/integrations/websearch_interception/test_websearch_streaming_wrap.py @@ -13,7 +13,7 @@ import pytest from litellm.integrations.custom_logger import CustomLogger from litellm.llms.custom_httpx.llm_http_handler import BaseLLMHTTPHandler -from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( +from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) from litellm.types.integrations.custom_logger import AgenticLoopPlan diff --git a/tests/unit/llms/anthropic/chat/test_anthropic_chat_transformation.py b/tests/unit/llms/anthropic/chat/test_anthropic_chat_transformation.py index 729f46ec57f..332153b4c7d 100644 --- a/tests/unit/llms/anthropic/chat/test_anthropic_chat_transformation.py +++ b/tests/unit/llms/anthropic/chat/test_anthropic_chat_transformation.py @@ -19,7 +19,7 @@ from litellm.constants import ( ) from litellm.litellm_core_utils.prompt_templates.common_utils import encrypted_reasoning_signature from litellm.llms.anthropic.chat.transformation import AnthropicConfig -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.azure_ai.anthropic.transformation import AzureAnthropicConfig @@ -5783,7 +5783,7 @@ def test_translate_system_message_strips_billing_header_for_bedrock_invoke(): [ ("litellm.llms.anthropic.chat.transformation", "AnthropicConfig", False), ( - "litellm.llms.anthropic.experimental_pass_through.messages.transformation", + "litellm.llms.anthropic.pass_through.messages.transformation", "AnthropicMessagesConfig", False, ), diff --git a/tests/unit/llms/anthropic/messages/test_advisor_orchestration.py b/tests/unit/llms/anthropic/messages/test_advisor_orchestration.py index da5b5ac3867..fc80a285ec6 100644 --- a/tests/unit/llms/anthropic/messages/test_advisor_orchestration.py +++ b/tests/unit/llms/anthropic/messages/test_advisor_orchestration.py @@ -68,7 +68,7 @@ def _make_advisor_tool_use_response( def test_can_handle_edge_cases(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -96,7 +96,7 @@ async def test_anthropic_native_interceptor_skipped(): For provider=anthropic, can_handle() must return False. The interceptor must never call handle(). """ - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -114,7 +114,7 @@ async def test_anthropic_native_interceptor_skipped(): @pytest.mark.asyncio async def test_loop_no_advisor_call(): """Executor returns text on first try — no advisor call, loop exits immediately.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, _call_messages_handler, ) @@ -123,7 +123,7 @@ async def test_loop_no_advisor_call(): executor_response = _make_text_response(final_text) with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", new_callable=AsyncMock, return_value=executor_response, ) as mock_call: @@ -156,7 +156,7 @@ async def test_loop_one_advisor_call(): Executor calls advisor once → advisor responds → executor produces final text. Total calls: 3 (executor, advisor, executor-final). """ - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -184,7 +184,7 @@ async def test_loop_one_advisor_call(): return final_resp # executor: final answer with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -218,7 +218,7 @@ async def test_loop_one_advisor_call(): @pytest.mark.asyncio async def test_loop_max_uses_raises(): """Loop exceeding max_uses must raise AdvisorMaxIterationsError.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorMaxIterationsError, AdvisorOrchestrationHandler, ) @@ -239,7 +239,7 @@ async def test_loop_max_uses_raises(): return advisor_tool_use_resp with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -262,17 +262,17 @@ async def test_loop_max_uses_raises(): @pytest.mark.asyncio async def test_loop_streaming_wraps_response(): """stream=True: final response must be wrapped in FakeAnthropicMessagesStreamIterator.""" - from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + from litellm.llms.anthropic.pass_through.messages.fake_stream_iterator import ( FakeAnthropicMessagesStreamIterator, ) - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) executor_response = _make_text_response("Hello, world!") with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", new_callable=AsyncMock, return_value=executor_response, ): @@ -308,7 +308,7 @@ async def test_prior_advisor_blocks_replaced_in_history(): History containing server_tool_use + advisor_tool_result blocks gets collapsed to text before forwarding to the executor. """ - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -341,7 +341,7 @@ async def test_prior_advisor_blocks_replaced_in_history(): return _make_text_response("Here is the efficient version.") with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -383,7 +383,7 @@ async def test_advisor_tool_translated_for_executor(): """ The executor must receive a regular tool definition (not advisor_20260301 type). """ - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -395,7 +395,7 @@ async def test_advisor_tool_translated_for_executor(): return _make_text_response("Done.") with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -425,7 +425,7 @@ async def test_advisor_tool_translated_for_executor(): @pytest.mark.asyncio async def test_max_uses_zero_raises_on_first_advisor_call(): """max_uses=0 must cause AdvisorMaxIterationsError on the first advisor call.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorMaxIterationsError, AdvisorOrchestrationHandler, ) @@ -437,7 +437,7 @@ async def test_max_uses_zero_raises_on_first_advisor_call(): return advisor_tool_use_resp # executor always tries to call advisor with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -460,7 +460,7 @@ async def test_max_uses_zero_raises_on_first_advisor_call(): @pytest.mark.asyncio async def test_missing_advisor_model_raises_value_error(): """handle() must raise ValueError when the advisor tool has no model field.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -487,7 +487,7 @@ async def test_missing_advisor_model_raises_value_error(): async def test_max_uses_none_falls_back_to_default(): """When max_uses is absent, the handler uses ADVISOR_MAX_USES from constants.""" import litellm.constants as _c - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorMaxIterationsError, AdvisorOrchestrationHandler, ) @@ -501,7 +501,7 @@ async def test_max_uses_none_falls_back_to_default(): return advisor_tool_use_resp with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -535,7 +535,7 @@ ADVISOR_TOOL_WITH_CREDS = { async def _run_advisor_and_capture_subcall_kwargs(): """Run one advisor turn and return the kwargs of the advisor sub-call.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -560,11 +560,11 @@ async def _run_advisor_and_capture_subcall_kwargs(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ), patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.validate_url", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor.validate_url", ), ): h = AdvisorOrchestrationHandler() @@ -584,7 +584,7 @@ async def test_advisor_creds_dropped_when_proxy_opt_in_disabled(): """On the proxy without opt-in, the caller's advisor api_base/api_key must NOT reach the sub-call (would redirect it / leak the server key).""" with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=False, ): captured = await _run_advisor_and_capture_subcall_kwargs() @@ -596,7 +596,7 @@ async def test_advisor_creds_dropped_when_proxy_opt_in_disabled(): async def test_advisor_creds_honored_when_proxy_opt_in_enabled(): """With the admin opt-in, the documented clientside routing still works.""" with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ): captured = await _run_advisor_and_capture_subcall_kwargs() @@ -629,7 +629,7 @@ def test_allow_client_side_advisor_credentials_reads_proxy_flag(): """The gate mirrors the proxy's allow_client_side_credentials opt-in.""" import sys - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _allow_client_side_advisor_credentials, ) @@ -653,7 +653,7 @@ def test_allow_client_side_advisor_credentials_defaults_true_outside_proxy(): import builtins import sys - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _allow_client_side_advisor_credentials, ) @@ -677,7 +677,7 @@ def test_advisor_gate_propagates_non_import_errors(): returning True.""" import sys - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors import ( + from litellm.llms.anthropic.pass_through.messages.interceptors import ( advisor, ) @@ -744,12 +744,12 @@ async def test_advisor_uses_tool_credentials_when_clientside_enabled(): def test_resolve_advisor_credentials_returns_none_when_gate_closed(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=False, ): result = _resolve_advisor_credentials(ADVISOR_TOOL_WITH_CREDS) @@ -757,18 +757,18 @@ def test_resolve_advisor_credentials_returns_none_when_gate_closed(): def test_resolve_advisor_credentials_allows_api_key_without_api_base(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) tool = {**ADVISOR_TOOL, "api_key": "sk-other"} with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ), patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.validate_url", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor.validate_url", side_effect=AssertionError("validate_url must not run without an api_base"), ), ): @@ -777,13 +777,13 @@ def test_resolve_advisor_credentials_allows_api_key_without_api_base(): def test_resolve_advisor_credentials_rejects_api_base_without_api_key(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) tool = {**ADVISOR_TOOL, "api_base": "https://other.example"} with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ): with pytest.raises(ValueError, match="api_base"): @@ -791,17 +791,17 @@ def test_resolve_advisor_credentials_rejects_api_base_without_api_key(): def test_resolve_advisor_credentials_validates_api_base_before_use(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ), patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.validate_url" + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor.validate_url" ) as mock_validate, ): result = _resolve_advisor_credentials(ADVISOR_TOOL_WITH_CREDS) @@ -811,17 +811,17 @@ def test_resolve_advisor_credentials_validates_api_base_before_use(): def test_resolve_advisor_credentials_propagates_ssrf_error(): from litellm.litellm_core_utils.url_utils import SSRFError - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ), patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.validate_url", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor.validate_url", side_effect=SSRFError("URL targets a blocked address"), ), ): @@ -832,18 +832,18 @@ def test_resolve_advisor_credentials_propagates_ssrf_error(): def test_resolve_advisor_credentials_skips_validation_when_url_validation_disabled(): import litellm - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ), patch.object(litellm, "user_url_validation", False), patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor.validate_url", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor.validate_url", side_effect=AssertionError("validate_url must not run when user_url_validation is disabled"), ), ): @@ -855,7 +855,7 @@ def test_resolve_advisor_credentials_blocks_real_cloud_metadata_address(): """End-to-end (no mocked validate_url): a caller can't redirect the advisor sub-call to the cloud-metadata address even with an api_key.""" from litellm.litellm_core_utils.url_utils import SSRFError - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) @@ -865,7 +865,7 @@ def test_resolve_advisor_credentials_blocks_real_cloud_metadata_address(): "api_base": "https://169.254.169.254/latest/meta-data/", } with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ): with pytest.raises(SSRFError): @@ -873,13 +873,13 @@ def test_resolve_advisor_credentials_blocks_real_cloud_metadata_address(): def test_resolve_advisor_credentials_rejects_non_https_api_base(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) tool = {**ADVISOR_TOOL, "api_key": "sk-other", "api_base": "http://8.8.8.8"} with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ): with pytest.raises(ValueError, match="https"): @@ -889,14 +889,14 @@ def test_resolve_advisor_credentials_rejects_non_https_api_base(): def test_resolve_advisor_credentials_rejects_api_base_when_ssl_verify_disabled(): import litellm - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) tool = {**ADVISOR_TOOL, "api_key": "sk-other", "api_base": "https://8.8.8.8"} with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ), patch.object(litellm, "ssl_verify", False), @@ -908,13 +908,13 @@ def test_resolve_advisor_credentials_rejects_api_base_when_ssl_verify_disabled() def test_resolve_advisor_credentials_allows_real_public_ip_address(): """End-to-end (no mocked validate_url): a globally-routable literal IP api_base is honored when paired with an api_key.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( _resolve_advisor_credentials, ) tool = {**ADVISOR_TOOL, "api_key": "sk-other", "api_base": "https://8.8.8.8"} with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._allow_client_side_advisor_credentials", return_value=True, ): result = _resolve_advisor_credentials(tool) @@ -933,7 +933,7 @@ async def test_advisor_sub_call_failure_is_tagged(): """When the advisor sub-call raises, the exception that propagates out of handle() must be tagged as an advisor orchestration failure.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) from litellm.router_utils.cooldown_handlers import is_advisor_orchestration_failure @@ -952,7 +952,7 @@ async def test_advisor_sub_call_failure_is_tagged(): ) with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -975,7 +975,7 @@ async def test_advisor_max_iterations_failure_is_tagged(): """When the orchestration loop exceeds max_uses (the executor keeps calling the advisor), the AdvisorMaxIterationsError must be tagged so the healthy executor deployment is not cooled down.""" - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorMaxIterationsError, AdvisorOrchestrationHandler, ) @@ -991,7 +991,7 @@ async def test_advisor_max_iterations_failure_is_tagged(): return _make_advisor_tool_use_response() with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -1013,7 +1013,7 @@ async def test_executor_failure_is_not_tagged(): """A failure of the executor call (not advisor orchestration) must NOT be tagged — the selected deployment genuinely failed and should cool down.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) from litellm.router_utils.cooldown_handlers import is_advisor_orchestration_failure @@ -1026,7 +1026,7 @@ async def test_executor_failure_is_not_tagged(): ) with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() @@ -1082,7 +1082,7 @@ def _router_with_advisor_deployment( @pytest.mark.asyncio async def test_advisor_sub_call_routes_through_proxy_router(): import litellm.proxy.proxy_server as proxy_server - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -1105,7 +1105,7 @@ async def test_advisor_sub_call_routes_through_proxy_router(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ), patch.object(proxy_server, "llm_router", router), @@ -1143,7 +1143,7 @@ async def test_advisor_sub_call_routes_through_proxy_router(): async def test_advisor_sub_call_routes_through_router_for_alias_and_wildcard(router_kwargs, advisor_model): """Alias and wildcard advisor models resolve through the router like exact model_list matches.""" import litellm.proxy.proxy_server as proxy_server - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -1166,7 +1166,7 @@ async def test_advisor_sub_call_routes_through_router_for_alias_and_wildcard(rou with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ), patch.object(proxy_server, "llm_router", router), @@ -1192,7 +1192,7 @@ async def test_advisor_sub_call_routes_through_router_for_alias_and_wildcard(rou async def test_advisor_sub_call_bypasses_router_for_unconfigured_model(): """An advisor model the router doesn't know about keeps the SDK-level path.""" import litellm.proxy.proxy_server as proxy_server - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -1217,7 +1217,7 @@ async def test_advisor_sub_call_bypasses_router_for_unconfigured_model(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ), patch.object(proxy_server, "llm_router", router), @@ -1241,7 +1241,7 @@ async def test_advisor_sub_call_client_override_bypasses_router(): """A caller-supplied api_key/api_base override must not be re-routed.""" import litellm import litellm.proxy.proxy_server as proxy_server - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -1272,7 +1272,7 @@ async def test_advisor_sub_call_client_override_bypasses_router(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ), patch.object(proxy_server, "llm_router", router), @@ -1307,7 +1307,7 @@ async def test_advisor_sub_call_client_override_bypasses_router(): @pytest.mark.asyncio async def test_advisor_context_excludes_in_sequence_system_rows(): - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorOrchestrationHandler, ) @@ -1327,7 +1327,7 @@ async def test_advisor_context_excludes_in_sequence_system_rows(): return _make_text_response("Final answer.") with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_call, ): h = AdvisorOrchestrationHandler() diff --git a/tests/unit/llms/anthropic/experimental_pass_through/__init__.py b/tests/unit/llms/anthropic/pass_through/__init__.py similarity index 100% rename from tests/unit/llms/anthropic/experimental_pass_through/__init__.py rename to tests/unit/llms/anthropic/pass_through/__init__.py diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/__init__.py b/tests/unit/llms/anthropic/pass_through/adapters/__init__.py similarity index 100% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/__init__.py rename to tests/unit/llms/anthropic/pass_through/adapters/__init__.py diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py b/tests/unit/llms/anthropic/pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py index 2fe22ba2620..06aaa4e61fb 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py @@ -16,14 +16,14 @@ from litellm.litellm_core_utils.prompt_templates.factory import ( THOUGHT_SIGNATURE_SEPARATOR, _bedrock_converse_messages_pt, ) -from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( +from litellm.llms.anthropic.pass_through.adapters.transformation import ( OPENAI_MAX_TOOL_NAME_LENGTH, AnthropicAdapter, LiteLLMAnthropicMessagesAdapter, create_tool_name_mapping, truncate_tool_name, ) -from litellm.llms.anthropic.experimental_pass_through.messages.mid_conversation_system import ( +from litellm.llms.anthropic.pass_through.messages.mid_conversation_system import ( CONVERTED_SYSTEM_NOTE, ) from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig @@ -3944,7 +3944,7 @@ class TestAnthropicStreamWrapperToolArgs: return [text_chunk, tool_chunk, finish_chunk] def _make_stream_wrapper(self, chunks): - from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) @@ -4059,7 +4059,7 @@ def _make_simple_openai_response( def test_translate_openai_response_to_anthropic_with_polyfill_compaction_block(): """compaction_block from PolyfillResult must be prepended to content at index 0.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.result import ( + from litellm.llms.anthropic.pass_through.context_management.result import ( PolyfillResult, ) @@ -4092,7 +4092,7 @@ def test_translate_openai_response_to_anthropic_with_polyfill_compaction_block() def test_translate_openai_response_to_anthropic_with_polyfill_iterations_usage(): """iterations_usage from PolyfillResult must produce usage['iterations'] with a message entry.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.result import ( + from litellm.llms.anthropic.pass_through.context_management.result import ( PolyfillResult, ) @@ -4147,7 +4147,7 @@ def test_translate_openai_response_to_anthropic_no_polyfill_no_change(): def test_translate_openai_response_to_anthropic_with_polyfill_both_compaction_and_iterations(): """Full summary path: compaction_block and iterations_usage both present simultaneously.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.result import ( + from litellm.llms.anthropic.pass_through.context_management.result import ( PolyfillResult, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_output_config_passthrough.py b/tests/unit/llms/anthropic/pass_through/adapters/test_handler_output_config_passthrough.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_output_config_passthrough.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_handler_output_config_passthrough.py index 6246f502344..2dc1202a8c8 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_output_config_passthrough.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_handler_output_config_passthrough.py @@ -38,7 +38,7 @@ sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../../..")) ) -from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( +from litellm.llms.anthropic.pass_through.adapters.handler import ( ANTHROPIC_ONLY_REQUEST_KEYS, LiteLLMMessagesToCompletionTransformationHandler, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_prompt_cache_key.py b/tests/unit/llms/anthropic/pass_through/adapters/test_handler_prompt_cache_key.py similarity index 97% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_prompt_cache_key.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_handler_prompt_cache_key.py index 7dc7507120f..c31d85be0a8 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_prompt_cache_key.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_handler_prompt_cache_key.py @@ -6,7 +6,7 @@ import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../../.."))) -from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( +from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py b/tests/unit/llms/anthropic/pass_through/adapters/test_handler_reasoning_effort_normalization.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_handler_reasoning_effort_normalization.py index 895b3b57f7b..0dfe4a93649 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_handler_reasoning_effort_normalization.py @@ -10,7 +10,7 @@ from typing import Final import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( +from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_combined_chunk.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_combined_chunk.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_combined_chunk.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_combined_chunk.py index 6973340101e..5a7cf652b95 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_combined_chunk.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_combined_chunk.py @@ -14,7 +14,7 @@ import json from types import SimpleNamespace from typing import AsyncIterator -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, _CombinedChunkSplitter, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_compaction.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_compaction.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_compaction.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_compaction.py index 5c53a8fc317..3f6587b9338 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_compaction.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_compaction.py @@ -6,7 +6,7 @@ from unittest.mock import MagicMock import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import Delta, StreamingChoices, Usage diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_empty_choices.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_empty_choices.py similarity index 97% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_empty_choices.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_empty_choices.py index 3e85872f1e5..ca2532fce56 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_empty_choices.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_empty_choices.py @@ -12,7 +12,7 @@ import asyncio import json from typing import Any, AsyncIterator, Dict, List, Optional -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import Delta, ModelResponseStream, StreamingChoices, Usage diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_first_delta.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_first_delta.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_first_delta.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_first_delta.py index fdd08eaa182..18cf42776f9 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_first_delta.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_first_delta.py @@ -27,7 +27,7 @@ from unittest.mock import MagicMock import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import ( diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_message_id.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_message_id.py similarity index 95% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_message_id.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_message_id.py index 7cd789529c8..a4f851c7753 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_message_id.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_message_id.py @@ -12,10 +12,10 @@ import pytest import respx import litellm -from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( +from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_mid_stream_error.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_mid_stream_error.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_mid_stream_error.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_mid_stream_error.py index 45ec18733f7..4798d522182 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_mid_stream_error.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_mid_stream_error.py @@ -25,7 +25,7 @@ import pytest sys.path.insert(0, os.path.abspath("../../../../..")) from litellm.exceptions import MidStreamFallbackError -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, _mid_stream_error_sse_event, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_stop_reason.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_stop_reason.py similarity index 96% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_stop_reason.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_stop_reason.py index 4b95b36fec3..5f5007d52b5 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_stop_reason.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_stop_reason.py @@ -12,7 +12,7 @@ bridge emitted ``stop_reason: "end_turn"`` and Anthropic tool-runners import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.llms.ollama.chat.transformation import ( diff --git a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_tool_args.py b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_tool_args.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_tool_args.py rename to tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_tool_args.py index a20aaf2e324..e9fe65ec8b0 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/adapters/test_streaming_iterator_tool_args.py +++ b/tests/unit/llms/anthropic/pass_through/adapters/test_streaming_iterator_tool_args.py @@ -16,7 +16,7 @@ from unittest.mock import MagicMock import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import ( diff --git a/tests/unit/llms/anthropic/experimental_pass_through/context_management/__init__.py b/tests/unit/llms/anthropic/pass_through/context_management/__init__.py similarity index 100% rename from tests/unit/llms/anthropic/experimental_pass_through/context_management/__init__.py rename to tests/unit/llms/anthropic/pass_through/context_management/__init__.py diff --git a/tests/unit/llms/anthropic/experimental_pass_through/context_management/test_clear_tool_uses.py b/tests/unit/llms/anthropic/pass_through/context_management/test_clear_tool_uses.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/context_management/test_clear_tool_uses.py rename to tests/unit/llms/anthropic/pass_through/context_management/test_clear_tool_uses.py index 09ac95ab16e..7a4a0f40ecc 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/context_management/test_clear_tool_uses.py +++ b/tests/unit/llms/anthropic/pass_through/context_management/test_clear_tool_uses.py @@ -4,10 +4,10 @@ Unit tests for the in-gateway `clear_tool_uses_20250919` polyfill editor. from copy import deepcopy -from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( +from litellm.llms.anthropic.pass_through.context_management.constants import ( CLEARED_TOOL_RESULT_PLACEHOLDER, ) -from litellm.llms.anthropic.experimental_pass_through.context_management.editors.clear_tool_uses import ( +from litellm.llms.anthropic.pass_through.context_management.editors.clear_tool_uses import ( apply_clear_tool_uses_20250919, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/context_management/test_compact.py b/tests/unit/llms/anthropic/pass_through/context_management/test_compact.py similarity index 89% rename from tests/unit/llms/anthropic/experimental_pass_through/context_management/test_compact.py rename to tests/unit/llms/anthropic/pass_through/context_management/test_compact.py index 31b8dd6c0e1..bfba50fb368 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/context_management/test_compact.py +++ b/tests/unit/llms/anthropic/pass_through/context_management/test_compact.py @@ -21,11 +21,11 @@ import pytest from fastapi import HTTPException import litellm -from litellm.llms.anthropic.experimental_pass_through.context_management import ( +from litellm.llms.anthropic.pass_through.context_management import ( AnthropicContextManagementError, apply_context_management, ) -from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( +from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _augment_system_with_summary, _extract_summary_text, _select_last_user_question, @@ -34,7 +34,7 @@ from litellm.llms.anthropic.experimental_pass_through.context_management.editors apply_client_compaction_block_history, apply_compact_20260112, ) -from litellm.llms.anthropic.experimental_pass_through.context_management.result import ( +from litellm.llms.anthropic.pass_through.context_management.result import ( PolyfillResult, ) from litellm.proxy.hooks.parallel_request_limiter_v3 import RateLimitUnverifiableError @@ -315,7 +315,7 @@ async def test_trigger_below_minimum_raises(): async def test_trigger_at_minimum_does_not_raise(): """Exactly 50 000 is allowed — only strictly less than 50k is rejected.""" with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await apply_compact_20260112( @@ -340,7 +340,7 @@ async def test_trigger_at_minimum_does_not_raise(): async def test_opt_in_gating_no_summary_model_configured(): messages = _simple_messages() with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await apply_compact_20260112( @@ -367,7 +367,7 @@ async def test_opt_in_gating_no_summary_model_keeps_post_compaction_tail(): messages = _messages_with_compaction("prior summary text") with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await apply_compact_20260112( @@ -451,7 +451,7 @@ async def test_slice_only_path_with_existing_compaction_block(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=500), # well under threshold @@ -488,7 +488,7 @@ async def test_slice_only_no_compaction_block_under_threshold(): messages = _simple_messages() with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=500), @@ -521,12 +521,12 @@ async def test_full_summary_path(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), # over 150k threshold patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", new_callable=AsyncMock, return_value=mock_response, ), @@ -575,7 +575,7 @@ async def test_full_summary_path_uses_router_when_available(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="my-summary-model", ), patch("litellm.token_counter", return_value=200_000), @@ -611,12 +611,12 @@ async def test_litellm_metadata_propagated_to_summary_call(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", new_callable=AsyncMock, return_value=mock_response, ) as mock_call, @@ -648,12 +648,12 @@ async def test_summary_call_failed(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", new_callable=AsyncMock, side_effect=RuntimeError("network error"), ), @@ -684,12 +684,12 @@ async def test_summary_extraction_failed_no_tags(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", new_callable=AsyncMock, return_value=mock_response, ), @@ -716,7 +716,7 @@ async def test_pause_after_compaction_ignored_warning(): """pause_after_compaction: true → warning recorded, request proceeds normally.""" messages = _simple_messages() with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await apply_compact_20260112( @@ -739,7 +739,7 @@ async def test_pause_after_compaction_ignored_warning(): async def test_unsupported_trigger_type_falls_back_to_default(): messages = _simple_messages() with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await apply_compact_20260112( @@ -777,12 +777,12 @@ async def test_custom_instructions_used_verbatim(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -822,12 +822,12 @@ async def test_default_instructions_appended_with_no_tool_suffix_when_no_tools() with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -858,12 +858,12 @@ async def test_default_instructions_with_tools_appends_no_tool_suffix(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -892,12 +892,12 @@ async def test_system_prompt_forwarded_to_summary_call_as_string(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -932,12 +932,12 @@ async def test_system_prompt_forwarded_to_summary_call_as_content_blocks(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -975,12 +975,12 @@ async def test_summary_call_carries_prior_compaction_summary_into_system(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -1012,12 +1012,12 @@ async def test_summary_call_omits_system_message_when_system_is_none(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -1053,12 +1053,12 @@ async def test_summary_call_does_not_emit_consecutive_user_turns(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", side_effect=_fake_call_summary_model, ), ): @@ -1085,10 +1085,10 @@ async def test_summary_call_sends_default_max_tokens(): (which require it) don't reject the request and silently fall back to ``summary_call_failed``. """ - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_SUMMARY_MAX_TOKENS, ) - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -1112,7 +1112,7 @@ async def test_summary_call_sends_default_max_tokens(): async def test_summary_call_honors_max_tokens_override(): """Operators can override the default summary ``max_tokens`` via ``general_settings.context_management_summary_max_tokens``.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _read_summary_max_tokens_setting, ) @@ -1129,7 +1129,7 @@ async def test_summary_call_honors_max_tokens_override(): ): assert _read_summary_max_tokens_setting() == 8192 - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -1148,10 +1148,10 @@ def test_summary_max_tokens_setting_falls_back_for_invalid_values(): """Invalid override values (non-int, non-positive, missing) fall back to the compiled default so a typo in ``general_settings`` doesn't break the summary call.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_SUMMARY_MAX_TOKENS, ) - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _read_summary_max_tokens_setting, ) @@ -1168,10 +1168,10 @@ def test_summary_max_tokens_setting_falls_back_for_invalid_values(): async def test_summary_call_sends_default_timeout(): """``timeout`` is set on the summary call so a slow or unresponsive summary model cannot hang the parent ``/v1/messages`` request indefinitely.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_SUMMARY_TIMEOUT_SECONDS, ) - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -1240,12 +1240,12 @@ async def test_summary_model_denied_when_key_not_in_allowlist(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), ): @@ -1272,12 +1272,12 @@ async def test_summary_model_denied_when_team_not_in_allowlist(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), ): @@ -1303,12 +1303,12 @@ async def test_summary_model_allowed_when_in_key_allowlist(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), ): @@ -1336,12 +1336,12 @@ async def test_summary_model_allowed_when_no_user_api_key_auth(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), ): @@ -1373,12 +1373,12 @@ async def test_summary_model_denied_when_user_scope_excludes_it(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch( @@ -1423,12 +1423,12 @@ async def test_summary_model_denied_when_project_scope_excludes_it(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch( @@ -1475,12 +1475,12 @@ async def test_summary_model_denied_when_team_member_scope_excludes_it(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch( @@ -1528,12 +1528,12 @@ async def test_summary_model_denied_when_team_membership_read_hits_a_db_outage() with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch( @@ -1582,12 +1582,12 @@ async def test_summary_model_denied_when_key_over_model_budget(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.model_max_budget_limiter", limiter), @@ -1635,12 +1635,12 @@ async def test_summary_model_denied_when_user_over_model_budget(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.model_max_budget_limiter", limiter), @@ -1702,12 +1702,12 @@ async def test_summary_model_denied_when_end_user_over_model_budget(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.model_max_budget_limiter", limiter), @@ -1743,12 +1743,12 @@ async def test_summary_model_allowed_when_within_model_budget(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.model_max_budget_limiter", limiter), @@ -1834,12 +1834,12 @@ async def test_summary_model_rate_limit_check_errors(limiter_error, summary_call with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.proxy_logging_obj", proxy_logging), @@ -1876,12 +1876,12 @@ async def test_summary_model_denied_when_over_rate_limit(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.proxy_logging_obj", proxy_logging), @@ -1912,12 +1912,12 @@ async def test_summary_model_allowed_when_within_rate_limit(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.proxy_logging_obj", proxy_logging), @@ -1960,12 +1960,12 @@ async def test_summary_model_allowed_while_the_caller_holds_the_keys_only_parall with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.proxy_logging_obj", _proxy_logging_like_the_live_proxy(limiter)), @@ -1996,12 +1996,12 @@ async def test_summary_model_rate_limit_skipped_for_legacy_limiter(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch("litellm.proxy.proxy_server.proxy_logging_obj", proxy_logging), @@ -2050,12 +2050,12 @@ async def test_summary_model_denied_when_team_over_model_budget(): with ( patch( # test-quality-ok: apply_compact_20260112 reads the summary model setting as a module global, no seam - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), # test-quality-ok: forces the over-threshold branch patch( # test-quality-ok: the summary call is the observable that must NOT happen when the team is over budget - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), patch( # test-quality-ok: the limiter is a proxy_server module global the editor imports, no injection seam @@ -2108,12 +2108,12 @@ async def test_scoped_budget_metadata_propagated_to_summary_call(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", new_callable=AsyncMock, return_value=mock_response, ) as mock_call, @@ -2136,7 +2136,7 @@ async def test_scoped_budget_metadata_propagated_to_summary_call(): async def test_summary_call_passes_end_user_id_as_top_level_user(): """``_call_summary_model`` forwards the propagated end-user id as the top-level ``user`` kwarg that legacy limiter / prometheus end-user tracking reads.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -2159,7 +2159,7 @@ async def test_summary_call_passes_end_user_id_as_top_level_user(): async def test_summary_call_omits_user_when_no_end_user_id(): """No end-user id on the parent request means no ``user`` kwarg is sent.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -2195,12 +2195,12 @@ async def test_model_budget_metadata_propagated_to_summary_call(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", new_callable=AsyncMock, return_value=mock_response, ) as mock_call, @@ -2236,12 +2236,12 @@ async def test_summary_call_propagates_allowed_model_region(): with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._call_summary_model", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._call_summary_model", mock_call, ), ): @@ -2262,7 +2262,7 @@ async def test_summary_call_omits_allowed_model_region_when_unset(): """Callers without a region restriction must not get an ``allowed_model_region=None`` kwarg, which would otherwise force the router to evaluate region filtering. """ - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -2285,7 +2285,7 @@ async def test_summary_call_omits_allowed_model_region_when_unset(): async def test_summary_call_forwards_allowed_model_region_when_set(): """When the caller is region-restricted, the kwarg reaches the router.""" - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _call_summary_model, ) @@ -2316,7 +2316,7 @@ async def test_dispatcher_routes_compact_edit(): """compact_20260112 in the dispatcher resolves to opt-in gate when no model set.""" messages = _simple_messages() with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await apply_context_management( @@ -2358,7 +2358,7 @@ async def test_dispatcher_trigger_below_minimum_raises_through(): async def test_run_polyfill_skipped_when_context_management_in_additional_drop_params(): """additional_drop_params=["context_management"] is the explicit opt-out.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( _run_polyfill_if_enabled, ) @@ -2379,13 +2379,13 @@ async def test_run_polyfill_runs_when_litellm_drop_params_true(monkeypatch): """drop_params must not disable the polyfill: context_management is a LiteLLM-supported param (polyfilled where not native), and drop_params only exists to strip genuinely unsupported params.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( _run_polyfill_if_enabled, ) monkeypatch.setattr(litellm, "drop_params", True) with patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value=None, ): result = await _run_polyfill_if_enabled( @@ -2404,7 +2404,7 @@ async def test_run_polyfill_runs_when_litellm_drop_params_true(monkeypatch): async def test_run_polyfill_skipped_when_spec_empty(): """Empty context_management_spec must also return None (no polyfill work).""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( _run_polyfill_if_enabled, ) @@ -2473,7 +2473,7 @@ def _openai_chat_response(): async def _call_async_adapter_handler(**handler_kwargs: Any): - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -2532,7 +2532,7 @@ async def test_async_handler_additional_drop_params_strips_context_management(): def _call_sync_adapter_handler(**handler_kwargs: Any): - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -2584,7 +2584,7 @@ async def test_prepare_context_managed_request_forwards_proxy_litellm_metadata() Anthropic-shape ``metadata`` arg (which only carries ``user_id``). Otherwise the summary subcall lands on the router with no parent attribution, and those tokens go unbilled to the caller's key/team.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( _prepare_context_managed_request, ) @@ -2597,7 +2597,7 @@ async def test_prepare_context_managed_request_forwards_proxy_litellm_metadata() with ( patch( - "litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact._read_summary_model_setting", + "litellm.llms.anthropic.pass_through.context_management.editors.compact._read_summary_model_setting", return_value="claude-haiku-4-5", ), patch("litellm.token_counter", return_value=200_000), @@ -2786,7 +2786,7 @@ def test_endpoint_runs_failure_hook_on_500_context_management_error(): def test_count_effective_tokens_counts_midturn_system_correction(): - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _count_effective_tokens, ) @@ -2813,7 +2813,7 @@ def test_count_effective_tokens_counts_midturn_system_correction(): def test_build_summary_messages_keeps_midturn_system_correction_in_place(): - from litellm.llms.anthropic.experimental_pass_through.context_management.editors.compact import ( + from litellm.llms.anthropic.pass_through.context_management.editors.compact import ( _build_summary_messages, ) @@ -2847,7 +2847,7 @@ async def test_threshold_check_counts_tokens_off_the_event_loop(monkeypatch): warm_tokenizer, ) - from litellm.llms.anthropic.experimental_pass_through.context_management.constants import ( + from litellm.llms.anthropic.pass_through.context_management.constants import ( COMPACT_SUMMARY_MODEL_SETTING_KEY, ) from litellm.proxy.proxy_server import general_settings diff --git a/tests/unit/llms/anthropic/experimental_pass_through/context_management/test_dispatcher.py b/tests/unit/llms/anthropic/pass_through/context_management/test_dispatcher.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/context_management/test_dispatcher.py rename to tests/unit/llms/anthropic/pass_through/context_management/test_dispatcher.py index 9fad6ca5e66..5943661683a 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/context_management/test_dispatcher.py +++ b/tests/unit/llms/anthropic/pass_through/context_management/test_dispatcher.py @@ -2,7 +2,7 @@ Unit tests for the context_management polyfill dispatcher. """ -from litellm.llms.anthropic.experimental_pass_through.context_management import ( +from litellm.llms.anthropic.pass_through.context_management import ( apply_context_management, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/__init__.py b/tests/unit/llms/anthropic/pass_through/messages/__init__.py similarity index 100% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/__init__.py rename to tests/unit/llms/anthropic/pass_through/messages/__init__.py diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_advisor_integration.py b/tests/unit/llms/anthropic/pass_through/messages/test_advisor_integration.py similarity index 91% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_advisor_integration.py rename to tests/unit/llms/anthropic/pass_through/messages/test_advisor_integration.py index 414ba8f0f5c..57d45854130 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_advisor_integration.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_advisor_integration.py @@ -72,7 +72,7 @@ async def test_full_dispatch_interceptor_fires_and_loop_completes(): The interceptor must fire, run the loop (1 advisor call), and return a clean final response with no advisor tool_use blocks. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) @@ -88,7 +88,7 @@ async def test_full_dispatch_interceptor_fires_and_loop_completes(): return _text_resp("def is_prime(n): ...") # executor: final with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_handler, ): result = await anthropic_messages( @@ -127,10 +127,10 @@ async def test_max_uses_enforced_through_full_handler(): AdvisorMaxIterationsError propagates out of anthropic_messages() when the executor keeps calling the advisor past max_uses. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) - from litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor import ( + from litellm.llms.anthropic.pass_through.messages.interceptors.advisor import ( AdvisorMaxIterationsError, ) @@ -143,7 +143,7 @@ async def test_max_uses_enforced_through_full_handler(): return _advisor_call_resp() with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_handler, ): with pytest.raises(AdvisorMaxIterationsError): @@ -168,7 +168,7 @@ async def test_anthropic_provider_bypasses_interceptor(): With custom_llm_provider='anthropic', the interceptor must NOT fire. The advisor_20260301 tool is forwarded as-is to the underlying handler. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) @@ -176,7 +176,7 @@ async def test_anthropic_provider_bypasses_interceptor(): # Patch the non-interceptor code path — anthropic_messages_handler with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.handler.anthropic_messages_handler", + "litellm.llms.anthropic.pass_through.messages.handler.anthropic_messages_handler", return_value=direct_response, ) as mock_native: result = await anthropic_messages( @@ -215,7 +215,7 @@ async def test_named_params_forwarded_into_advisor_executor_subcall(): them, e.g. Vertex AI rejecting ``clear_thinking_20251015`` context_management edits with: ``strategy requires thinking to be enabled or adaptive``. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) @@ -246,7 +246,7 @@ async def test_named_params_forwarded_into_advisor_executor_subcall(): return _text_resp("Final answer.") with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_handler, ): await anthropic_messages( @@ -298,7 +298,7 @@ async def test_pre_request_hook_override_does_not_collide_with_explicit_kwargs() Regression for Greptile P2 on PR #27810. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages, ) @@ -339,11 +339,11 @@ async def test_pre_request_hook_override_does_not_collide_with_explicit_kwargs() with ( patch( - "litellm.llms.anthropic.experimental_pass_through.messages.handler._execute_pre_request_hooks", + "litellm.llms.anthropic.pass_through.messages.handler._execute_pre_request_hooks", side_effect=fake_pre_request_hooks, ), patch( - "litellm.llms.anthropic.experimental_pass_through.messages.interceptors.advisor._call_messages_handler", + "litellm.llms.anthropic.pass_through.messages.interceptors.advisor._call_messages_handler", side_effect=mock_handler, ), ): diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_agentic_streaming_iterator.py b/tests/unit/llms/anthropic/pass_through/messages/test_agentic_streaming_iterator.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_agentic_streaming_iterator.py rename to tests/unit/llms/anthropic/pass_through/messages/test_agentic_streaming_iterator.py index 015b5754c6e..16244db04a3 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_agentic_streaming_iterator.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_agentic_streaming_iterator.py @@ -11,7 +11,7 @@ import pytest from litellm.constants import STREAM_SSE_KEEPALIVE_PING_BYTES -from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( SERVER_FULFILLED_TOOL_LEAK_ERROR_SSE_BYTES, AgenticAnthropicStreamingIterator, _handle_content_block_delta, diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py similarity index 94% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py rename to tests/unit/llms/anthropic/pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py index 507467b721f..c3d4dba7376 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py @@ -30,7 +30,7 @@ def test_anthropic_experimental_pass_through_messages_handler(): Test that api key is passed to litellm.responses for OpenAI models. OpenAI and Azure models are routed directly to the Responses API. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -115,7 +115,7 @@ def test_anthropic_experimental_pass_through_messages_handler_dynamic_api_key_an Test that api key, api base, and extra kwargs are forwarded to litellm.completion for Azure models. Azure models are routed through chat/completions (not the Responses API). """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -142,7 +142,7 @@ async def test_anthropic_messages_sanitizes_empty_text_blocks_before_dispatch(): """Regression test for #22930. The unified /v1/messages path must strip empty text blocks before forwarding, otherwise Anthropic returns 400 "text content blocks must be non-empty".""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler msgs = [ { @@ -180,7 +180,7 @@ async def test_anthropic_messages_sanitizes_empty_text_blocks_before_dispatch(): @pytest.mark.asyncio async def test_anthropic_messages_sanitizes_tool_use_ids_before_dispatch(): - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler msgs = [ { @@ -231,7 +231,7 @@ def test_anthropic_experimental_pass_through_messages_handler_custom_llm_provide Provider resolution now happens exactly once, inside litellm.completion itself (BerriAI/litellm#37716), so the handler passes the original unresolved model through. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -315,7 +315,7 @@ def test_openai_model_with_thinking_converts_to_reasoning(): OpenAI models are routed directly to the Responses API, so we verify that litellm.responses() is called with `reasoning` properly set. """ - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -355,7 +355,7 @@ class TestThinkingParameterTransformation: def test_claude_model_preserves_thinking_with_budget_tokens(self): """Test that Claude models get thinking parameter passed through with exact budget_tokens.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -370,7 +370,7 @@ class TestThinkingParameterTransformation: def test_non_claude_model_converts_thinking_to_reasoning_effort(self): """Test that non-Claude models convert thinking to reasoning_effort.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -388,7 +388,7 @@ class TestThinkingParameterTransformation: def test_translate_thinking_for_model_summary_when_enabled(self): """When reasoning_auto_summary is True, summary='detailed' is injected.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -406,7 +406,7 @@ class TestThinkingParameterTransformation: def test_translate_thinking_for_model_preserves_user_summary(self): """User-provided summary is always preserved regardless of flag.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -423,7 +423,7 @@ class TestThinkingSummaryPreservation: def test_thinking_summary_concise_preserved_for_openai(self): """User-provided summary='concise' should not be replaced with 'detailed'.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -439,7 +439,7 @@ class TestThinkingSummaryPreservation: def test_thinking_summary_auto_preserved_for_openai(self): """User-provided summary='auto' should be preserved.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -456,7 +456,7 @@ class TestThinkingSummaryPreservation: def test_summary_added_when_auto_summary_enabled(self): """When reasoning_auto_summary is True, summary='detailed' is added.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -481,7 +481,7 @@ class TestThinkingSummaryPreservation: def test_no_summary_by_default_string_reasoning(self): """By default (reasoning_auto_summary=False), summary is not added for string reasoning_effort.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -504,7 +504,7 @@ class TestThinkingSummaryPreservation: def test_no_summary_by_default_dict_reasoning(self): """By default (reasoning_auto_summary=False), summary is not injected into dict reasoning_effort.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -527,7 +527,7 @@ class TestThinkingSummaryPreservation: def test_summary_added_when_env_var_set(self, monkeypatch): """When LITELLM_REASONING_AUTO_SUMMARY env var is true, summary is added.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -554,7 +554,7 @@ class TestThinkingSummaryPreservation: def test_user_provided_summary_preserved_even_when_flag_off(self): """When user already set summary in dict reasoning_effort, it's preserved regardless of flag.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) @@ -575,7 +575,7 @@ class TestThinkingSummaryPreservation: def test_openai_model_with_thinking_summary_end_to_end(self): """End-to-end: anthropic_messages_handler should preserve thinking.summary for OpenAI models.""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -604,7 +604,7 @@ class TestThinkingSummaryPreservation: def test_responses_adapter_preserves_summary(self): """translate_thinking_to_reasoning should include summary when user provides it.""" - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.transformation import ( + from litellm.llms.anthropic.pass_through.responses_adapters.transformation import ( LiteLLMAnthropicToResponsesAPIAdapter, ) @@ -615,7 +615,7 @@ class TestThinkingSummaryPreservation: def test_responses_adapter_no_summary_by_default(self): """translate_thinking_to_reasoning should not include summary by default (opt-in).""" import litellm - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.transformation import ( + from litellm.llms.anthropic.pass_through.responses_adapters.transformation import ( LiteLLMAnthropicToResponsesAPIAdapter, ) @@ -631,7 +631,7 @@ class TestThinkingSummaryPreservation: def test_translate_thinking_for_model_preserves_summary(self): """translate_thinking_for_model should include summary in reasoning_effort dict when user provides it.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -645,7 +645,7 @@ class TestThinkingSummaryPreservation: def test_translate_thinking_for_model_disabled_stays_plain_string_when_auto_summary_enabled(self): """Disabled thinking must stay a plain string even when reasoning_auto_summary is on.""" import litellm - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -684,7 +684,7 @@ def _empty_block_msgs(): def test_handler_strips_when_no_presanitized_flag(): """Sync entry point (no async wrapper): handler must still sanitize.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler with patch.object( handler, @@ -704,7 +704,7 @@ def test_handler_strips_when_no_presanitized_flag(): def test_handler_skips_strip_when_presanitized(): """Async wrapper already sanitized -> handler must NOT rescan.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler with patch.object( handler, @@ -725,7 +725,7 @@ def test_handler_skips_strip_when_presanitized(): def test_handler_flattens_replayed_unencrypted_web_search_results(): """Synthesized search blocks replayed as history must reach the provider as text.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler captured = {} @@ -780,7 +780,7 @@ def test_handler_flattens_replayed_unencrypted_web_search_results(): def test_presanitized_flag_not_leaked_to_provider_params(): """The private sentinel must be popped, never forwarded as a request param.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler captured = {} @@ -809,7 +809,7 @@ def test_presanitized_flag_not_leaked_to_provider_params(): @pytest.mark.asyncio async def test_async_wrapper_sets_presanitized_and_sanitizes_once(): """End-to-end: wrapper sanitizes (once) AND signals the handler to skip.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler captured = {} @@ -853,7 +853,7 @@ def _gate_stubs(monkeypatch): provider config handed to the native passthrough path and ``translation_calls`` counts hits on the Anthropic->OpenAI translation handlers. """ - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler captured = {} translation_calls = {"count": 0} @@ -883,7 +883,7 @@ def _gate_stubs(monkeypatch): def test_gate_passthrough_when_supported_endpoints_opts_in(monkeypatch): """provider=openai + model_info.supported_endpoints containing /v1/messages must route to the native passthrough config, NOT the translation handlers.""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) from litellm.llms.openai_like.messages.transformation import ( @@ -909,7 +909,7 @@ def test_gate_passthrough_when_supported_endpoints_opts_in(monkeypatch): def test_gate_translates_when_supported_endpoints_absent(monkeypatch): """Default behavior is unchanged: without the /v1/messages opt-in, an openai deployment is translated (Responses API), never passed through natively.""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -931,7 +931,7 @@ def test_gate_translates_when_supported_endpoints_absent(monkeypatch): def test_gate_passthrough_skipped_when_only_chat_completions_supported(monkeypatch): """A deployment that lists only /v1/chat/completions is still translated; the opt-in is specifically the /v1/messages entry.""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -964,7 +964,7 @@ def test_gate_passthrough_forwards_cache_control_ttl_only_when_deployment_opts_i ): """The passthrough config strips cache_control.ttl unless the deployment sets model_info.cache_control_ttl to exactly true.""" - from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( + from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -1275,7 +1275,7 @@ class TestMessagesStreamingSuccessLogging: @pytest.mark.asyncio async def test_responses_bridge_streaming_emits_success_logging(self, capture_success_payloads): """The Responses bridge, which is the default for openai/ deployments.""" - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.handler import ( + from litellm.llms.anthropic.pass_through.responses_adapters.handler import ( LiteLLMMessagesToResponsesAPIHandler, ) @@ -1316,14 +1316,14 @@ class TestMessagesStreamingSuccessLogging: """The chat-completions bridge, reached via litellm.use_chat_completions_url_for_anthropic_messages. Its router lookup is stubbed to what an SDK caller with no proxy running already resolves to.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.handler import ( + from litellm.llms.anthropic.pass_through.adapters.handler import ( LiteLLMMessagesToCompletionTransformationHandler, ) _bind_logging_worker_to_running_loop() with patch( - "litellm.llms.anthropic.experimental_pass_through.adapters.handler._proxy_router_fallback", + "litellm.llms.anthropic.pass_through.adapters.handler._proxy_router_fallback", return_value=None, ): sse_stream = await LiteLLMMessagesToCompletionTransformationHandler.async_anthropic_messages_handler( @@ -1376,7 +1376,7 @@ async def test_anthropic_messages_maps_provider_exception_before_failure_logging The 403 row pins the upstream status on the way through the mapper: Anthropic's documented permission_error must reach the caller as a 403, never as the mapper's APIConnectionError 500 fallthrough.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler capture = _FailureCapture() monkeypatch.setattr(litellm, "callbacks", [capture]) @@ -1418,7 +1418,7 @@ async def test_anthropic_messages_leaves_non_provider_failures_unmapped(): """The mapping boundary is for provider failures only. A request rejected before the provider call (here invalid metadata) must surface as the original exception, not as the mapper's APIConnectionError, whose message embeds a server traceback.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler def upstream_must_not_be_called(request: httpx.Request) -> httpx.Response: raise AssertionError("the provider must not be called for a request rejected locally") @@ -1464,7 +1464,7 @@ def _recording_client(seen_urls: list[str]) -> AsyncHTTPHandler: @pytest.mark.asyncio async def test_provider_messages_api_base_env_is_not_shadowed_by_the_chat_default(monkeypatch): - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler monkeypatch.delenv("DEEPSEEK_API_BASE", raising=False) monkeypatch.setenv("DEEPSEEK_ANTHROPIC_API_BASE", "https://deepseek.internal.example/anthropic") @@ -1483,7 +1483,7 @@ async def test_provider_messages_api_base_env_is_not_shadowed_by_the_chat_defaul @pytest.mark.asyncio async def test_anthropic_messages_forwards_safeguards_and_unknown_beta_to_anthropic(): """Shapes are what Claude Code 2.1.278 sends and api.anthropic.com returns, captured 2026-09-21.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler safeguards = [{"type": "dangerous_tool_use", "classifier_context": {"v": 1, "permission_mode": "auto"}}] client_betas = "dangerous-tool-use-2026-09-03,interleaved-thinking-2025-05-14" @@ -1531,7 +1531,7 @@ async def test_anthropic_messages_forwards_safeguards_and_unknown_beta_to_anthro @pytest.mark.asyncio async def test_anthropic_messages_streaming_forwards_safeguards_and_keeps_safeguard_results(): """Shapes are what Claude Code 2.1.278 sends and api.anthropic.com returns, captured 2026-09-21.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler safeguards = [{"type": "dangerous_tool_use", "classifier_context": {"v": 1, "permission_mode": "auto"}}] tool_verdicts = {"toolu_01": {"type": "evaluated", "outcome": "not_flagged"}} @@ -1632,7 +1632,7 @@ async def test_anthropic_messages_forwards_safeguards_and_dangerous_tool_use_bet local_beta_headers_config, client_headers ): """Bedrock Invoke takes betas in the body's `anthropic_beta` and 400s on `safeguards` without the beta, so the beta rides along with the field.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler safeguards, safeguard_results = _claude_code_auto_mode_request() captured: dict[str, object] = {} @@ -1661,7 +1661,7 @@ async def test_anthropic_messages_forwards_safeguards_and_dangerous_tool_use_bet local_beta_headers_config, client_headers ): """Vertex rawPredict takes the beta as the `anthropic-beta` header and 400s on `safeguards` without it, so the beta rides along with the field.""" - from litellm.llms.anthropic.experimental_pass_through.messages import handler + from litellm.llms.anthropic.pass_through.messages import handler from litellm.llms.vertex_ai.vertex_llm_base import VertexBase safeguards, safeguard_results = _claude_code_auto_mode_request() diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_effort.py b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_effort.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_effort.py rename to tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_effort.py index daaa110e7b9..7885cc69b19 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_effort.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_effort.py @@ -7,7 +7,7 @@ from litellm.constants import ( DEFAULT_REASONING_EFFORT_XHIGH_THINKING_BUDGET, ) from litellm.llms.anthropic.common_utils import AnthropicError -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.openai_like.json_loader import SimpleProviderConfig diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_encrypted_reasoning.py b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_encrypted_reasoning.py similarity index 95% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_encrypted_reasoning.py rename to tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_encrypted_reasoning.py index c64e9d392e5..ca81147da4c 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_encrypted_reasoning.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_encrypted_reasoning.py @@ -1,7 +1,7 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import ( encrypted_reasoning_signature, ) -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_per_turn_control.py b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_per_turn_control.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_per_turn_control.py rename to tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_per_turn_control.py index e80223ca01d..557305a945c 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_per_turn_control.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_per_turn_control.py @@ -2,7 +2,7 @@ import pytest from litellm import anthropic_beta_headers_manager from litellm.anthropic_beta_headers_manager import update_headers_with_filtered_beta -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.openai_like.json_loader import SimpleProviderConfig diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_speed.py similarity index 96% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py rename to tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_speed.py index efd49962ac8..609a9fd73a5 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_speed.py @@ -1,9 +1,9 @@ import litellm import pytest -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) -from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( +from litellm.llms.anthropic.pass_through.messages.utils import ( AnthropicMessagesRequestUtils, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_structured_outputs.py b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_structured_outputs.py similarity index 97% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_structured_outputs.py rename to tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_structured_outputs.py index e6d5c6f4ee1..d1e17590224 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_structured_outputs.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_anthropic_messages_structured_outputs.py @@ -3,7 +3,7 @@ Tests for structured outputs support in Anthropic /v1/messages endpoint. """ import pytest -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_content_after_stop_reason.py b/tests/unit/llms/anthropic/pass_through/messages/test_content_after_stop_reason.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_content_after_stop_reason.py rename to tests/unit/llms/anthropic/pass_through/messages/test_content_after_stop_reason.py index a0d1f9de6ec..7154b10aaca 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_content_after_stop_reason.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_content_after_stop_reason.py @@ -17,7 +17,7 @@ from typing import List import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import Delta, ModelResponseStream, StreamingChoices, Usage diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_mcp_handler.py b/tests/unit/llms/anthropic/pass_through/messages/test_mcp_handler.py similarity index 93% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_mcp_handler.py rename to tests/unit/llms/anthropic/pass_through/messages/test_mcp_handler.py index 93adde12c4b..37db61031c9 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_mcp_handler.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_mcp_handler.py @@ -3,13 +3,13 @@ from unittest.mock import AsyncMock, patch import pytest -from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( +from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) -from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( +from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) -from litellm.llms.anthropic.experimental_pass_through.messages.mcp_handler import ( +from litellm.llms.anthropic.pass_through.messages.mcp_handler import ( _build_tool_result_message, _extract_tool_use_blocks, ) @@ -38,7 +38,7 @@ def test_anthropic_messages_handler_routes_litellm_proxy_mcp_to_the_gateway(): dispatch makes the whole feature unreachable while every unit test still passes. """ with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.mcp_handler.anthropic_messages_with_mcp", + "litellm.llms.anthropic.pass_through.messages.mcp_handler.anthropic_messages_with_mcp", new=AsyncMock(return_value={"routed": True}), ) as routed: result = anthropic_messages_handler( @@ -58,7 +58,7 @@ def test_anthropic_messages_handler_routes_litellm_proxy_mcp_to_the_gateway(): def test_anthropic_messages_handler_skips_the_gateway_on_recursion(): """The gateway's own follow-up call must not re-enter the gateway.""" with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.mcp_handler.anthropic_messages_with_mcp", + "litellm.llms.anthropic.pass_through.messages.mcp_handler.anthropic_messages_with_mcp", new=AsyncMock(return_value={"routed": True}), ) as routed: with pytest.raises(ValueError, match="anthropic_messages_handler is not implemented for sync calls"): @@ -77,7 +77,7 @@ def test_anthropic_messages_handler_skips_the_gateway_on_recursion(): def test_anthropic_messages_handler_leaves_native_tools_alone(): """A plain Anthropic tool is not an MCP reference and must not reach the gateway.""" with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.mcp_handler.anthropic_messages_with_mcp", + "litellm.llms.anthropic.pass_through.messages.mcp_handler.anthropic_messages_with_mcp", new=AsyncMock(return_value={"routed": True}), ) as routed: with pytest.raises(ValueError, match="anthropic_messages_handler is not implemented for sync calls"): @@ -160,7 +160,7 @@ async def test_anthropic_messages_with_mcp_forwards_the_callers_mcp_credentials( token, per-user env) silently returns nothing while the model claims it has no access. Only a no-auth server would look healthy. """ - from litellm.llms.anthropic.experimental_pass_through.messages import mcp_handler + from litellm.llms.anthropic.pass_through.messages import mcp_handler from litellm.responses.mcp.request_context import MCPRequestContext context = MCPRequestContext( @@ -240,7 +240,7 @@ async def test_anthropic_messages_with_mcp_stops_when_every_tool_call_is_skipped Anthropic rejects that, so the caller would get an unhandled 400 from the middle of the loop rather than the model's own answer. """ - from litellm.llms.anthropic.experimental_pass_through.messages import mcp_handler + from litellm.llms.anthropic.pass_through.messages import mcp_handler from litellm.responses.mcp.request_context import MCPRequestContext tool_use_response = { diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_mid_conversation_system.py b/tests/unit/llms/anthropic/pass_through/messages/test_mid_conversation_system.py similarity index 96% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_mid_conversation_system.py rename to tests/unit/llms/anthropic/pass_through/messages/test_mid_conversation_system.py index 40a9f4c2536..f527b4912d5 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_mid_conversation_system.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_mid_conversation_system.py @@ -1,6 +1,6 @@ from collections import Counter -from litellm.llms.anthropic.experimental_pass_through.messages.mid_conversation_system import ( +from litellm.llms.anthropic.pass_through.messages.mid_conversation_system import ( CONVERTED_SYSTEM_NOTE, convert_mid_conversation_system_turns, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_parallel_tool_calls.py b/tests/unit/llms/anthropic/pass_through/messages/test_parallel_tool_calls.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_parallel_tool_calls.py rename to tests/unit/llms/anthropic/pass_through/messages/test_parallel_tool_calls.py index 137286a18c4..45e39a572c5 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_parallel_tool_calls.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_parallel_tool_calls.py @@ -2,7 +2,7 @@ from typing import List -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import ( diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_reasoning_auto_summary_messages.py b/tests/unit/llms/anthropic/pass_through/messages/test_reasoning_auto_summary_messages.py similarity index 96% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_reasoning_auto_summary_messages.py rename to tests/unit/llms/anthropic/pass_through/messages/test_reasoning_auto_summary_messages.py index f478bbb9b50..42c7814e42e 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_reasoning_auto_summary_messages.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_reasoning_auto_summary_messages.py @@ -14,7 +14,7 @@ from unittest.mock import MagicMock, patch import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.handler import ( +from litellm.llms.anthropic.pass_through.messages.handler import ( anthropic_messages_handler, ) @@ -30,10 +30,10 @@ def _call_handler_and_capture_optional_params(thinking=None, **extra_kwargs): captured = {} with patch( - "litellm.llms.anthropic.experimental_pass_through.messages.handler." + "litellm.llms.anthropic.pass_through.messages.handler." "base_llm_http_handler" ) as mock_handler, patch( - "litellm.llms.anthropic.experimental_pass_through.messages.handler." + "litellm.llms.anthropic.pass_through.messages.handler." "ProviderConfigManager" ) as mock_pcm: # Make get_provider_anthropic_messages_config return a non-None config diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_reasoning_effort_translation.py b/tests/unit/llms/anthropic/pass_through/messages/test_reasoning_effort_translation.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_reasoning_effort_translation.py rename to tests/unit/llms/anthropic/pass_through/messages/test_reasoning_effort_translation.py index 7e2fa356685..c1295305c7a 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_reasoning_effort_translation.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_reasoning_effort_translation.py @@ -8,7 +8,7 @@ from litellm.constants import ( DEFAULT_REASONING_EFFORT_XHIGH_THINKING_BUDGET, ) from litellm.llms.anthropic.common_utils import AnthropicError -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation import ( diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_request_optional_param_utils.py b/tests/unit/llms/anthropic/pass_through/messages/test_request_optional_param_utils.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_request_optional_param_utils.py rename to tests/unit/llms/anthropic/pass_through/messages/test_request_optional_param_utils.py index dc2e107928f..dc4da8198cd 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_request_optional_param_utils.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_request_optional_param_utils.py @@ -9,7 +9,7 @@ Regression tests for the /v1/messages request-parse fast paths: import pytest import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.utils import ( +from litellm.llms.anthropic.pass_through.messages.utils import ( AnthropicMessagesRequestUtils, _anthropic_messages_optional_param_keys, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_response_cache.py b/tests/unit/llms/anthropic/pass_through/messages/test_response_cache.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_response_cache.py rename to tests/unit/llms/anthropic/pass_through/messages/test_response_cache.py index aecc84cfcaa..e55e73ed43f 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_response_cache.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_response_cache.py @@ -10,8 +10,8 @@ import litellm from litellm._internal_context import in_post_response_phase from litellm.caching.caching import Cache, LiteLLMCacheType from litellm.caching.caching_handler import LLMCachingHandler -from litellm.llms.anthropic.experimental_pass_through.messages import handler -from litellm.llms.anthropic.experimental_pass_through.messages.response_cache import ( +from litellm.llms.anthropic.pass_through.messages import handler +from litellm.llms.anthropic.pass_through.messages.response_cache import ( AnthropicMessagesStreamCacheWriter, ) @@ -245,7 +245,7 @@ async def test_abandoned_stream_is_not_cached(local_cache, request_kwargs, monke async def test_cached_stream_replay_logs_once_when_polled_after_exhaustion(): from unittest.mock import AsyncMock, MagicMock, patch - from litellm.llms.anthropic.experimental_pass_through.messages.response_cache import ( + from litellm.llms.anthropic.pass_through.messages.response_cache import ( CachedAnthropicMessagesStreamIterator, ) from litellm.proxy.pass_through_endpoints.streaming_handler import ( diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_sse_wrapper.py b/tests/unit/llms/anthropic/pass_through/messages/test_sse_wrapper.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_sse_wrapper.py rename to tests/unit/llms/anthropic/pass_through/messages/test_sse_wrapper.py index bebdbe9f512..92f2dce7331 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_sse_wrapper.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_sse_wrapper.py @@ -3,7 +3,7 @@ import pytest from fastapi.testclient import TestClient -from litellm.llms.anthropic.experimental_pass_through.adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.adapters.streaming_iterator import ( AnthropicStreamWrapper, ) from litellm.types.utils import Delta, ModelResponseStream, StreamingChoices diff --git a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py b/tests/unit/llms/anthropic/pass_through/messages/test_streaming_iterator.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py rename to tests/unit/llms/anthropic/pass_through/messages/test_streaming_iterator.py index 8043496f299..e4efc62f364 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py +++ b/tests/unit/llms/anthropic/pass_through/messages/test_streaming_iterator.py @@ -8,8 +8,8 @@ import pytest from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj -from litellm.llms.anthropic.experimental_pass_through.messages import streaming_iterator as streaming_iterator_module -from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages import streaming_iterator as streaming_iterator_module +from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( INCOMPLETE_STREAM_ERROR_MESSAGE, AnthropicMessagesStreamHiddenParams, AnthropicMessagesStreamingResponse, @@ -1080,7 +1080,7 @@ async def test_abort_upstream_logs_warning_when_aclose_raises(caplog): async def test_enqueue_for_client_returns_false_when_already_detached(): """_enqueue_for_client must return False immediately (without touching the queue) when client_detached is already set before the call.""" - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( BaseAnthropicMessagesStreamingIterator, ) @@ -1097,7 +1097,7 @@ async def test_enqueue_for_client_returns_false_when_already_detached(): async def test_enqueue_for_client_returns_false_when_client_detaches_while_queue_full(): """_enqueue_for_client must return False (and cancel the put) when the queue is full and client_detached fires before space becomes available.""" - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( BaseAnthropicMessagesStreamingIterator, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/__init__.py b/tests/unit/llms/anthropic/pass_through/responses_adapters/__init__.py similarity index 100% rename from tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/__init__.py rename to tests/unit/llms/anthropic/pass_through/responses_adapters/__init__.py diff --git a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_handler.py b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_handler.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_handler.py rename to tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_handler.py index b66075f691b..9daa60bbf88 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_handler.py +++ b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_handler.py @@ -10,7 +10,7 @@ import respx sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../../.."))) import litellm -from litellm.llms.anthropic.experimental_pass_through.responses_adapters.handler import ( +from litellm.llms.anthropic.pass_through.responses_adapters.handler import ( LiteLLMMessagesToResponsesAPIHandler, _build_responses_kwargs, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_streaming_iterator.py b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_streaming_iterator.py similarity index 98% rename from tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_streaming_iterator.py rename to tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_streaming_iterator.py index 392ecc2bcdd..e1dded214bf 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_streaming_iterator.py +++ b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_streaming_iterator.py @@ -1,6 +1,6 @@ """ Tests for AnthropicResponsesStreamWrapper -(litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py) +(litellm/llms/anthropic/pass_through/responses_adapters/streaming_iterator.py) """ import asyncio @@ -18,8 +18,8 @@ from litellm.exceptions import MidStreamFallbackError from litellm.litellm_core_utils.prompt_templates.common_utils import ( encrypted_reasoning_signature, ) -from litellm.llms.anthropic.experimental_pass_through.messages.utils import INCOMPLETE_STREAM_ERROR_MESSAGE -from litellm.llms.anthropic.experimental_pass_through.responses_adapters.streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.utils import INCOMPLETE_STREAM_ERROR_MESSAGE +from litellm.llms.anthropic.pass_through.responses_adapters.streaming_iterator import ( AnthropicResponsesStreamWrapper, ) from litellm.types.llms.openai import ResponseFailedEvent, ResponsesAPIResponse diff --git a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py similarity index 99% rename from tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py rename to tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py index 4ad559aa547..9b6b44c3d05 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py +++ b/tests/unit/llms/anthropic/pass_through/responses_adapters/test_responses_adapters_transformation.py @@ -1,6 +1,6 @@ """ Tests for LiteLLMAnthropicToResponsesAPIAdapter -(litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py) +(litellm/llms/anthropic/pass_through/responses_adapters/transformation.py) """ import json @@ -21,7 +21,7 @@ from litellm.litellm_core_utils.prompt_templates.common_utils import ( TOOL_RESULT_IMAGE_PLACEHOLDER, encrypted_reasoning_signature, ) -from litellm.llms.anthropic.experimental_pass_through.responses_adapters.transformation import ( +from litellm.llms.anthropic.pass_through.responses_adapters.transformation import ( LiteLLMAnthropicToResponsesAPIAdapter, ) from litellm.types.llms.anthropic import ( @@ -2184,7 +2184,7 @@ class TestPromptCacheBreakpointToResponses: assert not _contains_key(items, "prompt_cache_breakpoint") def test_prompt_cache_options_forwarded_to_responses_kwargs(self): - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.handler import ( + from litellm.llms.anthropic.pass_through.responses_adapters.handler import ( _build_responses_kwargs, ) diff --git a/tests/unit/llms/anthropic/experimental_pass_through/test_reasoning_effort_fields.py b/tests/unit/llms/anthropic/pass_through/test_reasoning_effort_fields.py similarity index 96% rename from tests/unit/llms/anthropic/experimental_pass_through/test_reasoning_effort_fields.py rename to tests/unit/llms/anthropic/pass_through/test_reasoning_effort_fields.py index 1c05f0adcf7..e9450d025a6 100644 --- a/tests/unit/llms/anthropic/experimental_pass_through/test_reasoning_effort_fields.py +++ b/tests/unit/llms/anthropic/pass_through/test_reasoning_effort_fields.py @@ -14,7 +14,7 @@ from typing import Any, Dict import pytest import litellm -from litellm.llms.anthropic.experimental_pass_through.utils import ( +from litellm.llms.anthropic.pass_through.utils import ( normalize_reasoning_effort_value, ) from litellm.router_utils.reasoning_effort_capability import ( @@ -156,7 +156,7 @@ class TestAdapterAdaptiveThinking: def test_messages_adapter_adaptive_returns_medium_default(self): """Adaptive thinking returns 'medium' as default reasoning_effort.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -168,7 +168,7 @@ class TestAdapterAdaptiveThinking: def test_messages_adapter_adaptive_overridden_by_output_config(self): """For adaptive thinking, output_config.effort overrides reasoning_effort.""" - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) from litellm.types.llms.anthropic import AnthropicMessagesRequest @@ -191,7 +191,7 @@ class TestAdapterAdaptiveThinking: def test_responses_adapter_adaptive_with_output_config(self): """Responses adapter: adaptive thinking + output_config.effort.""" - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.transformation import ( + from litellm.llms.anthropic.pass_through.responses_adapters.transformation import ( LiteLLMAnthropicToResponsesAPIAdapter, ) @@ -204,7 +204,7 @@ class TestAdapterAdaptiveThinking: def test_responses_adapter_adaptive_default_medium(self): """Responses adapter: adaptive thinking without output_config defaults to medium.""" - from litellm.llms.anthropic.experimental_pass_through.responses_adapters.transformation import ( + from litellm.llms.anthropic.pass_through.responses_adapters.transformation import ( LiteLLMAnthropicToResponsesAPIAdapter, ) diff --git a/tests/unit/llms/anthropic/test_anthropic_common_utils.py b/tests/unit/llms/anthropic/test_anthropic_common_utils.py index 1a21b6d4394..52b53769457 100644 --- a/tests/unit/llms/anthropic/test_anthropic_common_utils.py +++ b/tests/unit/llms/anthropic/test_anthropic_common_utils.py @@ -377,7 +377,7 @@ class TestPassthroughOAuth: def test_passthrough_oauth_no_x_api_key(self): """Passthrough endpoint should not add x-api-key for OAuth tokens.""" - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -400,7 +400,7 @@ class TestPassthroughOAuth: def test_passthrough_regular_key_uses_x_api_key(self): """Passthrough endpoint should still use x-api-key for regular API keys.""" - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -1198,7 +1198,7 @@ class TestPassthroughAuthToken: """Passthrough endpoint should use Bearer auth when only ANTHROPIC_AUTH_TOKEN is set.""" from unittest.mock import patch as mock_patch - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -1222,7 +1222,7 @@ class TestPassthroughAuthToken: """Passthrough endpoint should prefer ANTHROPIC_API_KEY over ANTHROPIC_AUTH_TOKEN.""" from unittest.mock import patch as mock_patch - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -1253,7 +1253,7 @@ class TestPassthroughAuthToken: from unittest.mock import patch as mock_patch import litellm - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -1275,7 +1275,7 @@ class TestPassthroughAuthToken: """A client-forwarded x-api-key header, whatever its casing, should satisfy validation without env credentials.""" from unittest.mock import patch as mock_patch - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -1298,7 +1298,7 @@ class TestPassthroughAuthToken: """get_complete_url should use ANTHROPIC_BASE_URL when api_base is None.""" from unittest.mock import patch as mock_patch - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -1909,7 +1909,7 @@ class TestAnthropicThinkingSignatureSelfHeal: def test_anthropic_messages_config_http_retry_helpers(self): import httpx - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) diff --git a/tests/unit/llms/anthropic/test_anthropic_prompt_cache_prediction.py b/tests/unit/llms/anthropic/test_anthropic_prompt_cache_prediction.py index 62099f97b71..12b81d378c8 100644 --- a/tests/unit/llms/anthropic/test_anthropic_prompt_cache_prediction.py +++ b/tests/unit/llms/anthropic/test_anthropic_prompt_cache_prediction.py @@ -13,7 +13,7 @@ import litellm from litellm.caching.dual_cache import DualCache from litellm.caching.llm_caching_handler import LLMClientCache from litellm.llms.anthropic.count_tokens import handler as count_handler -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import DEFAULT_ANTHROPIC_API_VERSION +from litellm.llms.anthropic.pass_through.messages.transformation import DEFAULT_ANTHROPIC_API_VERSION from litellm.llms.anthropic.prompt_cache_prediction import ( CountedPromptCachePlan, NativePredictionTarget, diff --git a/tests/unit/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py b/tests/unit/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py index f4d51d975bb..79207ece259 100644 --- a/tests/unit/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py +++ b/tests/unit/llms/bedrock/messages/invoke_transformations/test_anthropic_claude3_transformation.py @@ -29,7 +29,7 @@ from litellm.constants import ( DEFAULT_REASONING_EFFORT_MEDIUM_THINKING_BUDGET, DEFAULT_REASONING_EFFORT_XHIGH_THINKING_BUDGET, ) -from litellm.llms.anthropic.experimental_pass_through.messages.mid_conversation_system import ( +from litellm.llms.anthropic.pass_through.messages.mid_conversation_system import ( as_system_content_blocks, ) from litellm.llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation import ( diff --git a/tests/unit/llms/custom_httpx/test_llm_http_handler.py b/tests/unit/llms/custom_httpx/test_llm_http_handler.py index 399e4dbf206..f3332cb513c 100644 --- a/tests/unit/llms/custom_httpx/test_llm_http_handler.py +++ b/tests/unit/llms/custom_httpx/test_llm_http_handler.py @@ -676,7 +676,7 @@ async def test_async_anthropic_messages_handler_streaming_forwards_provider_resp """ from collections.abc import AsyncIterator as ABCAsyncIterator - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -738,10 +738,10 @@ async def test_async_anthropic_messages_handler_agentic_streaming_forwards_provi from collections.abc import AsyncIterator as ABCAsyncIterator from litellm.integrations.custom_logger import CustomLogger - from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( AgenticAnthropicStreamingIterator, ) - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) @@ -809,7 +809,7 @@ async def test_anthropic_messages_streaming_response_aclose_closes_upstream_stre the upstream stream so provider connections are released on client disconnect instead of lingering until garbage collection. """ - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( AnthropicMessagesStreamingResponse, ) @@ -841,10 +841,10 @@ async def test_anthropic_messages_streaming_response_aclose_closes_upstream_stre @pytest.mark.asyncio async def test_anthropic_messages_streaming_response_aclose_closes_agentic_upstream_stream(): - from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( AgenticAnthropicStreamingIterator, ) - from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import ( + from litellm.llms.anthropic.pass_through.messages.streaming_iterator import ( AnthropicMessagesStreamingResponse, ) diff --git a/tests/unit/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py b/tests/unit/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py index 7c5f0483ded..0afe57a001f 100644 --- a/tests/unit/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py +++ b/tests/unit/llms/deepseek/messages/test_deepseek_anthropic_messages_transformation.py @@ -1,5 +1,5 @@ import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.deepseek.messages.transformation import ( diff --git a/tests/unit/llms/github_copilot/messages/test_github_copilot_messages_transformation.py b/tests/unit/llms/github_copilot/messages/test_github_copilot_messages_transformation.py index ed67c33e04c..9d8673ed3d8 100644 --- a/tests/unit/llms/github_copilot/messages/test_github_copilot_messages_transformation.py +++ b/tests/unit/llms/github_copilot/messages/test_github_copilot_messages_transformation.py @@ -308,7 +308,7 @@ def test_github_copilot_config_does_not_handle_web_search_natively(): interception handler short-circuiting Copilot instead of routing to it, even though Copilot now has a BaseAnthropicMessagesConfig. The base Anthropic config (bedrock/vertex/anthropic path) must report True.""" - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) diff --git a/tests/unit/llms/openai_like/messages/test_openai_like_anthropic_messages_transformation.py b/tests/unit/llms/openai_like/messages/test_openai_like_anthropic_messages_transformation.py index 07f06c9084c..9167853bf64 100644 --- a/tests/unit/llms/openai_like/messages/test_openai_like_anthropic_messages_transformation.py +++ b/tests/unit/llms/openai_like/messages/test_openai_like_anthropic_messages_transformation.py @@ -396,7 +396,7 @@ def test_request_defaults_missing_cache_control_type_and_drops_non_dict(config): def test_native_anthropic_config_keeps_cache_control_ttl(): """Anthropic itself accepts ttl, so the normalization must stay scoped to the OpenAI-like passthrough and never reach the native Anthropic path.""" - from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( + from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) diff --git a/tests/unit/llms/tencent/messages/test_tencent_anthropic_messages_transformation.py b/tests/unit/llms/tencent/messages/test_tencent_anthropic_messages_transformation.py index 70c965a6190..e5bdce9d3e0 100644 --- a/tests/unit/llms/tencent/messages/test_tencent_anthropic_messages_transformation.py +++ b/tests/unit/llms/tencent/messages/test_tencent_anthropic_messages_transformation.py @@ -1,5 +1,5 @@ import litellm -from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( +from litellm.llms.anthropic.pass_through.messages.transformation import ( AnthropicMessagesConfig, ) from litellm.llms.tencent.messages.transformation import ( diff --git a/tests/unit/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/unit/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py index 739744336a1..7548f3c2daa 100644 --- a/tests/unit/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py +++ b/tests/unit/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py @@ -11,7 +11,7 @@ from pydantic import BaseModel import litellm from litellm import ModelResponse, completion -from litellm.llms.anthropic.experimental_pass_through.messages import handler as anthropic_messages_handler +from litellm.llms.anthropic.pass_through.messages import handler as anthropic_messages_handler from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler from litellm.llms.gemini.chat.transformation import GoogleAIStudioGeminiConfig from litellm.llms.vertex_ai.common_utils import VertexAIError @@ -6157,7 +6157,7 @@ def test_gemini_candidate_with_finish_reason_no_content_chat_completion(): def test_gemini_candidate_with_finish_reason_no_content_anthropic_messages(): - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) @@ -6230,7 +6230,7 @@ def test_gemini_candidate_with_finish_reason_no_content_responses_api(): def test_gemini_candidate_other_finish_reasons_no_content(): - from litellm.llms.anthropic.experimental_pass_through.adapters.transformation import ( + from litellm.llms.anthropic.pass_through.adapters.transformation import ( LiteLLMAnthropicMessagesAdapter, ) from litellm.responses.litellm_completion_transformation.transformation import ( diff --git a/tests/unit/messages/test_dispatch.py b/tests/unit/messages/test_dispatch.py index 3d5059b200f..bf2f373d35b 100644 --- a/tests/unit/messages/test_dispatch.py +++ b/tests/unit/messages/test_dispatch.py @@ -5,7 +5,7 @@ from typing import Final, cast # noqa: TID251 # narrows legacy callable signat import pytest import litellm -from litellm.llms.anthropic.experimental_pass_through.messages import handler as python_messages +from litellm.llms.anthropic.pass_through.messages import handler as python_messages from litellm.messages.dispatch import ( _ADISPATCH, # pyright: ignore[reportPrivateUsage] # tests configured dispatch _DISPATCH, # pyright: ignore[reportPrivateUsage] # tests configured dispatch diff --git a/tests/unit/rust_bridge/messages/test_secrets.py b/tests/unit/rust_bridge/messages/test_secrets.py index cf37ed0830b..bd5dc97cedd 100644 --- a/tests/unit/rust_bridge/messages/test_secrets.py +++ b/tests/unit/rust_bridge/messages/test_secrets.py @@ -10,7 +10,7 @@ import pytest import litellm from litellm.integrations.custom_secret_manager import CustomSecretManager -from litellm.llms.anthropic.experimental_pass_through.messages.handler import anthropic_messages +from litellm.llms.anthropic.pass_through.messages.handler import anthropic_messages from litellm.rust_bridge import settings from litellm.rust_bridge.messages.entrypoints import NATIVE_AMESSAGES, NATIVE_MESSAGES, LiteLLMMessagesRequest from litellm.types.secret_managers.main import KeyManagementSettings, KeyManagementSystem diff --git a/tests/unit/test_router/test_router.py b/tests/unit/test_router/test_router.py index e99cefb35dd..a55f3c566a2 100644 --- a/tests/unit/test_router/test_router.py +++ b/tests/unit/test_router/test_router.py @@ -29,7 +29,7 @@ from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_logger import CustomLogger from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLogging -from litellm.llms.anthropic.experimental_pass_through.messages.agentic_streaming_iterator import ( +from litellm.llms.anthropic.pass_through.messages.agentic_streaming_iterator import ( SERVER_FULFILLED_TOOL_LEAK_ERROR_SSE_BYTES, ) from litellm.llms.bedrock.common_utils import BedrockError