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_bedrock_sign_request_off_loop

mateo-berri6bfcfdbc5013
diff --cc litellm/llms/bedrock/embed/embedding.py
index e5f94e51e6d,d3725434498..d0e8d734c5e
--- a/litellm/llms/bedrock/embed/embedding.py
+++ b/litellm/llms/bedrock/embed/embedding.py
@@@ -42,20 -41,6 +42,20 @@@ if TYPE_CHECKING
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
+def _sign_get_request(
+ credentials: Credentials, url: str, headers: Mapping[str, str], aws_region_name: str
+) -> AWSPreparedRequest:
+ try:
+ from botocore.auth import SigV4Auth
+ from botocore.awsrequest import AWSRequest
+ except ImportError:
+ raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.")
+
- request: Final = AWSRequest(method="GET", url=url, data=None, headers=dict(headers))
++ request: Final = AWSRequest(method="GET", url=url, data=None, headers=headers)
+ SigV4Auth(credentials, "bedrock", aws_region_name).add_auth(request)
+ return request.prepare()
+
+
class BedrockEmbedding(BaseAWSLLM):
@overload
def _load_credentials(
diff --cc litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
index 6eb7b5d8541,2ea46b740a8..6085bc2bfce
--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
@@@ -1178,25 -1177,6 +1178,25 @@@ async def bedrock_proxy_route
return received_value
+def _sign_aws_json_post(
+ get_credentials: Callable[[], Credentials],
+ service_name: str,
+ aws_region_name: str | None,
+ url: str,
+ body: str,
+ headers: Mapping[str, str],
+) -> AWSPreparedRequest:
+ try:
+ from botocore.auth import SigV4Auth
+ from botocore.awsrequest import AWSRequest
+ except ImportError:
+ raise ImportError(f"Missing boto3 to call {service_name}. Run 'pip install boto3'.")
+
- aws_request: Final = AWSRequest(method="POST", url=url, data=body, headers=dict(headers))
++ aws_request: Final = AWSRequest(method="POST", url=url, data=body, headers=headers)
+ SigV4Auth(get_credentials(), service_name, aws_region_name).add_auth(aws_request)
+ return aws_request.prepare()
+
+
COMPREHEND_MEDICAL_TARGET_PREFIX: Final = "ComprehendMedical_20181030"
diff --cc tests/test_litellm/llms/custom_httpx/test_llm_http_handler.py
index 6799850c4ae,98a5f4b2db5..b5eb98c4ce6
--- a/tests/test_litellm/llms/custom_httpx/test_llm_http_handler.py
+++ b/tests/test_litellm/llms/custom_httpx/test_llm_http_handler.py
@@@ -29,9 -29,7 +29,10 @@@ from litellm.llms.custom_httpx.llm_http
_rust_responses_websocket_enabled,
)
from litellm.llms.azure.videos.transformation import AzureVideoConfig
+from litellm.llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation import (
+ AmazonAnthropicClaudeMessagesConfig,
+)
+ from litellm.llms.mistral.ocr.transformation import MistralOCRConfig
from litellm.llms.openai.videos.transformation import OpenAIVideoConfig
from litellm.types.llms.openai import ResponsesAPIResponse
from litellm.types.router import GenericLiteLLMParams