Skip to content

Commit 8fecff6

Browse files
chore: use botocore.UNSIGNED to prevent IMDS timeout in bedrock (#692)
1 parent ad49d48 commit 8fecff6

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.8.22"
3+
version = "0.8.23"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath_langchain/chat/bedrock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def get_client(self):
108108
"total_max_attempts": 1,
109109
},
110110
read_timeout=300,
111+
signature_version=botocore.UNSIGNED,
111112
),
112113
)
113114
client.meta.events.register(

tests/chat/test_bedrock.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1+
import logging
12
import os
23
from unittest.mock import patch
34

5+
import botocore
46
from langchain_aws import ChatBedrock
57
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
68
from langchain_core.messages.content import create_file_block
79
from langchain_core.outputs import ChatGeneration, ChatResult
810

9-
from uipath_langchain.chat.bedrock import UiPathChatBedrock
11+
from uipath_langchain.chat.bedrock import (
12+
AwsBedrockCompletionsPassthroughClient,
13+
UiPathChatBedrock,
14+
)
15+
16+
17+
class TestGetClientSkipsImds:
18+
def test_client_creation_does_not_trigger_credential_resolution(self, caplog):
19+
passthrough = AwsBedrockCompletionsPassthroughClient(
20+
model="anthropic.claude-haiku-4-5-20251001",
21+
token="test-token",
22+
api_flavor="converse",
23+
)
24+
25+
with caplog.at_level(logging.DEBUG, logger="botocore"):
26+
client = passthrough.get_client()
27+
28+
assert caplog.records
29+
credential_log_records = [
30+
r for r in caplog.records if r.name.startswith("botocore.credentials")
31+
]
32+
assert not credential_log_records, (
33+
f"Unexpected credential resolution: {[r.getMessage() for r in credential_log_records]}"
34+
)
35+
assert client._request_signer._signature_version == botocore.UNSIGNED
1036

1137

1238
class TestConvertFileBlocksToAnthropicDocuments:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)