Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires-python = ">=3.11"
dependencies = [
"uipath>=2.10.19, <2.11.0",
"uipath-core>=0.5.2, <0.6.0",
"uipath-platform>=0.0.27, <0.1.0",
"uipath-platform>=0.1.1, <0.2.0",
"uipath-runtime>=0.9.1, <0.10.0",
"langgraph>=1.0.0, <2.0.0",
"langchain-core>=1.2.11, <2.0.0",
Expand Down
8 changes: 7 additions & 1 deletion src/uipath_langchain/chat/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from langchain_core.messages import BaseMessage
from langchain_core.outputs import ChatGenerationChunk, ChatResult
from tenacity import AsyncRetrying, Retrying
from uipath.platform.common import EndpointManager, resource_override
from uipath.platform.common import EndpointManager, is_ssl_verification_disabled, resource_override

from .http_client import build_uipath_headers, resolve_gateway_url
from .http_client.header_capture import HeaderCapture
Expand Down Expand Up @@ -108,10 +108,15 @@ def _unsigned_config(self, **overrides):
**overrides,
)

def _get_verify(self) -> bool:
"""Return False when SSL verification is disabled, True otherwise."""
return not is_ssl_verification_disabled()

def get_client(self):
session = self._build_session()
client = session.client(
"bedrock-runtime",
verify=self._get_verify(),
config=self._unsigned_config(
retries={"total_max_attempts": 1},
read_timeout=300,
Expand All @@ -129,6 +134,7 @@ def get_bedrock_client(self):
session = self._build_session()
return session.client(
"bedrock",
verify=self._get_verify(),
config=self._unsigned_config(),
)

Expand Down
51 changes: 51 additions & 0 deletions tests/chat/test_bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,57 @@ def test_uipath_chat_bedrock_init_does_not_trigger_credential_resolution(
)


class TestSslVerification:
def test_get_client_verifies_ssl_by_default(self):
passthrough = AwsBedrockCompletionsPassthroughClient(
model="anthropic.claude-haiku-4-5-20251001",
token="test-token",
api_flavor="converse",
)
client = passthrough.get_client()
assert client.meta.endpoint_url.startswith("https")
assert client._endpoint.http_session._verify is True

def test_get_bedrock_client_verifies_ssl_by_default(self):
passthrough = AwsBedrockCompletionsPassthroughClient(
model="anthropic.claude-haiku-4-5-20251001",
token="test-token",
api_flavor="converse",
)
client = passthrough.get_bedrock_client()
assert client._endpoint.http_session._verify is True

@patch.dict(os.environ, {"UIPATH_DISABLE_SSL_VERIFY": "true"})
def test_get_client_disables_ssl_when_env_set(self):
passthrough = AwsBedrockCompletionsPassthroughClient(
model="anthropic.claude-haiku-4-5-20251001",
token="test-token",
api_flavor="converse",
)
client = passthrough.get_client()
assert client._endpoint.http_session._verify is False

@patch.dict(os.environ, {"UIPATH_DISABLE_SSL_VERIFY": "true"})
def test_get_bedrock_client_disables_ssl_when_env_set(self):
passthrough = AwsBedrockCompletionsPassthroughClient(
model="anthropic.claude-haiku-4-5-20251001",
token="test-token",
api_flavor="converse",
)
client = passthrough.get_bedrock_client()
assert client._endpoint.http_session._verify is False

@patch.dict(os.environ, {"UIPATH_DISABLE_SSL_VERIFY": "1"})
def test_get_client_disables_ssl_with_numeric_value(self):
passthrough = AwsBedrockCompletionsPassthroughClient(
model="anthropic.claude-haiku-4-5-20251001",
token="test-token",
api_flavor="converse",
)
client = passthrough.get_client()
assert client._endpoint.http_session._verify is False


class TestConvertFileBlocksToAnthropicDocuments:
def test_converts_pdf_file_block_to_document(self):
messages: list[BaseMessage] = [
Expand Down
20 changes: 10 additions & 10 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading