Skip to content

Commit dcce0ab

Browse files
committed
feat: added new uipath_langchain_client and refactor code base to use it
1 parent dd572e4 commit dcce0ab

File tree

36 files changed

+1382
-3755
lines changed

36 files changed

+1382
-3755
lines changed

pyproject.toml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.8.5"
3+
version = "1.0.0"
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"
@@ -12,7 +12,6 @@ dependencies = [
1212
"langgraph>=1.0.0, <2.0.0",
1313
"langchain-core>=1.2.11, <2.0.0",
1414
"langgraph-checkpoint-sqlite>=3.0.3, <4.0.0",
15-
"langchain-openai>=1.0.0, <2.0.0",
1615
"langchain>=1.0.0, <2.0.0",
1716
"pydantic-settings>=2.6.0",
1817
"python-dotenv>=1.0.1",
@@ -22,6 +21,7 @@ dependencies = [
2221
"jsonpath-ng>=1.7.0",
2322
"mcp==1.26.0",
2423
"langchain-mcp-adapters==0.2.1",
24+
"uipath-langchain-client[openai]>=1.2.7",
2525
]
2626

2727
classifiers = [
@@ -37,8 +37,19 @@ maintainers = [
3737
]
3838

3939
[project.optional-dependencies]
40-
vertex = ["langchain-google-genai>=2.0.0", "google-generativeai>=0.8.0"]
41-
bedrock = ["langchain-aws>=0.2.35", "boto3-stubs>=1.41.4"]
40+
anthropic = [
41+
"uipath-langchain-client[anthropic]>=1.2.7",
42+
]
43+
vertex = [
44+
"uipath-langchain-client[google]>=1.2.7",
45+
"uipath-langchain-client[vertexai]>=1.2.7",
46+
]
47+
bedrock = [
48+
"uipath-langchain-client[aws]>=1.2.7",
49+
]
50+
all = [
51+
"uipath-langchain-client[all]>=1.2.7",
52+
]
4253

4354
[project.entry-points."uipath.middlewares"]
4455
register = "uipath_langchain.middlewares:register_middleware"

samples/chat-hitl-agent/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from langchain_anthropic import ChatAnthropic
22
from langchain_tavily import TavilySearch
33
from langchain.agents import create_agent
4-
from uipath_langchain.chat import requires_approval
4+
from uipath_langchain.agent.tools.hitl import requires_approval
55

66
tavily_tool = TavilySearch(max_results=5)
77

samples/oauth-external-apps-agent/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from langchain.agents import create_agent
1111
from langchain.messages import SystemMessage, HumanMessage
1212

13-
from uipath_langchain.chat.models import UiPathChat
13+
from uipath_langchain.chat import UiPathChat
1414
from langchain_mcp_adapters.tools import load_mcp_tools
1515
from mcp import ClientSession
1616
from mcp.client.streamable_http import streamablehttp_client

samples/retrieval-chain/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from langchain_core.prompts import ChatPromptTemplate
1212
from langchain_core.runnables import RunnablePassthrough
1313
from langchain_core.vectorstores import VectorStore
14-
from uipath_langchain.chat.models import UiPathAzureChatOpenAI
14+
from uipath_langchain.chat import UiPathAzureChatOpenAI
1515
from uipath_langchain.vectorstores.context_grounding_vectorstore import (
1616
ContextGroundingVectorStore,
1717
)

src/uipath_langchain/chat/__init__.py

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,63 @@
1111
Instead, all exports are loaded on-demand when first accessed.
1212
"""
1313

14+
from .chat_model_factory import get_chat_model
1415

15-
def __getattr__(name):
16-
if name == "UiPathAzureChatOpenAI":
17-
from .models import UiPathAzureChatOpenAI
1816

19-
return UiPathAzureChatOpenAI
17+
def __getattr__(name):
2018
if name == "UiPathChat":
21-
from .models import UiPathChat
19+
from uipath_langchain_client.clients.normalized.chat_models import (
20+
UiPathChat,
21+
)
2222

2323
return UiPathChat
24+
if name == "UiPathAzureChatOpenAI":
25+
from uipath_langchain_client.clients.openai.chat_models import (
26+
UiPathAzureChatOpenAI,
27+
)
28+
29+
return UiPathAzureChatOpenAI
2430
if name == "UiPathChatOpenAI":
25-
from .openai import UiPathChatOpenAI
31+
from uipath_langchain_client.clients.openai.chat_models import (
32+
UiPathChatOpenAI,
33+
)
2634

2735
return UiPathChatOpenAI
28-
if name == "requires_approval":
29-
from .hitl import requires_approval
36+
if name == "UiPathChatGoogleGenerativeAI":
37+
from uipath_langchain_client.clients.google.chat_models import (
38+
UiPathChatGoogleGenerativeAI,
39+
)
40+
41+
return UiPathChatGoogleGenerativeAI
42+
if name == "UiPathChatBedrock":
43+
from uipath_langchain_client.clients.bedrock.chat_models import (
44+
UiPathChatBedrock,
45+
)
46+
47+
return UiPathChatBedrock
48+
if name == "UiPathChatBedrockConverse":
49+
from uipath_langchain_client.clients.bedrock.chat_models import (
50+
UiPathChatBedrockConverse,
51+
)
3052

31-
return requires_approval
32-
if name in ("OpenAIModels", "BedrockModels", "GeminiModels"):
33-
from . import supported_models
53+
return UiPathChatBedrockConverse
54+
if name == "UiPathChatAnthropic":
55+
from uipath_langchain_client.clients.anthropic.chat_models import (
56+
UiPathChatAnthropic,
57+
)
3458

35-
return getattr(supported_models, name)
36-
if name in ("LLMProvider", "APIFlavor"):
37-
from . import types
59+
return UiPathChatAnthropic
3860

39-
return getattr(types, name)
4061
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
4162

4263

4364
__all__ = [
65+
"get_chat_model",
4466
"UiPathChat",
4567
"UiPathAzureChatOpenAI",
4668
"UiPathChatOpenAI",
47-
"OpenAIModels",
48-
"BedrockModels",
49-
"GeminiModels",
50-
"requires_approval",
51-
"LLMProvider",
52-
"APIFlavor",
69+
"UiPathChatGoogleGenerativeAI",
70+
"UiPathChatBedrock",
71+
"UiPathChatBedrockConverse",
72+
"UiPathChatAnthropic",
5373
]

0 commit comments

Comments
 (0)