uipath-langchain 0.0.112__py3-none-any.whl → 0.1.24__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.
- uipath_langchain/_cli/_templates/main.py.template +12 -13
- uipath_langchain/_cli/cli_init.py +127 -156
- uipath_langchain/_cli/cli_new.py +2 -6
- uipath_langchain/_resources/AGENTS.md +21 -0
- uipath_langchain/_resources/REQUIRED_STRUCTURE.md +92 -0
- uipath_langchain/{tracers → _tracing}/__init__.py +0 -2
- uipath_langchain/_tracing/_instrument_traceable.py +134 -0
- uipath_langchain/_utils/__init__.py +1 -2
- uipath_langchain/_utils/_request_mixin.py +351 -54
- uipath_langchain/_utils/_settings.py +2 -11
- uipath_langchain/agent/exceptions/__init__.py +6 -0
- uipath_langchain/agent/exceptions/exceptions.py +11 -0
- uipath_langchain/agent/guardrails/__init__.py +21 -0
- uipath_langchain/agent/guardrails/actions/__init__.py +11 -0
- uipath_langchain/agent/guardrails/actions/base_action.py +23 -0
- uipath_langchain/agent/guardrails/actions/block_action.py +41 -0
- uipath_langchain/agent/guardrails/actions/escalate_action.py +274 -0
- uipath_langchain/agent/guardrails/actions/log_action.py +57 -0
- uipath_langchain/agent/guardrails/guardrail_nodes.py +125 -0
- uipath_langchain/agent/guardrails/guardrails_factory.py +70 -0
- uipath_langchain/agent/guardrails/guardrails_subgraph.py +247 -0
- uipath_langchain/agent/guardrails/types.py +20 -0
- uipath_langchain/agent/react/__init__.py +14 -0
- uipath_langchain/agent/react/agent.py +113 -0
- uipath_langchain/agent/react/constants.py +2 -0
- uipath_langchain/agent/react/init_node.py +20 -0
- uipath_langchain/agent/react/llm_node.py +43 -0
- uipath_langchain/agent/react/router.py +97 -0
- uipath_langchain/agent/react/terminate_node.py +82 -0
- uipath_langchain/agent/react/tools/__init__.py +7 -0
- uipath_langchain/agent/react/tools/tools.py +50 -0
- uipath_langchain/agent/react/types.py +39 -0
- uipath_langchain/agent/react/utils.py +49 -0
- uipath_langchain/agent/tools/__init__.py +17 -0
- uipath_langchain/agent/tools/context_tool.py +53 -0
- uipath_langchain/agent/tools/escalation_tool.py +111 -0
- uipath_langchain/agent/tools/integration_tool.py +181 -0
- uipath_langchain/agent/tools/process_tool.py +49 -0
- uipath_langchain/agent/tools/static_args.py +138 -0
- uipath_langchain/agent/tools/structured_tool_with_output_type.py +14 -0
- uipath_langchain/agent/tools/tool_factory.py +45 -0
- uipath_langchain/agent/tools/tool_node.py +22 -0
- uipath_langchain/agent/tools/utils.py +11 -0
- uipath_langchain/chat/__init__.py +4 -0
- uipath_langchain/chat/bedrock.py +187 -0
- uipath_langchain/chat/gemini.py +330 -0
- uipath_langchain/chat/mapper.py +309 -0
- uipath_langchain/chat/models.py +261 -38
- uipath_langchain/chat/openai.py +132 -0
- uipath_langchain/chat/supported_models.py +42 -0
- uipath_langchain/embeddings/embeddings.py +136 -36
- uipath_langchain/middlewares.py +0 -2
- uipath_langchain/py.typed +0 -0
- uipath_langchain/retrievers/context_grounding_retriever.py +7 -9
- uipath_langchain/runtime/__init__.py +36 -0
- uipath_langchain/runtime/_serialize.py +46 -0
- uipath_langchain/runtime/config.py +61 -0
- uipath_langchain/runtime/errors.py +43 -0
- uipath_langchain/runtime/factory.py +315 -0
- uipath_langchain/runtime/graph.py +159 -0
- uipath_langchain/runtime/runtime.py +453 -0
- uipath_langchain/runtime/schema.py +349 -0
- uipath_langchain/runtime/storage.py +115 -0
- uipath_langchain/vectorstores/context_grounding_vectorstore.py +90 -110
- {uipath_langchain-0.0.112.dist-info → uipath_langchain-0.1.24.dist-info}/METADATA +42 -20
- uipath_langchain-0.1.24.dist-info/RECORD +76 -0
- {uipath_langchain-0.0.112.dist-info → uipath_langchain-0.1.24.dist-info}/WHEEL +1 -1
- uipath_langchain-0.1.24.dist-info/entry_points.txt +5 -0
- uipath_langchain/_cli/_runtime/_context.py +0 -21
- uipath_langchain/_cli/_runtime/_exception.py +0 -17
- uipath_langchain/_cli/_runtime/_input.py +0 -136
- uipath_langchain/_cli/_runtime/_output.py +0 -234
- uipath_langchain/_cli/_runtime/_runtime.py +0 -371
- uipath_langchain/_cli/_utils/_graph.py +0 -202
- uipath_langchain/_cli/cli_run.py +0 -80
- uipath_langchain/tracers/AsyncUiPathTracer.py +0 -274
- uipath_langchain/tracers/_events.py +0 -33
- uipath_langchain/tracers/_instrument_traceable.py +0 -416
- uipath_langchain/tracers/_utils.py +0 -52
- uipath_langchain-0.0.112.dist-info/RECORD +0 -36
- uipath_langchain-0.0.112.dist-info/entry_points.txt +0 -2
- {uipath_langchain-0.0.112.dist-info → uipath_langchain-0.1.24.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import functools
|
|
2
|
-
import importlib
|
|
3
|
-
import inspect
|
|
4
|
-
import logging
|
|
5
|
-
import sys
|
|
6
|
-
import uuid
|
|
7
|
-
from typing import Any, Callable, Dict, List, Literal, Optional
|
|
8
|
-
|
|
9
|
-
from langchain_core.callbacks import dispatch_custom_event
|
|
10
|
-
from uipath.tracing import TracingManager
|
|
11
|
-
|
|
12
|
-
from ._events import CustomTraceEvents, FunctionCallEventData
|
|
13
|
-
|
|
14
|
-
# Original module and traceable function references
|
|
15
|
-
original_langsmith: Any = None
|
|
16
|
-
original_traceable: Any = None
|
|
17
|
-
|
|
18
|
-
logger = logging.getLogger(__name__)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def dispatch_trace_event(
|
|
22
|
-
func_name,
|
|
23
|
-
inputs: Dict[str, Any],
|
|
24
|
-
event_type="call",
|
|
25
|
-
call_uuid=None,
|
|
26
|
-
result=None,
|
|
27
|
-
exception=None,
|
|
28
|
-
run_type: Optional[
|
|
29
|
-
Literal["tool", "chain", "llm", "retriever", "embedding", "prompt", "parser"]
|
|
30
|
-
] = None,
|
|
31
|
-
tags: Optional[List[str]] = None,
|
|
32
|
-
metadata: Optional[Dict[str, Any]] = None,
|
|
33
|
-
):
|
|
34
|
-
"""Dispatch trace event to our server."""
|
|
35
|
-
try:
|
|
36
|
-
event_data = FunctionCallEventData(
|
|
37
|
-
function_name=func_name,
|
|
38
|
-
event_type=event_type,
|
|
39
|
-
inputs=inputs,
|
|
40
|
-
call_uuid=call_uuid,
|
|
41
|
-
output=result,
|
|
42
|
-
error=str(exception) if exception else None,
|
|
43
|
-
run_type=run_type,
|
|
44
|
-
tags=tags,
|
|
45
|
-
metadata=metadata,
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
dispatch_custom_event(CustomTraceEvents.UIPATH_TRACE_FUNCTION_CALL, event_data)
|
|
49
|
-
except Exception as e:
|
|
50
|
-
logger.debug(
|
|
51
|
-
f"Error dispatching trace event: {e}. Function name: {func_name} Event type: {event_type}"
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def format_args_for_trace(
|
|
56
|
-
signature: inspect.Signature, *args: Any, **kwargs: Any
|
|
57
|
-
) -> Dict[str, Any]:
|
|
58
|
-
try:
|
|
59
|
-
"""Return a dictionary of inputs from the function signature."""
|
|
60
|
-
# Create a parameter mapping by partially binding the arguments
|
|
61
|
-
parameter_binding = signature.bind_partial(*args, **kwargs)
|
|
62
|
-
|
|
63
|
-
# Fill in default values for any unspecified parameters
|
|
64
|
-
parameter_binding.apply_defaults()
|
|
65
|
-
|
|
66
|
-
# Extract the input parameters, skipping special Python parameters
|
|
67
|
-
result = {}
|
|
68
|
-
for name, value in parameter_binding.arguments.items():
|
|
69
|
-
# Skip class and instance references
|
|
70
|
-
if name in ("self", "cls"):
|
|
71
|
-
continue
|
|
72
|
-
|
|
73
|
-
# Handle **kwargs parameters specially
|
|
74
|
-
param_info = signature.parameters.get(name)
|
|
75
|
-
if param_info and param_info.kind == inspect.Parameter.VAR_KEYWORD:
|
|
76
|
-
# Flatten nested kwargs directly into the result
|
|
77
|
-
if isinstance(value, dict):
|
|
78
|
-
result.update(value)
|
|
79
|
-
else:
|
|
80
|
-
# Regular parameter
|
|
81
|
-
result[name] = value
|
|
82
|
-
|
|
83
|
-
return result
|
|
84
|
-
except Exception as e:
|
|
85
|
-
logger.warning(
|
|
86
|
-
f"Error formatting arguments for trace: {e}. Using args and kwargs directly."
|
|
87
|
-
)
|
|
88
|
-
return {"args": args, "kwargs": kwargs}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def _create_traced_wrapper(
|
|
92
|
-
func: Callable[..., Any],
|
|
93
|
-
wrapper_func: Optional[Callable[..., Any]] = None,
|
|
94
|
-
func_name: Optional[str] = None,
|
|
95
|
-
run_type: Optional[str] = None,
|
|
96
|
-
span_type: Optional[str] = None,
|
|
97
|
-
tags: Optional[List[str]] = None,
|
|
98
|
-
metadata: Optional[Dict[str, Any]] = None,
|
|
99
|
-
input_processor: Optional[Callable[..., Any]] = None,
|
|
100
|
-
output_processor: Optional[Callable[..., Any]] = None,
|
|
101
|
-
):
|
|
102
|
-
"""Create a traced wrapper based on function type."""
|
|
103
|
-
# Use function name if not provided
|
|
104
|
-
actual_func_name = func_name or func.__name__
|
|
105
|
-
# Function to actually call (the wrapped function or original)
|
|
106
|
-
target_func = wrapper_func or func
|
|
107
|
-
# Ensure we have metadata
|
|
108
|
-
actual_metadata = metadata or {}
|
|
109
|
-
|
|
110
|
-
# Define all wrapper functions
|
|
111
|
-
|
|
112
|
-
@functools.wraps(target_func)
|
|
113
|
-
async def async_gen_wrapper(*args, **kwargs):
|
|
114
|
-
try:
|
|
115
|
-
call_uuid = str(uuid.uuid4())
|
|
116
|
-
|
|
117
|
-
# Get inputs and process them if needed
|
|
118
|
-
inputs = format_args_for_trace(inspect.signature(func), *args, **kwargs)
|
|
119
|
-
if input_processor is not None:
|
|
120
|
-
inputs = input_processor(inputs)
|
|
121
|
-
|
|
122
|
-
# Add span_type to metadata if provided
|
|
123
|
-
if span_type:
|
|
124
|
-
actual_metadata["span_type"] = (
|
|
125
|
-
span_type or "function_call_generator_async"
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
dispatch_trace_event(
|
|
129
|
-
actual_func_name,
|
|
130
|
-
inputs,
|
|
131
|
-
"call",
|
|
132
|
-
call_uuid,
|
|
133
|
-
run_type=run_type, # type: ignore
|
|
134
|
-
tags=tags,
|
|
135
|
-
metadata=actual_metadata,
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
outputs = []
|
|
139
|
-
async_gen = target_func(*args, **kwargs)
|
|
140
|
-
async for item in async_gen:
|
|
141
|
-
outputs.append(item)
|
|
142
|
-
yield item
|
|
143
|
-
|
|
144
|
-
# Process output if needed
|
|
145
|
-
output_to_record = outputs
|
|
146
|
-
if output_processor is not None:
|
|
147
|
-
output_to_record = output_processor(outputs)
|
|
148
|
-
|
|
149
|
-
dispatch_trace_event(
|
|
150
|
-
actual_func_name,
|
|
151
|
-
inputs,
|
|
152
|
-
"completion",
|
|
153
|
-
call_uuid,
|
|
154
|
-
result=output_to_record,
|
|
155
|
-
)
|
|
156
|
-
except Exception as e:
|
|
157
|
-
dispatch_trace_event(
|
|
158
|
-
actual_func_name, inputs, "completion", call_uuid, exception=e
|
|
159
|
-
)
|
|
160
|
-
raise
|
|
161
|
-
|
|
162
|
-
@functools.wraps(target_func)
|
|
163
|
-
def gen_wrapper(*args, **kwargs):
|
|
164
|
-
try:
|
|
165
|
-
call_uuid = str(uuid.uuid4())
|
|
166
|
-
|
|
167
|
-
# Get inputs and process them if needed
|
|
168
|
-
inputs = format_args_for_trace(inspect.signature(func), *args, **kwargs)
|
|
169
|
-
if input_processor is not None:
|
|
170
|
-
inputs = input_processor(inputs)
|
|
171
|
-
|
|
172
|
-
# Add span_type to metadata if provided
|
|
173
|
-
if span_type:
|
|
174
|
-
actual_metadata["span_type"] = (
|
|
175
|
-
span_type or "function_call_generator_sync"
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
dispatch_trace_event(
|
|
179
|
-
actual_func_name,
|
|
180
|
-
inputs,
|
|
181
|
-
"call",
|
|
182
|
-
call_uuid,
|
|
183
|
-
run_type=run_type, # type: ignore
|
|
184
|
-
tags=tags,
|
|
185
|
-
metadata=actual_metadata,
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
outputs = []
|
|
189
|
-
gen = target_func(*args, **kwargs)
|
|
190
|
-
for item in gen:
|
|
191
|
-
outputs.append(item)
|
|
192
|
-
yield item
|
|
193
|
-
|
|
194
|
-
# Process output if needed
|
|
195
|
-
output_to_record = outputs
|
|
196
|
-
if output_processor is not None:
|
|
197
|
-
output_to_record = output_processor(outputs)
|
|
198
|
-
|
|
199
|
-
dispatch_trace_event(
|
|
200
|
-
actual_func_name,
|
|
201
|
-
inputs,
|
|
202
|
-
"completion",
|
|
203
|
-
call_uuid,
|
|
204
|
-
result=output_to_record,
|
|
205
|
-
)
|
|
206
|
-
except Exception as e:
|
|
207
|
-
dispatch_trace_event(
|
|
208
|
-
actual_func_name, inputs, "completion", call_uuid, exception=e
|
|
209
|
-
)
|
|
210
|
-
raise
|
|
211
|
-
|
|
212
|
-
@functools.wraps(target_func)
|
|
213
|
-
async def async_wrapper(*args, **kwargs):
|
|
214
|
-
try:
|
|
215
|
-
call_uuid = str(uuid.uuid4())
|
|
216
|
-
|
|
217
|
-
# Get inputs and process them if needed
|
|
218
|
-
inputs = format_args_for_trace(inspect.signature(func), *args, **kwargs)
|
|
219
|
-
if input_processor is not None:
|
|
220
|
-
inputs = input_processor(inputs)
|
|
221
|
-
|
|
222
|
-
# Add span_type to metadata if provided
|
|
223
|
-
if span_type:
|
|
224
|
-
actual_metadata["span_type"] = span_type or "function_call_async"
|
|
225
|
-
|
|
226
|
-
dispatch_trace_event(
|
|
227
|
-
actual_func_name,
|
|
228
|
-
inputs,
|
|
229
|
-
"call",
|
|
230
|
-
call_uuid,
|
|
231
|
-
run_type=run_type, # type: ignore
|
|
232
|
-
tags=tags,
|
|
233
|
-
metadata=actual_metadata,
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
result = await target_func(*args, **kwargs)
|
|
237
|
-
|
|
238
|
-
# Process output if needed
|
|
239
|
-
output_to_record = result
|
|
240
|
-
if output_processor is not None:
|
|
241
|
-
output_to_record = output_processor(result)
|
|
242
|
-
|
|
243
|
-
dispatch_trace_event(
|
|
244
|
-
actual_func_name,
|
|
245
|
-
inputs,
|
|
246
|
-
"completion",
|
|
247
|
-
call_uuid,
|
|
248
|
-
result=output_to_record,
|
|
249
|
-
)
|
|
250
|
-
|
|
251
|
-
return result
|
|
252
|
-
except Exception as e:
|
|
253
|
-
dispatch_trace_event(
|
|
254
|
-
actual_func_name, inputs, "completion", call_uuid, exception=e
|
|
255
|
-
)
|
|
256
|
-
raise
|
|
257
|
-
|
|
258
|
-
@functools.wraps(target_func)
|
|
259
|
-
def sync_wrapper(*args, **kwargs):
|
|
260
|
-
try:
|
|
261
|
-
call_uuid = str(uuid.uuid4())
|
|
262
|
-
|
|
263
|
-
# Get inputs and process them if needed
|
|
264
|
-
inputs = format_args_for_trace(inspect.signature(func), *args, **kwargs)
|
|
265
|
-
if input_processor is not None:
|
|
266
|
-
inputs = input_processor(inputs)
|
|
267
|
-
|
|
268
|
-
# Add span_type to metadata if provided
|
|
269
|
-
if span_type:
|
|
270
|
-
actual_metadata["span_type"] = span_type or "function_call_sync"
|
|
271
|
-
|
|
272
|
-
dispatch_trace_event(
|
|
273
|
-
actual_func_name,
|
|
274
|
-
inputs,
|
|
275
|
-
"call",
|
|
276
|
-
call_uuid,
|
|
277
|
-
run_type=run_type, # type: ignore
|
|
278
|
-
tags=tags,
|
|
279
|
-
metadata=actual_metadata,
|
|
280
|
-
)
|
|
281
|
-
|
|
282
|
-
result = target_func(*args, **kwargs)
|
|
283
|
-
|
|
284
|
-
# Process output if needed
|
|
285
|
-
output_to_record = result
|
|
286
|
-
if output_processor is not None:
|
|
287
|
-
output_to_record = output_processor(result)
|
|
288
|
-
|
|
289
|
-
dispatch_trace_event(
|
|
290
|
-
actual_func_name,
|
|
291
|
-
inputs,
|
|
292
|
-
"completion",
|
|
293
|
-
call_uuid,
|
|
294
|
-
result=output_to_record,
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
return result
|
|
298
|
-
except Exception as e:
|
|
299
|
-
dispatch_trace_event(
|
|
300
|
-
actual_func_name, inputs, "completion", call_uuid, exception=e
|
|
301
|
-
)
|
|
302
|
-
raise
|
|
303
|
-
|
|
304
|
-
# Return the appropriate wrapper based on the function type
|
|
305
|
-
if inspect.isasyncgenfunction(target_func):
|
|
306
|
-
return async_gen_wrapper
|
|
307
|
-
elif inspect.isgeneratorfunction(target_func):
|
|
308
|
-
return gen_wrapper
|
|
309
|
-
elif inspect.iscoroutinefunction(target_func):
|
|
310
|
-
return async_wrapper
|
|
311
|
-
else:
|
|
312
|
-
return sync_wrapper
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
def _create_appropriate_wrapper(
|
|
316
|
-
original_func: Any, wrapped_func: Any, decorator_kwargs: Dict[str, Any]
|
|
317
|
-
):
|
|
318
|
-
"""Create the appropriate wrapper based on function type."""
|
|
319
|
-
|
|
320
|
-
# Get the function name and tags from decorator arguments
|
|
321
|
-
func_name = decorator_kwargs.get("name", original_func.__name__)
|
|
322
|
-
tags = decorator_kwargs.get("tags", None)
|
|
323
|
-
metadata = decorator_kwargs.get("metadata", None)
|
|
324
|
-
run_type = decorator_kwargs.get("run_type", None)
|
|
325
|
-
|
|
326
|
-
return _create_traced_wrapper(
|
|
327
|
-
func=original_func,
|
|
328
|
-
wrapper_func=wrapped_func,
|
|
329
|
-
func_name=func_name,
|
|
330
|
-
run_type=run_type,
|
|
331
|
-
tags=tags,
|
|
332
|
-
metadata=metadata,
|
|
333
|
-
)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
def _uipath_traced(
|
|
337
|
-
name: Optional[str] = None,
|
|
338
|
-
run_type: Optional[str] = None,
|
|
339
|
-
span_type: Optional[str] = None,
|
|
340
|
-
input_processor: Optional[Callable[..., Any]] = None,
|
|
341
|
-
output_processor: Optional[Callable[..., Any]] = None,
|
|
342
|
-
*args: Any,
|
|
343
|
-
**kwargs: Any,
|
|
344
|
-
):
|
|
345
|
-
"""Decorator factory that creates traced functions using dispatch_trace_event."""
|
|
346
|
-
|
|
347
|
-
def decorator(func):
|
|
348
|
-
return _create_traced_wrapper(
|
|
349
|
-
func=func,
|
|
350
|
-
func_name=name,
|
|
351
|
-
run_type=run_type,
|
|
352
|
-
span_type=span_type,
|
|
353
|
-
input_processor=input_processor,
|
|
354
|
-
output_processor=output_processor,
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
return decorator
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
# Create patched version of traceable
|
|
361
|
-
def patched_traceable(*decorator_args, **decorator_kwargs):
|
|
362
|
-
# Handle the case when @traceable is used directly as decorator without arguments
|
|
363
|
-
if (
|
|
364
|
-
len(decorator_args) == 1
|
|
365
|
-
and callable(decorator_args[0])
|
|
366
|
-
and not decorator_kwargs
|
|
367
|
-
):
|
|
368
|
-
func = decorator_args[0]
|
|
369
|
-
return _create_appropriate_wrapper(func, original_traceable(func), {})
|
|
370
|
-
|
|
371
|
-
# Handle the case when @traceable(args) is used with parameters
|
|
372
|
-
original_decorated = original_traceable(*decorator_args, **decorator_kwargs)
|
|
373
|
-
|
|
374
|
-
def uipath_trace_decorator(func):
|
|
375
|
-
# Apply the original decorator with its arguments
|
|
376
|
-
wrapped_func = original_decorated(func)
|
|
377
|
-
return _create_appropriate_wrapper(func, wrapped_func, decorator_kwargs)
|
|
378
|
-
|
|
379
|
-
return uipath_trace_decorator
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
# Register the UIPath traced decorator
|
|
383
|
-
def register_uipath_tracing():
|
|
384
|
-
"""Register the UIPath tracing decorator with TracedDecoratorRegistry."""
|
|
385
|
-
# Reapply to all previously decorated functions
|
|
386
|
-
TracingManager.reapply_traced_decorator(_uipath_traced)
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
# Apply the patch
|
|
390
|
-
def _instrument_traceable_attributes():
|
|
391
|
-
"""Apply the patch to langsmith module at import time."""
|
|
392
|
-
global original_langsmith, original_traceable
|
|
393
|
-
|
|
394
|
-
# Register our custom tracing decorator
|
|
395
|
-
register_uipath_tracing()
|
|
396
|
-
|
|
397
|
-
# Import the original module if not already done
|
|
398
|
-
if original_langsmith is None:
|
|
399
|
-
# Temporarily remove our custom module from sys.modules
|
|
400
|
-
if "langsmith" in sys.modules:
|
|
401
|
-
original_langsmith = sys.modules["langsmith"]
|
|
402
|
-
del sys.modules["langsmith"]
|
|
403
|
-
|
|
404
|
-
# Import the original module
|
|
405
|
-
original_langsmith = importlib.import_module("langsmith")
|
|
406
|
-
|
|
407
|
-
# Store the original traceable
|
|
408
|
-
original_traceable = original_langsmith.traceable
|
|
409
|
-
|
|
410
|
-
# Replace the traceable function with our patched version
|
|
411
|
-
original_langsmith.traceable = patched_traceable
|
|
412
|
-
|
|
413
|
-
# Put our modified module back
|
|
414
|
-
sys.modules["langsmith"] = original_langsmith
|
|
415
|
-
|
|
416
|
-
return original_langsmith
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import datetime
|
|
2
|
-
import logging
|
|
3
|
-
from zoneinfo import ZoneInfo
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class IgnoreSpecificUrl(logging.Filter):
|
|
7
|
-
def __init__(self, url_to_ignore):
|
|
8
|
-
super().__init__()
|
|
9
|
-
self.url_to_ignore = url_to_ignore
|
|
10
|
-
|
|
11
|
-
def filter(self, record):
|
|
12
|
-
try:
|
|
13
|
-
if record.msg == 'HTTP Request: %s %s "%s %d %s"':
|
|
14
|
-
# Ignore the log if the URL matches the one we want to ignore
|
|
15
|
-
method = record.args[0]
|
|
16
|
-
url = record.args[1]
|
|
17
|
-
|
|
18
|
-
if method == "POST" and url.path.endswith(self.url_to_ignore):
|
|
19
|
-
# Check if the URL contains the specific path we want to ignore
|
|
20
|
-
return True
|
|
21
|
-
return False
|
|
22
|
-
|
|
23
|
-
except Exception:
|
|
24
|
-
return False
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def _setup_tracer_httpx_logging(url: str):
|
|
28
|
-
# Create a custom logger for httpx
|
|
29
|
-
# Add the custom filter to the root logger
|
|
30
|
-
logging.getLogger("httpx").addFilter(IgnoreSpecificUrl(url))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def _simple_serialize_defaults(obj):
|
|
34
|
-
if hasattr(obj, "model_dump"):
|
|
35
|
-
return obj.model_dump(exclude_none=True, mode="json")
|
|
36
|
-
if hasattr(obj, "dict"):
|
|
37
|
-
return obj.dict()
|
|
38
|
-
if hasattr(obj, "to_dict"):
|
|
39
|
-
return obj.to_dict()
|
|
40
|
-
|
|
41
|
-
if isinstance(obj, (set, tuple)):
|
|
42
|
-
if hasattr(obj, "_asdict") and callable(obj._asdict):
|
|
43
|
-
return obj._asdict()
|
|
44
|
-
return list(obj)
|
|
45
|
-
|
|
46
|
-
if isinstance(obj, datetime.datetime):
|
|
47
|
-
return obj.isoformat()
|
|
48
|
-
|
|
49
|
-
if isinstance(obj, (datetime.timezone, ZoneInfo)):
|
|
50
|
-
return obj.tzname(None)
|
|
51
|
-
|
|
52
|
-
return str(obj)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
uipath_langchain/__init__.py,sha256=VBrvQn7d3nuOdN7zEnV2_S-uhmkjgEIlXiFVeZxZakQ,80
|
|
2
|
-
uipath_langchain/middlewares.py,sha256=tre7o9DFMgWk1DJiEEUmT6_wiP-PPkWtKmG0iOyvr9c,509
|
|
3
|
-
uipath_langchain/_cli/__init__.py,sha256=juqd9PbXs4yg45zMJ7BHAOPQjb7sgEbWE9InBtGZhfo,24
|
|
4
|
-
uipath_langchain/_cli/cli_init.py,sha256=B5BVUA7pDvKyRRGEx5mgmeE5SJvLPM3cnLGt6a9iixY,7417
|
|
5
|
-
uipath_langchain/_cli/cli_new.py,sha256=dL8-Rri6u67ZZdbb4nT38A5xD_Q3fVnG0UK9VSeKaqg,2563
|
|
6
|
-
uipath_langchain/_cli/cli_run.py,sha256=rGuYp9AEJdhHclOCFPX100Mo0kaDYt6e6pIKBgbS6ek,3023
|
|
7
|
-
uipath_langchain/_cli/_runtime/_context.py,sha256=wr4aNn06ReIXmetEZ6b6AnpAt64p13anQ2trZ5Bzgio,807
|
|
8
|
-
uipath_langchain/_cli/_runtime/_exception.py,sha256=USKkLYkG-dzjX3fEiMMOHnVUpiXJs_xF0OQXCCOvbYM,546
|
|
9
|
-
uipath_langchain/_cli/_runtime/_input.py,sha256=vZ8vfVxvPSaPWmIPghvNx1VRKzbalHsKUMBPiKDvJWM,5492
|
|
10
|
-
uipath_langchain/_cli/_runtime/_output.py,sha256=yJOZPWv2FRUJWv1NRs9JmpB4QMTDXu8jrxoaKrfJvzw,9078
|
|
11
|
-
uipath_langchain/_cli/_runtime/_runtime.py,sha256=SjOZkal6c1ZeZNFzW23DoAnF6LNQ2nN0dISSu2cSFhQ,13881
|
|
12
|
-
uipath_langchain/_cli/_templates/langgraph.json.template,sha256=eeh391Gta_hoRgaNaZ58nW1LNvCVXA7hlAH6l7Veous,107
|
|
13
|
-
uipath_langchain/_cli/_templates/main.py.template,sha256=9JEyPxwc4Ce8Dfd2UAgHgpwkkjuXwWXOQZ-65P53QuM,1195
|
|
14
|
-
uipath_langchain/_cli/_utils/_graph.py,sha256=P7m03i6kcLda8XVpVtppcM8GOrSW62zWcv3rCR1H5zs,7086
|
|
15
|
-
uipath_langchain/_utils/__init__.py,sha256=WoY66enCygRXTh6v5B1UrRcFCnQYuPJ8oqDkwomXzLc,194
|
|
16
|
-
uipath_langchain/_utils/_request_mixin.py,sha256=t_1HWBxqEl-wsSk9ubmIM-8vs9BlNy4ZVBxtDxktn6U,18489
|
|
17
|
-
uipath_langchain/_utils/_settings.py,sha256=mCJ2-XXfpedjxT7DSXINPITHrXzQJCESgNo-nz3irDk,3450
|
|
18
|
-
uipath_langchain/_utils/_sleep_policy.py,sha256=e9pHdjmcCj4CVoFM1jMyZFelH11YatsgWfpyrfXzKBQ,1251
|
|
19
|
-
uipath_langchain/chat/__init__.py,sha256=WDcvy91ixvZ3Mq7Ae94g5CjyQwXovDBnEv1NlD5SXBE,116
|
|
20
|
-
uipath_langchain/chat/models.py,sha256=sLz8yzEMUMSNsCFyywRxFwe2JisR3TP-n1vbeRKl9H8,10225
|
|
21
|
-
uipath_langchain/embeddings/__init__.py,sha256=QICtYB58ZyqFfDQrEaO8lTEgAU5NuEKlR7iIrS0OBtc,156
|
|
22
|
-
uipath_langchain/embeddings/embeddings.py,sha256=gntzTfwO1pHbgnXiPdfETJaaurvQWqxVUCH75VMah54,4274
|
|
23
|
-
uipath_langchain/retrievers/__init__.py,sha256=rOn7PyyHgZ4pMnXWPkGqmuBmx8eGuo-Oyndo7Wm9IUU,108
|
|
24
|
-
uipath_langchain/retrievers/context_grounding_retriever.py,sha256=YLCIwy89LhLnNqcM0YJ5mZoeNyCs5UiKD3Wly8gnW1E,2239
|
|
25
|
-
uipath_langchain/tracers/AsyncUiPathTracer.py,sha256=SgFLVU8ZtRaUjIiiM5jjYqlKc-4ec3tAXwZVceDM2ng,9147
|
|
26
|
-
uipath_langchain/tracers/__init__.py,sha256=bMmqGCC4DsuLUdDVM4zvmVbRLPeULZ8K9ity0GAfy_4,197
|
|
27
|
-
uipath_langchain/tracers/_events.py,sha256=CJri76SSdu7rGJIkXurJ2C5sQahfSK4E5UWwWYdEAtE,922
|
|
28
|
-
uipath_langchain/tracers/_instrument_traceable.py,sha256=0e841zVzcPWjOGtmBx0GeHbq3JoqsmWv6gVPzDOKNTM,13496
|
|
29
|
-
uipath_langchain/tracers/_utils.py,sha256=JOT1tKMdvqjMDtj2WbmbOWMeMlTXBWavxWpogX7KlRA,1543
|
|
30
|
-
uipath_langchain/vectorstores/__init__.py,sha256=w8qs1P548ud1aIcVA_QhBgf_jZDrRMK5Lono78yA8cs,114
|
|
31
|
-
uipath_langchain/vectorstores/context_grounding_vectorstore.py,sha256=TncIXG-YsUlO0R5ZYzWsM-Dj1SVCZbzmo2LraVxXelc,9559
|
|
32
|
-
uipath_langchain-0.0.112.dist-info/METADATA,sha256=MSb7h7hBN5BjhDchfFQYu2X4_OTt2hki8Zr5a-t0TDg,4166
|
|
33
|
-
uipath_langchain-0.0.112.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
34
|
-
uipath_langchain-0.0.112.dist-info/entry_points.txt,sha256=FUtzqGOEntlJKMJIXhQUfT7ZTbQmGhke1iCmDWZaQZI,81
|
|
35
|
-
uipath_langchain-0.0.112.dist-info/licenses/LICENSE,sha256=JDpt-uotAkHFmxpwxi6gwx6HQ25e-lG4U_Gzcvgp7JY,1063
|
|
36
|
-
uipath_langchain-0.0.112.dist-info/RECORD,,
|
|
File without changes
|