uipath-langchain 0.0.115__py3-none-any.whl → 0.0.117__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of uipath-langchain might be problematic. Click here for more details.
- uipath_langchain/_cli/_runtime/_context.py +1 -1
- uipath_langchain/_cli/_runtime/_runtime.py +3 -1
- uipath_langchain/_cli/_utils/_graph.py +6 -2
- uipath_langchain/_cli/cli_init.py +3 -1
- uipath_langchain/_utils/_request_mixin.py +9 -2
- uipath_langchain/_utils/_settings.py +0 -9
- uipath_langchain/chat/models.py +22 -3
- uipath_langchain/embeddings/embeddings.py +7 -4
- {uipath_langchain-0.0.115.dist-info → uipath_langchain-0.0.117.dist-info}/METADATA +2 -2
- {uipath_langchain-0.0.115.dist-info → uipath_langchain-0.0.117.dist-info}/RECORD +13 -13
- {uipath_langchain-0.0.115.dist-info → uipath_langchain-0.0.117.dist-info}/WHEEL +0 -0
- {uipath_langchain-0.0.115.dist-info → uipath_langchain-0.0.117.dist-info}/entry_points.txt +0 -0
- {uipath_langchain-0.0.115.dist-info → uipath_langchain-0.0.117.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,7 +11,7 @@ class LangGraphRuntimeContext(UiPathRuntimeContext):
|
|
|
11
11
|
"""Context information passed throughout the runtime execution."""
|
|
12
12
|
|
|
13
13
|
langgraph_config: Optional[LangGraphConfig] = None
|
|
14
|
-
state_graph: Optional[StateGraph] = None
|
|
14
|
+
state_graph: Optional[StateGraph[Any, Any]] = None
|
|
15
15
|
output: Optional[Any] = None
|
|
16
16
|
state: Optional[Any] = (
|
|
17
17
|
None # TypedDict issue, the actual type is: Optional[langgraph.types.StateSnapshot]
|
|
@@ -271,7 +271,9 @@ class LangGraphRuntime(UiPathBaseRuntime):
|
|
|
271
271
|
if hasattr(self, "graph_config") and self.graph_config:
|
|
272
272
|
await self.graph_config.cleanup()
|
|
273
273
|
|
|
274
|
-
def _extract_graph_result(
|
|
274
|
+
def _extract_graph_result(
|
|
275
|
+
self, final_chunk, graph: CompiledStateGraph[Any, Any, Any]
|
|
276
|
+
):
|
|
275
277
|
"""
|
|
276
278
|
Extract the result from a LangGraph output chunk according to the graph's output channels.
|
|
277
279
|
|
|
@@ -21,14 +21,18 @@ class GraphConfig:
|
|
|
21
21
|
path: str
|
|
22
22
|
file_path: str
|
|
23
23
|
graph_var: str
|
|
24
|
-
_graph: Optional[Union[StateGraph, CompiledStateGraph]] =
|
|
24
|
+
_graph: Optional[Union[StateGraph[Any, Any], CompiledStateGraph[Any, Any, Any]]] = (
|
|
25
|
+
None
|
|
26
|
+
)
|
|
25
27
|
|
|
26
28
|
@classmethod
|
|
27
29
|
def from_config(cls, name: str, path: str) -> "GraphConfig":
|
|
28
30
|
file_path, graph_var = path.split(":")
|
|
29
31
|
return cls(name=name, path=path, file_path=file_path, graph_var=graph_var)
|
|
30
32
|
|
|
31
|
-
async def load_graph(
|
|
33
|
+
async def load_graph(
|
|
34
|
+
self,
|
|
35
|
+
) -> Union[StateGraph[Any, Any], CompiledStateGraph[Any, Any, Any]]:
|
|
32
36
|
"""Load graph from the specified path"""
|
|
33
37
|
try:
|
|
34
38
|
cwd = os.path.abspath(os.getcwd())
|
|
@@ -54,7 +54,9 @@ def process_nullable_types(
|
|
|
54
54
|
return schema
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def generate_schema_from_graph(
|
|
57
|
+
def generate_schema_from_graph(
|
|
58
|
+
graph: CompiledStateGraph[Any, Any, Any],
|
|
59
|
+
) -> Dict[str, Any]:
|
|
58
60
|
"""Extract input/output schema from a LangGraph graph"""
|
|
59
61
|
schema = {
|
|
60
62
|
"input": {"type": "object", "properties": {}, "required": []},
|
|
@@ -17,6 +17,7 @@ from tenacity import (
|
|
|
17
17
|
stop_after_attempt,
|
|
18
18
|
wait_exponential_jitter,
|
|
19
19
|
)
|
|
20
|
+
from uipath._utils._ssl_context import get_httpx_client_kwargs
|
|
20
21
|
|
|
21
22
|
from uipath_langchain._utils._settings import (
|
|
22
23
|
UiPathClientFactorySettings,
|
|
@@ -39,6 +40,8 @@ class UiPathRequestMixin(BaseModel):
|
|
|
39
40
|
|
|
40
41
|
default_headers: Optional[Mapping[str, str]] = {
|
|
41
42
|
"X-UiPath-Streaming-Enabled": "false",
|
|
43
|
+
"X-UiPath-JobKey": os.getenv("UIPATH_JOB_KEY", ""),
|
|
44
|
+
"X-UiPath-ProcessKey": os.getenv("UIPATH_PROCESS_KEY", ""),
|
|
42
45
|
}
|
|
43
46
|
model_name: Optional[str] = Field(
|
|
44
47
|
default_factory=lambda: os.getenv("UIPATH_MODEL_NAME", "gpt-4o-2024-08-06"),
|
|
@@ -135,11 +138,13 @@ class UiPathRequestMixin(BaseModel):
|
|
|
135
138
|
"""Run an asynchronous call to the LLM."""
|
|
136
139
|
# if self.logger:
|
|
137
140
|
# self.logger.info(f"Completion request: {request_body['messages'][:2]}")
|
|
141
|
+
client_kwargs = get_httpx_client_kwargs()
|
|
138
142
|
with httpx.Client(
|
|
143
|
+
**client_kwargs, # Apply SSL configuration
|
|
139
144
|
event_hooks={
|
|
140
145
|
"request": [self._log_request_duration],
|
|
141
146
|
"response": [self._log_response_duration],
|
|
142
|
-
}
|
|
147
|
+
},
|
|
143
148
|
) as client:
|
|
144
149
|
response = client.post(
|
|
145
150
|
url,
|
|
@@ -212,11 +217,13 @@ class UiPathRequestMixin(BaseModel):
|
|
|
212
217
|
) -> Dict[str, Any]:
|
|
213
218
|
# if self.logger:
|
|
214
219
|
# self.logger.info(f"Completion request: {request_body['messages'][:2]}")
|
|
220
|
+
client_kwargs = get_httpx_client_kwargs()
|
|
215
221
|
async with httpx.AsyncClient(
|
|
222
|
+
**client_kwargs, # Apply SSL configuration
|
|
216
223
|
event_hooks={
|
|
217
224
|
"request": [self._alog_request_duration],
|
|
218
225
|
"response": [self._alog_response_duration],
|
|
219
|
-
}
|
|
226
|
+
},
|
|
220
227
|
) as client:
|
|
221
228
|
response = await client.post(
|
|
222
229
|
url,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# mypy: disable-error-code="syntax"
|
|
2
2
|
import os
|
|
3
|
-
from enum import Enum
|
|
4
3
|
from typing import Any, Optional
|
|
5
4
|
|
|
6
5
|
import httpx
|
|
@@ -47,14 +46,6 @@ class UiPathClientSettings(BaseSettings):
|
|
|
47
46
|
action_id: str = Field(default="DefaultActionId", alias="UIPATH_ACTION_ID")
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
class UiPathEndpoints(Enum):
|
|
51
|
-
NORMALIZED_COMPLETION_ENDPOINT = "llmgateway_/api/chat/completions"
|
|
52
|
-
PASSTHROUGH_COMPLETION_ENDPOINT = "llmgateway_/openai/deployments/{model}/chat/completions?api-version={api_version}"
|
|
53
|
-
EMBEDDING_ENDPOINT = (
|
|
54
|
-
"llmgateway_/openai/deployments/{model}/embeddings?api-version={api_version}"
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
|
|
58
49
|
def get_uipath_token_header(
|
|
59
50
|
settings: Any = None,
|
|
60
51
|
) -> str:
|
uipath_langchain/chat/models.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import logging
|
|
3
|
+
from os import environ as env
|
|
2
4
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
3
5
|
|
|
4
6
|
from langchain_core.callbacks import (
|
|
@@ -12,9 +14,11 @@ from langchain_core.outputs import ChatGeneration, ChatResult
|
|
|
12
14
|
from langchain_core.runnables import Runnable
|
|
13
15
|
from langchain_openai.chat_models import AzureChatOpenAI
|
|
14
16
|
from pydantic import BaseModel
|
|
17
|
+
from uipath.utils import EndpointManager
|
|
15
18
|
|
|
16
19
|
from uipath_langchain._utils._request_mixin import UiPathRequestMixin
|
|
17
|
-
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
class UiPathAzureChatOpenAI(UiPathRequestMixin, AzureChatOpenAI):
|
|
@@ -71,7 +75,9 @@ class UiPathAzureChatOpenAI(UiPathRequestMixin, AzureChatOpenAI):
|
|
|
71
75
|
|
|
72
76
|
@property
|
|
73
77
|
def endpoint(self) -> str:
|
|
74
|
-
|
|
78
|
+
endpoint = EndpointManager.get_passthrough_endpoint()
|
|
79
|
+
logger.debug("Using endpoint: %s", endpoint)
|
|
80
|
+
return endpoint.format(
|
|
75
81
|
model=self.model_name, api_version=self.openai_api_version
|
|
76
82
|
)
|
|
77
83
|
|
|
@@ -79,6 +85,15 @@ class UiPathAzureChatOpenAI(UiPathRequestMixin, AzureChatOpenAI):
|
|
|
79
85
|
class UiPathChat(UiPathRequestMixin, AzureChatOpenAI):
|
|
80
86
|
"""Custom LLM connector for LangChain integration with UiPath Normalized."""
|
|
81
87
|
|
|
88
|
+
def __init__(self, *args: Any, **kwargs: Any):
|
|
89
|
+
"""Initialize the UiPath Azure Chat OpenAI model."""
|
|
90
|
+
|
|
91
|
+
super().__init__(*args, **kwargs)
|
|
92
|
+
self.default_headers = {
|
|
93
|
+
"X-UiPath-JobKey": env.get("UIPATH_JOB_KEY", ""),
|
|
94
|
+
"X-UiPath-ProcessKey": env.get("UIPATH_PROCESS_KEY", ""),
|
|
95
|
+
}
|
|
96
|
+
|
|
82
97
|
def _create_chat_result(
|
|
83
98
|
self,
|
|
84
99
|
response: Union[Dict[str, Any], BaseModel],
|
|
@@ -252,7 +267,11 @@ class UiPathChat(UiPathRequestMixin, AzureChatOpenAI):
|
|
|
252
267
|
|
|
253
268
|
@property
|
|
254
269
|
def endpoint(self) -> str:
|
|
255
|
-
|
|
270
|
+
endpoint = EndpointManager.get_passthrough_endpoint()
|
|
271
|
+
logger.debug("Using endpoint: %s", endpoint)
|
|
272
|
+
return endpoint.format(
|
|
273
|
+
model=self.model_name, api_version=self.openai_api_version
|
|
274
|
+
)
|
|
256
275
|
|
|
257
276
|
@property
|
|
258
277
|
def is_normalized(self) -> bool:
|
|
@@ -5,9 +5,9 @@ import httpx
|
|
|
5
5
|
from langchain_community.callbacks.manager import openai_callback_var
|
|
6
6
|
from langchain_openai.embeddings import AzureOpenAIEmbeddings, OpenAIEmbeddings
|
|
7
7
|
from pydantic import Field
|
|
8
|
+
from uipath.utils import EndpointManager
|
|
8
9
|
|
|
9
10
|
from uipath_langchain._utils._request_mixin import UiPathRequestMixin
|
|
10
|
-
from uipath_langchain._utils._settings import UiPathEndpoints
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class UiPathAzureOpenAIEmbeddings(UiPathRequestMixin, AzureOpenAIEmbeddings):
|
|
@@ -43,7 +43,8 @@ class UiPathAzureOpenAIEmbeddings(UiPathRequestMixin, AzureOpenAIEmbeddings):
|
|
|
43
43
|
|
|
44
44
|
@property
|
|
45
45
|
def endpoint(self) -> str:
|
|
46
|
-
|
|
46
|
+
endpoint = EndpointManager.get_embeddings_endpoint()
|
|
47
|
+
return endpoint.format(
|
|
47
48
|
model=self.model_name, api_version=self.openai_api_version
|
|
48
49
|
)
|
|
49
50
|
|
|
@@ -59,7 +60,7 @@ class UiPathOpenAIEmbeddings(UiPathRequestMixin, OpenAIEmbeddings):
|
|
|
59
60
|
)
|
|
60
61
|
|
|
61
62
|
def embed_documents(
|
|
62
|
-
self, texts: List[str], chunk_size: Optional[int] = None
|
|
63
|
+
self, texts: List[str], chunk_size: Optional[int] = None, **kwargs
|
|
63
64
|
) -> List[List[float]]:
|
|
64
65
|
"""Embed a list of documents using the UiPath."""
|
|
65
66
|
embeddings = []
|
|
@@ -83,6 +84,7 @@ class UiPathOpenAIEmbeddings(UiPathRequestMixin, OpenAIEmbeddings):
|
|
|
83
84
|
self,
|
|
84
85
|
texts: List[str],
|
|
85
86
|
chunk_size: Optional[int] = None,
|
|
87
|
+
**kwargs,
|
|
86
88
|
) -> List[List[float]]:
|
|
87
89
|
"""Async version of embed_documents."""
|
|
88
90
|
embeddings = []
|
|
@@ -104,6 +106,7 @@ class UiPathOpenAIEmbeddings(UiPathRequestMixin, OpenAIEmbeddings):
|
|
|
104
106
|
|
|
105
107
|
@property
|
|
106
108
|
def endpoint(self) -> str:
|
|
107
|
-
|
|
109
|
+
endpoint = EndpointManager.get_embeddings_endpoint()
|
|
110
|
+
return endpoint.format(
|
|
108
111
|
model=self.model_name, api_version=self.openai_api_version
|
|
109
112
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath-langchain
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.117
|
|
4
4
|
Summary: UiPath Langchain
|
|
5
5
|
Project-URL: Homepage, https://uipath.com
|
|
6
6
|
Project-URL: Repository, https://github.com/UiPath/uipath-langchain-python
|
|
@@ -24,7 +24,7 @@ Requires-Dist: langgraph>=0.2.70
|
|
|
24
24
|
Requires-Dist: openai>=1.65.5
|
|
25
25
|
Requires-Dist: pydantic-settings>=2.6.0
|
|
26
26
|
Requires-Dist: python-dotenv>=1.0.1
|
|
27
|
-
Requires-Dist: uipath<2.1.0,>=2.0.
|
|
27
|
+
Requires-Dist: uipath<2.1.0,>=2.0.79
|
|
28
28
|
Provides-Extra: langchain
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
uipath_langchain/__init__.py,sha256=VBrvQn7d3nuOdN7zEnV2_S-uhmkjgEIlXiFVeZxZakQ,80
|
|
2
2
|
uipath_langchain/middlewares.py,sha256=tre7o9DFMgWk1DJiEEUmT6_wiP-PPkWtKmG0iOyvr9c,509
|
|
3
3
|
uipath_langchain/_cli/__init__.py,sha256=juqd9PbXs4yg45zMJ7BHAOPQjb7sgEbWE9InBtGZhfo,24
|
|
4
|
-
uipath_langchain/_cli/cli_init.py,sha256=
|
|
4
|
+
uipath_langchain/_cli/cli_init.py,sha256=xhxJ8tuMSrVUNHvltgyPpOrvgMA-wq9shHeYYwvHILs,8199
|
|
5
5
|
uipath_langchain/_cli/cli_new.py,sha256=dL8-Rri6u67ZZdbb4nT38A5xD_Q3fVnG0UK9VSeKaqg,2563
|
|
6
6
|
uipath_langchain/_cli/cli_run.py,sha256=rGuYp9AEJdhHclOCFPX100Mo0kaDYt6e6pIKBgbS6ek,3023
|
|
7
|
-
uipath_langchain/_cli/_runtime/_context.py,sha256=
|
|
7
|
+
uipath_langchain/_cli/_runtime/_context.py,sha256=yyzYJDmk2fkH4T5gm4cLGRyXtjLESrpzHBT9euqluTA,817
|
|
8
8
|
uipath_langchain/_cli/_runtime/_exception.py,sha256=USKkLYkG-dzjX3fEiMMOHnVUpiXJs_xF0OQXCCOvbYM,546
|
|
9
9
|
uipath_langchain/_cli/_runtime/_input.py,sha256=vZ8vfVxvPSaPWmIPghvNx1VRKzbalHsKUMBPiKDvJWM,5492
|
|
10
10
|
uipath_langchain/_cli/_runtime/_output.py,sha256=yJOZPWv2FRUJWv1NRs9JmpB4QMTDXu8jrxoaKrfJvzw,9078
|
|
11
|
-
uipath_langchain/_cli/_runtime/_runtime.py,sha256=
|
|
11
|
+
uipath_langchain/_cli/_runtime/_runtime.py,sha256=y12VlDl6wC53458acFvI9zikGV5epEfOm2YEW9ezSQg,13910
|
|
12
12
|
uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
|
|
13
13
|
uipath_langchain/_cli/_templates/main.py.template,sha256=nMJQIYPlRk90iANfNVpkJ2EQX20Dxsyq92-BucEz_UM,1189
|
|
14
|
-
uipath_langchain/_cli/_utils/_graph.py,sha256=
|
|
14
|
+
uipath_langchain/_cli/_utils/_graph.py,sha256=2FrlU4bMuEzcHglXzIC54IB8jw55SlENF-SVcpwWsS0,7167
|
|
15
15
|
uipath_langchain/_utils/__init__.py,sha256=WoY66enCygRXTh6v5B1UrRcFCnQYuPJ8oqDkwomXzLc,194
|
|
16
|
-
uipath_langchain/_utils/_request_mixin.py,sha256=
|
|
17
|
-
uipath_langchain/_utils/_settings.py,sha256=
|
|
16
|
+
uipath_langchain/_utils/_request_mixin.py,sha256=Bf8l43T0uqwUsucBE_2C1aeB9b0bmf11-3SyKr6RNpA,18926
|
|
17
|
+
uipath_langchain/_utils/_settings.py,sha256=2fExMQJ88YptfldmzMfZIpsx-m1gfMkeYGf5t6KIe0A,3084
|
|
18
18
|
uipath_langchain/_utils/_sleep_policy.py,sha256=e9pHdjmcCj4CVoFM1jMyZFelH11YatsgWfpyrfXzKBQ,1251
|
|
19
19
|
uipath_langchain/chat/__init__.py,sha256=WDcvy91ixvZ3Mq7Ae94g5CjyQwXovDBnEv1NlD5SXBE,116
|
|
20
|
-
uipath_langchain/chat/models.py,sha256=
|
|
20
|
+
uipath_langchain/chat/models.py,sha256=cUxBR39oHIFkRifLNVRHjff6QXGiOcTzy9J-svnKGsE,10848
|
|
21
21
|
uipath_langchain/embeddings/__init__.py,sha256=QICtYB58ZyqFfDQrEaO8lTEgAU5NuEKlR7iIrS0OBtc,156
|
|
22
|
-
uipath_langchain/embeddings/embeddings.py,sha256=
|
|
22
|
+
uipath_langchain/embeddings/embeddings.py,sha256=45gKyb6HVKigwE-0CXeZcAk33c0mteaEdPGa8hviqcw,4339
|
|
23
23
|
uipath_langchain/retrievers/__init__.py,sha256=rOn7PyyHgZ4pMnXWPkGqmuBmx8eGuo-Oyndo7Wm9IUU,108
|
|
24
24
|
uipath_langchain/retrievers/context_grounding_retriever.py,sha256=YLCIwy89LhLnNqcM0YJ5mZoeNyCs5UiKD3Wly8gnW1E,2239
|
|
25
25
|
uipath_langchain/tracers/AsyncUiPathTracer.py,sha256=SgFLVU8ZtRaUjIiiM5jjYqlKc-4ec3tAXwZVceDM2ng,9147
|
|
@@ -29,8 +29,8 @@ uipath_langchain/tracers/_instrument_traceable.py,sha256=0e841zVzcPWjOGtmBx0GeHb
|
|
|
29
29
|
uipath_langchain/tracers/_utils.py,sha256=JOT1tKMdvqjMDtj2WbmbOWMeMlTXBWavxWpogX7KlRA,1543
|
|
30
30
|
uipath_langchain/vectorstores/__init__.py,sha256=w8qs1P548ud1aIcVA_QhBgf_jZDrRMK5Lono78yA8cs,114
|
|
31
31
|
uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=TncIXG-YsUlO0R5ZYzWsM-Dj1SVCZbzmo2LraVxXelc,9559
|
|
32
|
-
uipath_langchain-0.0.
|
|
33
|
-
uipath_langchain-0.0.
|
|
34
|
-
uipath_langchain-0.0.
|
|
35
|
-
uipath_langchain-0.0.
|
|
36
|
-
uipath_langchain-0.0.
|
|
32
|
+
uipath_langchain-0.0.117.dist-info/METADATA,sha256=dJQDa40PA6Np0h_JvSRLbcMlHTiZo6a_Zh8mP5_5XPc,4166
|
|
33
|
+
uipath_langchain-0.0.117.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
34
|
+
uipath_langchain-0.0.117.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
|
|
35
|
+
uipath_langchain-0.0.117.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
|
|
36
|
+
uipath_langchain-0.0.117.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|