uipath-langchain 0.0.101__py3-none-any.whl → 0.0.102__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.

@@ -80,9 +80,6 @@ class LangGraphRuntime(UiPathBaseRuntime):
80
80
 
81
81
  if self.context.job_id and self.context.tracing_enabled:
82
82
  tracer = AsyncUiPathTracer(context=self.context.trace_context)
83
- await tracer.init_trace(
84
- self.context.entrypoint, self.context.job_id
85
- )
86
83
  callbacks = [tracer]
87
84
 
88
85
  graph_config: RunnableConfig = {
@@ -2,7 +2,6 @@ import asyncio
2
2
  import json
3
3
  import logging
4
4
  import queue
5
- import re
6
5
  import uuid
7
6
  import warnings
8
7
  from os import environ as env
@@ -43,9 +42,7 @@ class AsyncUiPathTracer(AsyncBaseTracer):
43
42
 
44
43
  self.context = context or UiPathTraceContext()
45
44
 
46
- llm_ops_pattern = self._get_base_url() + "{orgId}/llmops_"
47
-
48
- self.url = llm_ops_pattern.format(orgId=self.context.org_id).rstrip("/")
45
+ self.base_url = self._get_base_url()
49
46
 
50
47
  auth_token = env.get("UNATTENDED_USER_ACCESS_TOKEN") or env.get(
51
48
  "UIPATH_ACCESS_TOKEN"
@@ -103,44 +100,6 @@ class AsyncUiPathTracer(AsyncBaseTracer):
103
100
  )
104
101
  self._send_span(previous_run)
105
102
 
106
- async def init_trace(self, run_name, trace_id=None) -> None:
107
- if self.context.trace_id:
108
- # trace id already set no need to do anything
109
- return
110
-
111
- # no trace id, start a new trace
112
- await self.start_trace(run_name, trace_id)
113
-
114
- async def start_trace(self, run_name, trace_id=None) -> None:
115
- self.context.trace_id = str(uuid.uuid4())
116
-
117
- run_name = run_name or f"Job Run: {self.context.trace_id}"
118
- trace_data = {
119
- "id": self.context.trace_id,
120
- "name": re.sub(
121
- r"[!@#$<>\.]", "", run_name
122
- ), # if we use these characters the Agents UI throws some error (but llmops backend seems fine)
123
- "referenceId": self.context.reference_id,
124
- "attributes": "{}",
125
- "organizationId": self.context.org_id,
126
- "tenantId": self.context.tenant_id,
127
- }
128
-
129
- for attempt in range(self.retries):
130
- response = await self.client.post(
131
- f"{self.url}/api/Agent/trace/", headers=self.headers, json=trace_data
132
- )
133
-
134
- if response.is_success:
135
- break
136
-
137
- await asyncio.sleep(0.5 * (2**attempt)) # Exponential backoff
138
-
139
- if 400 <= response.status_code < 600:
140
- logger.warning(
141
- f"Error when sending trace: {response}. Body is: {response.text}"
142
- )
143
-
144
103
  async def wait_for_all_tracers(self) -> None:
145
104
  """
146
105
  Wait for all pending log requests to complete
@@ -159,11 +118,13 @@ class AsyncUiPathTracer(AsyncBaseTracer):
159
118
 
160
119
  span_data = self.log_queue.get_nowait()
161
120
 
121
+ url = self._build_url(self.context.trace_id)
122
+
162
123
  for attempt in range(self.retries):
163
124
  response = await self.client.post(
164
- f"{self.url}/api/Agent/span/",
125
+ url,
165
126
  headers=self.headers,
166
- json=span_data,
127
+ json=[span_data], # api expects a list of spans
167
128
  timeout=10,
168
129
  )
169
130
 
@@ -189,11 +150,12 @@ class AsyncUiPathTracer(AsyncBaseTracer):
189
150
  break
190
151
 
191
152
  span_data = self.log_queue.get_nowait()
153
+ url = self._build_url(self.context.trace_id)
192
154
 
193
155
  response = await self.client.post(
194
- f"{self.url}/api/Agent/span/",
156
+ url,
195
157
  headers=self.headers,
196
- json=span_data,
158
+ json=[span_data], # api expects a list of spans
197
159
  timeout=10,
198
160
  )
199
161
  except Exception as e:
@@ -239,6 +201,7 @@ class AsyncUiPathTracer(AsyncBaseTracer):
239
201
  "jobKey": self.context.job_id,
240
202
  "folderKey": self.context.folder_key,
241
203
  "processKey": self.context.folder_key,
204
+ "expiryTimeUtc": None,
242
205
  }
243
206
 
244
207
  self.log_queue.put(span_data)
@@ -293,16 +256,11 @@ class AsyncUiPathTracer(AsyncBaseTracer):
293
256
  uipath_url = (
294
257
  env.get("UIPATH_URL") or "https://cloud.uipath.com/dummyOrg/dummyTennant/"
295
258
  )
296
- uipath_url = uipath_url.rstrip("/")
297
259
 
298
- # split by "//" to get ['', 'https:', 'alpha.uipath.com/ada/byoa']
299
- parts = uipath_url.split("//")
300
-
301
- # after splitting by //, the base URL will be at index 1 along with the rest,
302
- # hence split it again using "/" to get ['https:', 'alpha.uipath.com', 'ada', 'byoa']
303
- base_url_parts = parts[1].split("/")
260
+ uipath_url = uipath_url.rstrip("/")
304
261
 
305
- # combine scheme and netloc to get the base URL
306
- base_url = parts[0] + "//" + base_url_parts[0] + "/"
262
+ return uipath_url
307
263
 
308
- return base_url
264
+ def _build_url(self, trace_id: Optional[str]) -> str:
265
+ """Construct the URL for the API request."""
266
+ return f"{self.base_url}/llmopstenant_/api/Traces/spans?traceId={trace_id}&source=Robots"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uipath-langchain
3
- Version: 0.0.101
3
+ Version: 0.0.102
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
@@ -9,7 +9,7 @@ uipath_langchain/_cli/_runtime/_escalation.py,sha256=oA5NvZvCo8ngELFJRyhZNM69DxV
9
9
  uipath_langchain/_cli/_runtime/_exception.py,sha256=USKkLYkG-dzjX3fEiMMOHnVUpiXJs_xF0OQXCCOvbYM,546
10
10
  uipath_langchain/_cli/_runtime/_input.py,sha256=gKzPaGW-EzgeAskWJjbCWnfZRLu_BM7lCXkq0XkVGLU,5614
11
11
  uipath_langchain/_cli/_runtime/_output.py,sha256=WQSrsvGaaclZ6GLWEh6Nk1Mz1iGaIB45PgIX3DS3AN4,16130
12
- uipath_langchain/_cli/_runtime/_runtime.py,sha256=wj6e6tQdP2GjuSM-6G6Ug-FMqwOHwfUq-DGbd1gMfIg,11825
12
+ uipath_langchain/_cli/_runtime/_runtime.py,sha256=ai3qxNmdPACxowq7WcNBn9m8-KXe4vFwvpBn0lh6kmQ,11689
13
13
  uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
14
14
  uipath_langchain/_cli/_templates/main.py.template,sha256=9JEyPxwc4Ce8Dfd2UAgHgpwkkjuXwWXOQZ-65P53QuM,1195
15
15
  uipath_langchain/_cli/_utils/_graph.py,sha256=WLBSJfPc3_C07SqJhePRe17JIc5wcBvEqLviMcNOdTA,6950
@@ -25,7 +25,7 @@ uipath_langchain/embeddings/__init__.py,sha256=QICtYB58ZyqFfDQrEaO8lTEgAU5NuEKlR
25
25
  uipath_langchain/embeddings/embeddings.py,sha256=gntzTfwO1pHbgnXiPdfETJaaurvQWqxVUCH75VMah54,4274
26
26
  uipath_langchain/retrievers/__init__.py,sha256=rOn7PyyHgZ4pMnXWPkGqmuBmx8eGuo-Oyndo7Wm9IUU,108
27
27
  uipath_langchain/retrievers/context_grounding_retriever.py,sha256=CeVSMEz5xTQIladkzDLeQXGC1_ycW72gb0RB41JZeYA,2000
28
- uipath_langchain/tracers/AsyncUiPathTracer.py,sha256=gheNa679YnM9HrP0VFr-oYfWmpS5-dKOIG8ItzU4AEQ,10477
28
+ uipath_langchain/tracers/AsyncUiPathTracer.py,sha256=VLqoegxa8J3VwMCkGicO626nSzyCQv-Zj14lZrWXA2Y,8900
29
29
  uipath_langchain/tracers/UiPathTracer.py,sha256=V5g1nlB0TI1wYvUIkfCEcAdhy4thqeMBmjflWtxc-_M,5601
30
30
  uipath_langchain/tracers/__init__.py,sha256=MwrQh6iuPXMS72S5EX0JdCAX0TKe-l7fIPGV3EG0Ssk,256
31
31
  uipath_langchain/tracers/_events.py,sha256=CJri76SSdu7rGJIkXurJ2C5sQahfSK4E5UWwWYdEAtE,922
@@ -36,8 +36,8 @@ uipath_langchain/utils/_request_mixin.py,sha256=WFyTDyAthSci1DRwUwS21I3hLntD7HdV
36
36
  uipath_langchain/utils/_settings.py,sha256=MhwEVj4gVRSar0RBf2w2hTjO-5Qm-HpCuufqN3gSWjA,3390
37
37
  uipath_langchain/utils/_sleep_policy.py,sha256=e9pHdjmcCj4CVoFM1jMyZFelH11YatsgWfpyrfXzKBQ,1251
38
38
  uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=eTa5sX43-ydB1pj9VNHUPbB-hC36fZK_CGrNe5U2Nrw,9393
39
- uipath_langchain-0.0.101.dist-info/METADATA,sha256=_DMJPrVOEPDT_0kJm6aLPYMzME2NfuQYx55jAd3qeT8,3937
40
- uipath_langchain-0.0.101.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
41
- uipath_langchain-0.0.101.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
42
- uipath_langchain-0.0.101.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
43
- uipath_langchain-0.0.101.dist-info/RECORD,,
39
+ uipath_langchain-0.0.102.dist-info/METADATA,sha256=1NAjdRLlmcErrOc_DuOUJ8I3sJIeqg2UL5I4-EiRTeQ,3937
40
+ uipath_langchain-0.0.102.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
41
+ uipath_langchain-0.0.102.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
42
+ uipath_langchain-0.0.102.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
43
+ uipath_langchain-0.0.102.dist-info/RECORD,,