Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_decrease_anys_opus5_r4

mateo-berri066652c19409
diff --cc litellm/a2a_protocol/providers/bedrock_agentcore/transformation.py
index 4c5abf596cb,1e8cc4ff90e..9fa9db48af8
--- a/litellm/a2a_protocol/providers/bedrock_agentcore/transformation.py
+++ b/litellm/a2a_protocol/providers/bedrock_agentcore/transformation.py
@@@ -7,11 -7,22 +7,22 @@@ and signs requests via AmazonAgentCoreC
import json
from collections.abc import AsyncIterator, Mapping
-from typing import Any, Final
+from typing import Any, Final, Protocol
from litellm._logging import verbose_logger
+ from litellm.a2a_protocol.litellm_completion_bridge.handler import (
+ A2A_USER_API_KEY_HASH_PARAM,
+ )
+ from litellm.a2a_protocol.utils import (
+ get_session_id_from_a2a_params,
+ scope_session_to_principal,
+ )
+ from litellm.exceptions import BadRequestError
from litellm.llms.bedrock.chat.agentcore.transformation import AmazonAgentCoreConfig
+ RUNTIME_SESSION_ID_MIN_LENGTH: Final = 33
+ RUNTIME_SESSION_ID_MAX_LENGTH: Final = 256
+
# Reserved outbound header names that must never be sourced from per-request
# ``agent_extra_headers`` for AgentCore requests. ``agent_extra_headers`` carries
# values rewritten from the client-controlled ``x-a2a-{agent}-*`` convention, so
diff --cc litellm/llms/azure_ai/vector_stores/transformation.py
index 6db8c6a6c9f,64e72b819b1..04434670302
--- a/litellm/llms/azure_ai/vector_stores/transformation.py
+++ b/litellm/llms/azure_ai/vector_stores/transformation.py
@@@ -115,8 -115,9 +116,9 @@@ class AzureAIVectorStoreConfig(BaseVect
api_base: str,
litellm_logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
- extra_body: dict[str, Any] | None = None,
+ extra_body: Mapping[str, object] | None = None,
+ router: "Router | None" = None,
- ) -> tuple[str, dict[str, Any]]:
+ ) -> tuple[str, dict[str, object]]:
"""
Transform search request for Azure AI Search API
diff --cc litellm/llms/milvus/vector_stores/transformation.py
index 0e96b3577fd,c3581abfbcc..6175ded46d6
--- a/litellm/llms/milvus/vector_stores/transformation.py
+++ b/litellm/llms/milvus/vector_stores/transformation.py
@@@ -123,8 -123,9 +124,9 @@@ class MilvusVectorStoreConfig(BaseVecto
api_base: str,
litellm_logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
- extra_body: dict[str, Any] | None = None,
+ extra_body: Mapping[str, object] | None = None,
+ router: "Router | None" = None,
- ) -> tuple[str, dict[str, Any]]:
+ ) -> tuple[str, dict[str, object]]:
"""
Transform search request for Azure AI Search API
diff --cc litellm/llms/openai/vector_stores/transformation.py
index 125e5168c69,4e925494039..923ccca85f6
--- a/litellm/llms/openai/vector_stores/transformation.py
+++ b/litellm/llms/openai/vector_stores/transformation.py
@@@ -98,7 -99,8 +99,8 @@@ class OpenAIVectorStoreConfig(BaseVecto
api_base: str,
litellm_logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
- extra_body: dict[str, Any] | None = None,
+ extra_body: dict[str, object] | None = None,
+ router: "Router | None" = None,
) -> tuple[str, dict]:
encoded_vector_store_id: Final = encode_url_path_segment(vector_store_id, field_name="vector_store_id")
url: Final = f"{api_base}/{encoded_vector_store_id}/search"
diff --cc litellm/llms/ragflow/vector_stores/transformation.py
index 38a06a37f7e,ffa6c9e1076..6892f5ed879
--- a/litellm/llms/ragflow/vector_stores/transformation.py
+++ b/litellm/llms/ragflow/vector_stores/transformation.py
@@@ -92,7 -92,8 +93,8 @@@ class RAGFlowVectorStoreConfig(BaseVect
api_base: str,
litellm_logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
- extra_body: dict[str, Any] | None = None,
+ extra_body: Mapping[str, object] | None = None,
+ router: "Router | None" = None,
) -> tuple[str, dict]:
"""RAGFlow vector stores are management-only, search is not supported."""
raise NotImplementedError("RAGFlow vector stores support dataset management only, not search/retrieval")
diff --cc litellm/proxy/container_endpoints/endpoints.py
index 85ef469ee69,eaa3db336a9..68ef177feba
--- a/litellm/proxy/container_endpoints/endpoints.py
+++ b/litellm/proxy/container_endpoints/endpoints.py
@@@ -208,7 -208,7 +208,7 @@@ async def list_containers
# Read query parameters
query_params: Final = dict(request.query_params)
- data: Final[dict[str, object]] = {"query_params": query_params}
- data: Final[dict[str, Any]] = {"query_params": query_params, "model": query_params.get("model")}
++ data: Final[dict[str, object]] = {"query_params": query_params, "model": query_params.get("model")}
# Extract custom_llm_provider using priority chain
custom_llm_provider: Final = (
diff --cc litellm/proxy/db/exception_handler.py
index f7362d3b809,ef1c4a66203..19bddee618b
--- a/litellm/proxy/db/exception_handler.py
+++ b/litellm/proxy/db/exception_handler.py
@@@ -202,9 -235,9 +235,9 @@@ class PrismaDBExceptionHandler
"""
import prisma
- if isinstance(e, prisma.errors.PrismaError):
+ if isinstance(e, _exception_types(prisma.errors.PrismaError)):
return False
- tb = getattr(e, "__traceback__", None)
+ tb = e.__traceback__ if hasattr(e, "__traceback__") else None
while tb is not None:
if tb.tb_frame.f_globals.get("__name__", "").startswith("prisma.engine"):
return True