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

@@ -206,7 +206,7 @@ class LangChainExporter(LlmOpsHttpExporter):
206
206
 
207
207
  span_data["Attributes"] = json.dumps(processed_attributes)
208
208
 
209
- logger.info(f"Transformed span: {span_data}")
209
+ logger.debug(f"Transformed span: {span_data}")
210
210
  return span_data
211
211
 
212
212
  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
- resource.properties.method,
135
+ method,
109
136
  tool_url,
110
- headers={"Authorization": f"Bearer {token.access_token}"},
111
- content=json.dumps(kwargs),
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.135
3
+ Version: 0.0.136
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.64
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=6PLyJxLhvtkIlLQoOE2ZFxWys1N3iYZZH9DzpzrwKkk,8434
20
+ uipath_langchain/_tracing/_oteladapter.py,sha256=0n3KKHtxqpoR4G2Az88zLKtzbhapSLwncC6D7imftPM,8435
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=Ucl9mta_su66j-5uOC-vZzyc3V2-Em6q9WO1qsmQv48,6291
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.135.dist-info/METADATA,sha256=CE88C26k5ph4JltUBD19qwcSbySU_4mb-EhSigDnl9E,4275
38
- uipath_langchain-0.0.135.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
- uipath_langchain-0.0.135.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
40
- uipath_langchain-0.0.135.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
41
- uipath_langchain-0.0.135.dist-info/RECORD,,
37
+ uipath_langchain-0.0.136.dist-info/METADATA,sha256=UdX9Yc-5mGQsRbllzfyYipwlcKfmyCSl-KQd7T-Krxw,4275
38
+ uipath_langchain-0.0.136.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
39
+ uipath_langchain-0.0.136.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
40
+ uipath_langchain-0.0.136.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
41
+ uipath_langchain-0.0.136.dist-info/RECORD,,