fix(bedrock/embed): fix reordering of headers

This commit is contained in:
Krrish Dholakia 2024-09-14 18:49:33 -07:00
parent edcda3170c
commit 3507c2698c
3 changed files with 6 additions and 7 deletions

View file

@ -197,7 +197,7 @@ class BedrockEmbedding(BaseAWSLLM):
client=client,
timeout=timeout,
api_base=prepped.url,
headers=dict(prepped.headers),
headers=prepped.headers, # type: ignore
data=data,
)
@ -288,7 +288,7 @@ class BedrockEmbedding(BaseAWSLLM):
client=client,
timeout=timeout,
api_base=prepped.url,
headers=dict(prepped.headers),
headers=prepped.headers, # type: ignore
data=data,
)
@ -454,6 +454,7 @@ class BedrockEmbedding(BaseAWSLLM):
headers = {"Content-Type": "application/json"}
if extra_headers is not None:
headers = {"Content-Type": "application/json", **extra_headers}
request = AWSRequest(
method="POST", url=endpoint_url, data=json.dumps(data), headers=headers
)
@ -478,5 +479,5 @@ class BedrockEmbedding(BaseAWSLLM):
aembedding=aembedding,
timeout=timeout,
client=client,
headers=dict(prepped.headers),
headers=prepped.headers, # type: ignore
)

View file

@ -214,7 +214,7 @@ async def bedrock_proxy_route(
endpoint_func = create_pass_through_route(
endpoint=endpoint,
target=str(prepped.url),
custom_headers=dict(prepped.headers),
custom_headers=prepped.headers, # type: ignore
) # dynamically construct pass-through endpoint based on incoming path
received_value = await endpoint_func(
request,

View file

@ -8153,9 +8153,7 @@ def exception_type(
exception_mapping_worked = True
if hasattr(original_exception, "request"):
raise APIConnectionError(
message="{}\n{}".format(
str(original_exception), traceback.format_exc()
),
message="{} - {}".format(exception_provider, error_str),
llm_provider=custom_llm_provider,
model=model,
request=original_exception.request,