Skip to content
Merged
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
5 changes: 5 additions & 0 deletions packages/uipath_langchain_client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to `uipath_langchain_client` will be documented in this file.

## [1.12.1] - 2026-05-22

### Changed
- `get_chat_model` once again routes to `UiPathChatAnthropicBedrock` when `api_flavor == ApiFlavor.INVOKE` and discovery reports `modelFamily == AnthropicClaude`. Other INVOKE families still use `UiPathChatBedrock`, and `None`/`CONVERSE` continue to use `UiPathChatBedrockConverse`.

## [1.12.0] - 2026-05-21

### Changed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__title__ = "UiPath LangChain Client"
__description__ = "A Python client for interacting with UiPath's LLM services via LangChain."
__version__ = "1.12.0"
__version__ = "1.12.1"
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ def get_chat_model(
If not provided, auto-detected from the model discovery endpoint.
api_flavor: Vendor-specific API flavor to use. Effects:
- OpenAI: ApiFlavor.RESPONSES sets use_responses_api=True.
- Bedrock: ApiFlavor.INVOKE uses UiPathChatBedrock; otherwise
(None or ApiFlavor.CONVERSE) uses UiPathChatBedrockConverse.
- Bedrock: ApiFlavor.INVOKE with model_family=ANTHROPIC_CLAUDE uses
UiPathChatAnthropicBedrock; ApiFlavor.INVOKE otherwise uses
UiPathChatBedrock; None or ApiFlavor.CONVERSE uses
UiPathChatBedrockConverse.
custom_class: A custom class to use for instantiating the chat model instead of the
auto-detected one. Must be a subclass of UiPathBaseChatModel. When provided,
the factory skips vendor detection and uses this class directly.
Expand Down Expand Up @@ -189,6 +191,19 @@ def get_chat_model(
)
case VendorType.AWSBEDROCK:
if api_flavor == ApiFlavor.INVOKE:
if model_family == ModelFamily.ANTHROPIC_CLAUDE:
from uipath_langchain_client.clients.bedrock.chat_models import (
UiPathChatAnthropicBedrock,
)

return UiPathChatAnthropicBedrock(
model=model_name,
settings=client_settings,
byo_connection_id=byo_connection_id,
model_details=model_details,
**model_kwargs,
)

from uipath_langchain_client.clients.bedrock.chat_models import (
UiPathChatBedrock,
)
Expand Down
46 changes: 42 additions & 4 deletions tests/langchain/features/test_factory_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,11 @@ def test_openai_chat_respects_discovered_byom_chat_completions(


class TestFactoryBedrockApiFlavorRouting:
"""The AWSBEDROCK branch routes purely on ``api_flavor``:
"""The AWSBEDROCK branch routes on ``api_flavor`` and ``model_family``:

- ``ApiFlavor.INVOKE`` -> ``UiPathChatBedrock``
- ``ApiFlavor.INVOKE`` + ``ANTHROPIC_CLAUDE`` -> ``UiPathChatAnthropicBedrock``
- ``ApiFlavor.INVOKE`` (other families) -> ``UiPathChatBedrock``
- ``ApiFlavor.CONVERSE`` or ``None`` -> ``UiPathChatBedrockConverse``

Model family (e.g. ANTHROPIC_CLAUDE) no longer influences the choice.
"""

def _patch_bedrock_classes(self, monkeypatch: pytest.MonkeyPatch) -> dict:
Expand Down Expand Up @@ -217,6 +216,45 @@ def test_invoke_api_flavor_uses_bedrock_invoke(self, monkeypatch: pytest.MonkeyP
)
assert chosen["class"] == "UiPathChatBedrock"

def test_invoke_api_flavor_with_anthropic_claude_uses_anthropic_bedrock(
self, monkeypatch: pytest.MonkeyPatch
):
chosen = self._patch_bedrock_classes(monkeypatch)
settings = self._settings_with_model_info(
{
"modelName": "anthropic.claude-3-5-sonnet-20240620-v1:0",
"vendor": "AwsBedrock",
"apiFlavor": None,
"modelFamily": "AnthropicClaude",
}
)
get_chat_model(
model_name="anthropic.claude-3-5-sonnet-20240620-v1:0",
client_settings=settings,
api_flavor=ApiFlavor.INVOKE,
)
assert chosen["class"] == "UiPathChatAnthropicBedrock"

def test_converse_api_flavor_with_anthropic_claude_still_uses_converse(
self, monkeypatch: pytest.MonkeyPatch
):
"""ANTHROPIC_CLAUDE only diverts to AnthropicBedrock on INVOKE — CONVERSE still wins."""
chosen = self._patch_bedrock_classes(monkeypatch)
settings = self._settings_with_model_info(
{
"modelName": "anthropic.claude-3-5-sonnet-20240620-v1:0",
"vendor": "AwsBedrock",
"apiFlavor": None,
"modelFamily": "AnthropicClaude",
}
)
get_chat_model(
model_name="anthropic.claude-3-5-sonnet-20240620-v1:0",
client_settings=settings,
api_flavor=ApiFlavor.CONVERSE,
)
assert chosen["class"] == "UiPathChatBedrockConverse"


class TestFactoryAgentHubConfig:
"""The ``agenthub_config`` factory kwarg overrides ``client_settings.agenthub_config``
Expand Down
Loading