From 8c9250893464aad4435c457f5b0b49999e0413f2 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 24 May 2024 22:55:55 -0700 Subject: [PATCH] fix(bedrock_httpx.py): support 'modelId' param for bedrock ptu's Fixes https://github.com/BerriAI/litellm/issues/3805 --- litellm/llms/bedrock_httpx.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litellm/llms/bedrock_httpx.py b/litellm/llms/bedrock_httpx.py index 5fe0e0cc17f..2fd7147222b 100644 --- a/litellm/llms/bedrock_httpx.py +++ b/litellm/llms/bedrock_httpx.py @@ -552,6 +552,7 @@ class BedrockLLM(BaseLLM): ## SETUP ## stream = optional_params.pop("stream", None) + modelId = optional_params.pop("model_id", None) or model provider = model.split(".")[0] ## CREDENTIALS ## @@ -609,9 +610,9 @@ class BedrockLLM(BaseLLM): endpoint_url = f"https://bedrock-runtime.{aws_region_name}.amazonaws.com" if (stream is not None and stream == True) and provider != "ai21": - endpoint_url = f"{endpoint_url}/model/{model}/invoke-with-response-stream" + endpoint_url = f"{endpoint_url}/model/{modelId}/invoke-with-response-stream" else: - endpoint_url = f"{endpoint_url}/model/{model}/invoke" + endpoint_url = f"{endpoint_url}/model/{modelId}/invoke" sigv4 = SigV4Auth(credentials, "bedrock", aws_region_name)