uipath-langchain 0.0.135__py3-none-any.whl → 0.0.137__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/_tracing/_oteladapter.py +19 -7
- uipath_langchain/tools/preconfigured.py +34 -5
- {uipath_langchain-0.0.135.dist-info → uipath_langchain-0.0.137.dist-info}/METADATA +2 -2
- {uipath_langchain-0.0.135.dist-info → uipath_langchain-0.0.137.dist-info}/RECORD +7 -7
- {uipath_langchain-0.0.135.dist-info → uipath_langchain-0.0.137.dist-info}/WHEEL +0 -0
- {uipath_langchain-0.0.135.dist-info → uipath_langchain-0.0.137.dist-info}/entry_points.txt +0 -0
- {uipath_langchain-0.0.135.dist-info → uipath_langchain-0.0.137.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Any, Dict, List
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
4
|
|
|
5
|
-
from opentelemetry.sdk.trace.export import
|
|
6
|
-
SpanExportResult,
|
|
7
|
-
)
|
|
5
|
+
from opentelemetry.sdk.trace.export import SpanExportResult
|
|
8
6
|
from uipath.tracing import LlmOpsHttpExporter
|
|
9
7
|
|
|
10
8
|
logger = logging.getLogger(__name__)
|
|
@@ -71,6 +69,11 @@ class LangChainExporter(LlmOpsHttpExporter):
|
|
|
71
69
|
# Add more mappings as needed
|
|
72
70
|
}
|
|
73
71
|
|
|
72
|
+
class Status:
|
|
73
|
+
SUCCESS = 1
|
|
74
|
+
ERROR = 2
|
|
75
|
+
INTERRUPTED = 3
|
|
76
|
+
|
|
74
77
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
75
78
|
super().__init__(*args, **kwargs)
|
|
76
79
|
|
|
@@ -161,13 +164,18 @@ class LangChainExporter(LlmOpsHttpExporter):
|
|
|
161
164
|
|
|
162
165
|
return result
|
|
163
166
|
|
|
167
|
+
def _determine_status(self, error: Optional[str]) -> int:
|
|
168
|
+
if error:
|
|
169
|
+
if error and error.startswith("GraphInterrupt("):
|
|
170
|
+
return self.Status.INTERRUPTED
|
|
171
|
+
return self.Status.ERROR
|
|
172
|
+
return self.Status.SUCCESS
|
|
173
|
+
|
|
164
174
|
def _process_span_attributes(self, span_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
165
175
|
"""Extracts, transforms, and maps attributes for a span."""
|
|
166
176
|
if "Attributes" not in span_data:
|
|
167
177
|
return span_data
|
|
168
178
|
|
|
169
|
-
logger.debug(f"Processing span: {span_data}")
|
|
170
|
-
|
|
171
179
|
attributes_val = span_data["Attributes"]
|
|
172
180
|
if isinstance(attributes_val, str):
|
|
173
181
|
try:
|
|
@@ -206,7 +214,11 @@ class LangChainExporter(LlmOpsHttpExporter):
|
|
|
206
214
|
|
|
207
215
|
span_data["Attributes"] = json.dumps(processed_attributes)
|
|
208
216
|
|
|
209
|
-
|
|
217
|
+
# Determine status based on error information
|
|
218
|
+
error = attributes.get("error") or attributes.get("exception.message")
|
|
219
|
+
status = self._determine_status(error)
|
|
220
|
+
span_data["Status"] = status
|
|
221
|
+
|
|
210
222
|
return span_data
|
|
211
223
|
|
|
212
224
|
def _send_with_retries(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Iterable, Optional, Type
|
|
3
|
+
from typing import Any, Iterable, Optional, Type
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
from jsonschema_pydantic import jsonschema_to_pydantic as create_model # type: ignore
|
|
@@ -14,11 +14,13 @@ from uipath.agent.models.agent import (
|
|
|
14
14
|
AgentDefinition,
|
|
15
15
|
AgentEscalationChannel,
|
|
16
16
|
AgentEscalationResourceConfig,
|
|
17
|
+
AgentIntegrationToolParameter,
|
|
17
18
|
AgentIntegrationToolResourceConfig,
|
|
18
19
|
AgentProcessToolResourceConfig,
|
|
19
20
|
AgentResourceConfig,
|
|
20
21
|
)
|
|
21
22
|
from uipath.models import CreateAction, InvokeProcess
|
|
23
|
+
from uipath.models.connections import ConnectionTokenType
|
|
22
24
|
|
|
23
25
|
logger = logging.getLogger(__name__)
|
|
24
26
|
|
|
@@ -91,6 +93,27 @@ def create_escalation_tool(
|
|
|
91
93
|
yield create_escalation_tool_from_channel(channel)
|
|
92
94
|
|
|
93
95
|
|
|
96
|
+
METHOD_MAP = {"GETBYID": "GET"}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def build_query_params(parameters: list[AgentIntegrationToolParameter]):
|
|
100
|
+
query_params = [
|
|
101
|
+
x for x in parameters if x.field_location == "query" and x.value is not None
|
|
102
|
+
]
|
|
103
|
+
if query_params:
|
|
104
|
+
return "?" + "&".join(f"{q.name}={q.value}" for q in query_params)
|
|
105
|
+
return ""
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def filter_query_params(
|
|
109
|
+
kwargs: dict[str, Any], parameters: list[AgentIntegrationToolParameter]
|
|
110
|
+
):
|
|
111
|
+
query_params = {x.name for x in parameters if x.field_location == "query"}
|
|
112
|
+
non_query_params = {x.name for x in parameters if x.field_location != "query"}
|
|
113
|
+
fields_to_ignore = query_params - non_query_params
|
|
114
|
+
return {k: v for k, v in kwargs.items() if k not in fields_to_ignore}
|
|
115
|
+
|
|
116
|
+
|
|
94
117
|
def create_integration_tool(
|
|
95
118
|
resource: AgentIntegrationToolResourceConfig,
|
|
96
119
|
) -> Iterable[BaseTool]:
|
|
@@ -100,15 +123,21 @@ def create_integration_tool(
|
|
|
100
123
|
resource.properties.connection.id
|
|
101
124
|
)
|
|
102
125
|
token = await uipath.connections.retrieve_token_async(
|
|
103
|
-
resource.properties.connection.id
|
|
126
|
+
resource.properties.connection.id, ConnectionTokenType.BEARER
|
|
104
127
|
)
|
|
105
128
|
tool_url = f"{remote_connection.api_base_uri}/v3/element/instances/{remote_connection.element_instance_id}{resource.properties.tool_path}"
|
|
129
|
+
tool_url = f"{tool_url}{build_query_params(resource.properties.parameters)}"
|
|
130
|
+
tool_url = tool_url.format(**kwargs)
|
|
106
131
|
|
|
132
|
+
authorization = f"{token.token_type} {token.access_token}"
|
|
133
|
+
method = METHOD_MAP.get(resource.properties.method, resource.properties.method)
|
|
107
134
|
response = await httpx.AsyncClient().request(
|
|
108
|
-
|
|
135
|
+
method,
|
|
109
136
|
tool_url,
|
|
110
|
-
headers={"Authorization":
|
|
111
|
-
content=json.dumps(
|
|
137
|
+
headers={"Authorization": authorization},
|
|
138
|
+
content=json.dumps(
|
|
139
|
+
filter_query_params(kwargs, resource.properties.parameters)
|
|
140
|
+
),
|
|
112
141
|
)
|
|
113
142
|
return response.json()
|
|
114
143
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uipath-langchain
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.137
|
|
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
|
|
@@ -26,7 +26,7 @@ Requires-Dist: openai>=1.65.5
|
|
|
26
26
|
Requires-Dist: openinference-instrumentation-langchain>=0.1.50
|
|
27
27
|
Requires-Dist: pydantic-settings>=2.6.0
|
|
28
28
|
Requires-Dist: python-dotenv>=1.0.1
|
|
29
|
-
Requires-Dist: uipath<2.2.0,>=2.1.
|
|
29
|
+
Requires-Dist: uipath<2.2.0,>=2.1.65
|
|
30
30
|
Provides-Extra: langchain
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
@@ -17,7 +17,7 @@ uipath_langchain/_cli/_templates/main.py.template,sha256=GpSblGH2hwS9ibqQmX2iB2n
|
|
|
17
17
|
uipath_langchain/_cli/_utils/_graph.py,sha256=nMJWy8FmaD9rqPUY2lHc5uVpUzbXD1RO12uJnhe0kdo,6803
|
|
18
18
|
uipath_langchain/_tracing/__init__.py,sha256=UqrLc_WimpzKY82M0LJsgJ-HFQUQFjOmOlD1XQ8V-R4,181
|
|
19
19
|
uipath_langchain/_tracing/_instrument_traceable.py,sha256=8f9FyAKWE6kH1N8ErbpwqZHAzNjGwbLjQn7jdX5yAgA,4343
|
|
20
|
-
uipath_langchain/_tracing/_oteladapter.py,sha256=
|
|
20
|
+
uipath_langchain/_tracing/_oteladapter.py,sha256=PD0gsC39ZNvrm0gsfnt1ti6DEy56sBA9sIoxaAbHFFM,8887
|
|
21
21
|
uipath_langchain/_tracing/_utils.py,sha256=r_fiSk3HDDAcePY_UbbEYiSbNqzn5gFeMPYBDvGrFx0,902
|
|
22
22
|
uipath_langchain/_utils/__init__.py,sha256=-w-4TD9ZnJDCpj4VIPXhJciukrmDJJbmnOFnhAkAaEU,81
|
|
23
23
|
uipath_langchain/_utils/_request_mixin.py,sha256=ddKFs_0mjoFCmvPTiOTPJh1IIqYUo5CUka-B7zAZphE,19695
|
|
@@ -31,11 +31,11 @@ uipath_langchain/embeddings/embeddings.py,sha256=45gKyb6HVKigwE-0CXeZcAk33c0mtea
|
|
|
31
31
|
uipath_langchain/retrievers/__init__.py,sha256=rOn7PyyHgZ4pMnXWPkGqmuBmx8eGuo-Oyndo7Wm9IUU,108
|
|
32
32
|
uipath_langchain/retrievers/context_grounding_retriever.py,sha256=YLCIwy89LhLnNqcM0YJ5mZoeNyCs5UiKD3Wly8gnW1E,2239
|
|
33
33
|
uipath_langchain/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
uipath_langchain/tools/preconfigured.py,sha256=
|
|
34
|
+
uipath_langchain/tools/preconfigured.py,sha256=xCP0hiQuFKIv45PTvMsoWlwsxJDs7goyZujKflYBngY,7476
|
|
35
35
|
uipath_langchain/vectorstores/__init__.py,sha256=w8qs1P548ud1aIcVA_QhBgf_jZDrRMK5Lono78yA8cs,114
|
|
36
36
|
uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=TncIXG-YsUlO0R5ZYzWsM-Dj1SVCZbzmo2LraVxXelc,9559
|
|
37
|
-
uipath_langchain-0.0.
|
|
38
|
-
uipath_langchain-0.0.
|
|
39
|
-
uipath_langchain-0.0.
|
|
40
|
-
uipath_langchain-0.0.
|
|
41
|
-
uipath_langchain-0.0.
|
|
37
|
+
uipath_langchain-0.0.137.dist-info/METADATA,sha256=tYkBQ1NZGqzxGefhPDnDELJi2McbQnAZHiNdtbNVyxE,4275
|
|
38
|
+
uipath_langchain-0.0.137.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
39
|
+
uipath_langchain-0.0.137.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
|
|
40
|
+
uipath_langchain-0.0.137.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
|
|
41
|
+
uipath_langchain-0.0.137.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|