ragaai-catalyst 2.1.2b2__py3-none-any.whl → 2.1.2b4__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.
- ragaai_catalyst/tracers/agentic_tracing/tracers/agent_tracer.py +1 -10
- ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py +23 -16
- ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py +1 -11
- {ragaai_catalyst-2.1.2b2.dist-info → ragaai_catalyst-2.1.2b4.dist-info}/METADATA +1 -1
- {ragaai_catalyst-2.1.2b2.dist-info → ragaai_catalyst-2.1.2b4.dist-info}/RECORD +7 -7
- {ragaai_catalyst-2.1.2b2.dist-info → ragaai_catalyst-2.1.2b4.dist-info}/WHEEL +0 -0
- {ragaai_catalyst-2.1.2b2.dist-info → ragaai_catalyst-2.1.2b4.dist-info}/top_level.txt +0 -0
@@ -61,7 +61,6 @@ class AgentTracerMixin:
|
|
61
61
|
version=version,
|
62
62
|
capabilities=capabilities or [],
|
63
63
|
start_time=datetime.now(),
|
64
|
-
end_time=datetime.now(),
|
65
64
|
memory_used=0,
|
66
65
|
input_data=tracer._sanitize_input(args, kwargs),
|
67
66
|
output_data=None,
|
@@ -110,7 +109,6 @@ class AgentTracerMixin:
|
|
110
109
|
try:
|
111
110
|
start_time = datetime.now()
|
112
111
|
result = method(self, *args, **kwargs)
|
113
|
-
end_time = datetime.now()
|
114
112
|
|
115
113
|
# Update agent component with method result
|
116
114
|
if hasattr(tracer, '_agent_components'):
|
@@ -119,7 +117,6 @@ class AgentTracerMixin:
|
|
119
117
|
component['data']['output'] = tracer._sanitize_output(result)
|
120
118
|
component['data']['input'] = tracer._sanitize_input(args, kwargs)
|
121
119
|
component['start_time'] = start_time.isoformat()
|
122
|
-
component['end_time'] = end_time.isoformat()
|
123
120
|
|
124
121
|
# Get children accumulated during method execution
|
125
122
|
children = tracer.agent_children.get()
|
@@ -192,7 +189,6 @@ class AgentTracerMixin:
|
|
192
189
|
result = func(*args, **kwargs)
|
193
190
|
|
194
191
|
# Calculate resource usage
|
195
|
-
end_time = datetime.now()
|
196
192
|
end_memory = psutil.Process().memory_info().rss
|
197
193
|
memory_used = max(0, end_memory - start_memory)
|
198
194
|
|
@@ -211,7 +207,6 @@ class AgentTracerMixin:
|
|
211
207
|
version=version,
|
212
208
|
capabilities=capabilities or [],
|
213
209
|
start_time=start_time,
|
214
|
-
end_time=end_time,
|
215
210
|
memory_used=memory_used,
|
216
211
|
input_data=self.input_data,
|
217
212
|
output_data=self._sanitize_output(result),
|
@@ -257,7 +252,6 @@ class AgentTracerMixin:
|
|
257
252
|
version=version,
|
258
253
|
capabilities=capabilities or [],
|
259
254
|
start_time=start_time,
|
260
|
-
end_time=datetime.now(),
|
261
255
|
memory_used=0,
|
262
256
|
input_data=self.input_data,
|
263
257
|
output_data=None,
|
@@ -309,7 +303,6 @@ class AgentTracerMixin:
|
|
309
303
|
result = await func(*args, **kwargs)
|
310
304
|
|
311
305
|
# Calculate resource usage
|
312
|
-
end_time = datetime.now()
|
313
306
|
end_memory = psutil.Process().memory_info().rss
|
314
307
|
memory_used = max(0, end_memory - start_memory)
|
315
308
|
|
@@ -325,7 +318,6 @@ class AgentTracerMixin:
|
|
325
318
|
version=version,
|
326
319
|
capabilities=capabilities or [],
|
327
320
|
start_time=start_time,
|
328
|
-
end_time=end_time,
|
329
321
|
memory_used=memory_used,
|
330
322
|
input_data=self._sanitize_input(args, kwargs),
|
331
323
|
output_data=self._sanitize_output(result),
|
@@ -372,7 +364,6 @@ class AgentTracerMixin:
|
|
372
364
|
version=version,
|
373
365
|
capabilities=capabilities or [],
|
374
366
|
start_time=start_time,
|
375
|
-
end_time=datetime.now(),
|
376
367
|
memory_used=0,
|
377
368
|
input_data=self._sanitize_input(args, kwargs),
|
378
369
|
output_data=None,
|
@@ -408,7 +399,7 @@ class AgentTracerMixin:
|
|
408
399
|
"type": "agent",
|
409
400
|
"name": kwargs["name"],
|
410
401
|
"start_time": start_time.isoformat(),
|
411
|
-
"end_time":
|
402
|
+
"end_time": datetime.now().astimezone().isoformat(),
|
412
403
|
"error": kwargs.get("error"),
|
413
404
|
"parent_id": kwargs.get("parent_id"),
|
414
405
|
"info": {
|
@@ -185,9 +185,25 @@ class LLMTracerMixin:
|
|
185
185
|
@functools.wraps(original_init)
|
186
186
|
def patched_init(client_self, *args, **kwargs):
|
187
187
|
original_init(client_self, *args, **kwargs)
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
# Check if this is AsyncOpenAI or OpenAI
|
189
|
+
is_async = 'AsyncOpenAI' in client_class.__name__
|
190
|
+
|
191
|
+
if is_async:
|
192
|
+
# Patch async methods for AsyncOpenAI
|
193
|
+
if hasattr(client_self.chat.completions, "create"):
|
194
|
+
original_create = client_self.chat.completions.create
|
195
|
+
@functools.wraps(original_create)
|
196
|
+
async def wrapped_create(*args, **kwargs):
|
197
|
+
return await self.trace_llm_call(original_create, *args, **kwargs)
|
198
|
+
client_self.chat.completions.create = wrapped_create
|
199
|
+
else:
|
200
|
+
# Patch sync methods for OpenAI
|
201
|
+
if hasattr(client_self.chat.completions, "create"):
|
202
|
+
original_create = client_self.chat.completions.create
|
203
|
+
@functools.wraps(original_create)
|
204
|
+
def wrapped_create(*args, **kwargs):
|
205
|
+
return self.trace_llm_call_sync(original_create, *args, **kwargs)
|
206
|
+
client_self.chat.completions.create = wrapped_create
|
191
207
|
|
192
208
|
setattr(client_class, "__init__", patched_init)
|
193
209
|
|
@@ -250,7 +266,7 @@ class LLMTracerMixin:
|
|
250
266
|
setattr(obj, method_name, wrapped_method)
|
251
267
|
self.patches.append((obj, method_name, original_method))
|
252
268
|
|
253
|
-
def create_llm_component(self, component_id, hash_id, name, llm_type, version, memory_used, start_time,
|
269
|
+
def create_llm_component(self, component_id, hash_id, name, llm_type, version, memory_used, start_time, input_data, output_data, cost={}, usage={}, error=None, parameters={}):
|
254
270
|
# Update total metrics
|
255
271
|
self.total_tokens += usage.get("total_tokens", 0)
|
256
272
|
self.total_cost += cost.get("total_cost", 0)
|
@@ -278,7 +294,7 @@ class LLMTracerMixin:
|
|
278
294
|
"type": "llm",
|
279
295
|
"name": name,
|
280
296
|
"start_time": start_time.isoformat(),
|
281
|
-
"end_time":
|
297
|
+
"end_time": datetime.now().astimezone().isoformat(),
|
282
298
|
"error": error,
|
283
299
|
"parent_id": self.current_agent_id.get(),
|
284
300
|
"info": {
|
@@ -332,7 +348,6 @@ class LLMTracerMixin:
|
|
332
348
|
result = await original_func(*args, **kwargs)
|
333
349
|
|
334
350
|
# Calculate resource usage
|
335
|
-
end_time = datetime.now().astimezone()
|
336
351
|
end_memory = psutil.Process().memory_info().rss
|
337
352
|
memory_used = max(0, end_memory - start_memory)
|
338
353
|
|
@@ -359,7 +374,6 @@ class LLMTracerMixin:
|
|
359
374
|
version="1.0.0",
|
360
375
|
memory_used=memory_used,
|
361
376
|
start_time=start_time,
|
362
|
-
end_time=end_time,
|
363
377
|
input_data=input_data,
|
364
378
|
output_data=extract_llm_output(result),
|
365
379
|
cost=cost,
|
@@ -381,8 +395,6 @@ class LLMTracerMixin:
|
|
381
395
|
|
382
396
|
# End tracking network calls for this component
|
383
397
|
self.end_component(component_id)
|
384
|
-
|
385
|
-
end_time = datetime.now().astimezone()
|
386
398
|
|
387
399
|
name = self.current_llm_call_name.get()
|
388
400
|
if name is None:
|
@@ -396,7 +408,6 @@ class LLMTracerMixin:
|
|
396
408
|
version="1.0.0",
|
397
409
|
memory_used=0,
|
398
410
|
start_time=start_time,
|
399
|
-
end_time=end_time,
|
400
411
|
input_data=extract_input_data(args, kwargs, None),
|
401
412
|
output_data=None,
|
402
413
|
error=error_component
|
@@ -420,7 +431,6 @@ class LLMTracerMixin:
|
|
420
431
|
self.start_component(component_id)
|
421
432
|
|
422
433
|
# Calculate resource usage
|
423
|
-
end_time = datetime.now().astimezone()
|
424
434
|
start_memory = psutil.Process().memory_info().rss
|
425
435
|
|
426
436
|
try:
|
@@ -456,7 +466,6 @@ class LLMTracerMixin:
|
|
456
466
|
version="1.0.0",
|
457
467
|
memory_used=memory_used,
|
458
468
|
start_time=start_time,
|
459
|
-
end_time=end_time,
|
460
469
|
input_data=input_data,
|
461
470
|
output_data=extract_llm_output(result),
|
462
471
|
cost=cost,
|
@@ -477,8 +486,6 @@ class LLMTracerMixin:
|
|
477
486
|
|
478
487
|
# End tracking network calls for this component
|
479
488
|
self.end_component(component_id)
|
480
|
-
|
481
|
-
end_time = datetime.now().astimezone()
|
482
489
|
|
483
490
|
name = self.current_llm_call_name.get()
|
484
491
|
if name is None:
|
@@ -495,7 +502,6 @@ class LLMTracerMixin:
|
|
495
502
|
version="1.0.0",
|
496
503
|
memory_used=memory_used,
|
497
504
|
start_time=start_time,
|
498
|
-
end_time=end_time,
|
499
505
|
input_data=extract_input_data(args, kwargs, None),
|
500
506
|
output_data=None,
|
501
507
|
error=error_component
|
@@ -505,12 +511,12 @@ class LLMTracerMixin:
|
|
505
511
|
raise
|
506
512
|
|
507
513
|
def trace_llm(self, name: str = None):
|
508
|
-
self.current_llm_call_name.set(name)
|
509
514
|
def decorator(func):
|
510
515
|
@self.file_tracker.trace_decorator
|
511
516
|
@functools.wraps(func)
|
512
517
|
async def async_wrapper(*args, **kwargs):
|
513
518
|
self.gt = kwargs.get('gt', None) if kwargs else None
|
519
|
+
self.current_llm_call_name.set(name)
|
514
520
|
if not self.is_active:
|
515
521
|
return await func(*args, **kwargs)
|
516
522
|
|
@@ -560,6 +566,7 @@ class LLMTracerMixin:
|
|
560
566
|
@functools.wraps(func)
|
561
567
|
def sync_wrapper(*args, **kwargs):
|
562
568
|
self.gt = kwargs.get('gt', None) if kwargs else None
|
569
|
+
self.current_llm_call_name.set(name)
|
563
570
|
if not self.is_active:
|
564
571
|
return func(*args, **kwargs)
|
565
572
|
|
@@ -75,7 +75,6 @@ class ToolTracerMixin:
|
|
75
75
|
result = func(*args, **kwargs)
|
76
76
|
|
77
77
|
# Calculate resource usage
|
78
|
-
end_time = datetime.now().astimezone()
|
79
78
|
end_memory = psutil.Process().memory_info().rss
|
80
79
|
memory_used = max(0, end_memory - start_memory)
|
81
80
|
|
@@ -91,7 +90,6 @@ class ToolTracerMixin:
|
|
91
90
|
version=version,
|
92
91
|
memory_used=memory_used,
|
93
92
|
start_time=start_time,
|
94
|
-
end_time=end_time,
|
95
93
|
input_data=self._sanitize_input(args, kwargs),
|
96
94
|
output_data=self._sanitize_output(result)
|
97
95
|
)
|
@@ -110,8 +108,6 @@ class ToolTracerMixin:
|
|
110
108
|
# End tracking network calls for this component
|
111
109
|
self.end_component(component_id)
|
112
110
|
|
113
|
-
end_time = datetime.now().astimezone()
|
114
|
-
|
115
111
|
tool_component = self.create_tool_component(
|
116
112
|
component_id=component_id,
|
117
113
|
hash_id=hash_id,
|
@@ -120,7 +116,6 @@ class ToolTracerMixin:
|
|
120
116
|
version=version,
|
121
117
|
memory_used=0,
|
122
118
|
start_time=start_time,
|
123
|
-
end_time=end_time,
|
124
119
|
input_data=self._sanitize_input(args, kwargs),
|
125
120
|
output_data=None,
|
126
121
|
error=error_component
|
@@ -144,7 +139,6 @@ class ToolTracerMixin:
|
|
144
139
|
result = await func(*args, **kwargs)
|
145
140
|
|
146
141
|
# Calculate resource usage
|
147
|
-
end_time = datetime.now().astimezone()
|
148
142
|
end_memory = psutil.Process().memory_info().rss
|
149
143
|
memory_used = max(0, end_memory - start_memory)
|
150
144
|
|
@@ -156,7 +150,6 @@ class ToolTracerMixin:
|
|
156
150
|
tool_type=tool_type,
|
157
151
|
version=version,
|
158
152
|
start_time=start_time,
|
159
|
-
end_time=end_time,
|
160
153
|
memory_used=memory_used,
|
161
154
|
input_data=self._sanitize_input(args, kwargs),
|
162
155
|
output_data=self._sanitize_output(result)
|
@@ -172,8 +165,6 @@ class ToolTracerMixin:
|
|
172
165
|
"details": {}
|
173
166
|
}
|
174
167
|
|
175
|
-
end_time = datetime.now().astimezone()
|
176
|
-
|
177
168
|
tool_component = self.create_tool_component(
|
178
169
|
component_id=component_id,
|
179
170
|
hash_id=hash_id,
|
@@ -181,7 +172,6 @@ class ToolTracerMixin:
|
|
181
172
|
tool_type=tool_type,
|
182
173
|
version=version,
|
183
174
|
start_time=start_time,
|
184
|
-
end_time=end_time,
|
185
175
|
memory_used=0,
|
186
176
|
input_data=self._sanitize_input(args, kwargs),
|
187
177
|
output_data=None,
|
@@ -202,7 +192,7 @@ class ToolTracerMixin:
|
|
202
192
|
"type": "tool",
|
203
193
|
"name": kwargs["name"],
|
204
194
|
"start_time": start_time.isoformat(),
|
205
|
-
"end_time":
|
195
|
+
"end_time": datetime.now().astimezone().isoformat(),
|
206
196
|
"error": kwargs.get("error"),
|
207
197
|
"parent_id": self.current_agent_id.get(),
|
208
198
|
"info": {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.2b4
|
4
4
|
Summary: RAGA AI CATALYST
|
5
5
|
Author-email: Kiran Scaria <kiran.scaria@raga.ai>, Kedar Gaikwad <kedar.gaikwad@raga.ai>, Dushyant Mahajan <dushyant.mahajan@raga.ai>, Siddhartha Kosti <siddhartha.kosti@raga.ai>, Ritika Goel <ritika.goel@raga.ai>, Vijay Chaurasia <vijay.chaurasia@raga.ai>
|
6
6
|
Requires-Python: <3.13,>=3.9
|
@@ -26,12 +26,12 @@ ragaai_catalyst/tracers/agentic_tracing/tests/__init__.py,sha256=47DEQpj8HBSa-_T
|
|
26
26
|
ragaai_catalyst/tracers/agentic_tracing/tests/ai_travel_agent.py,sha256=S4rCcKzU_5SB62BYEbNn_1VbbTdG4396N8rdZ3ZNGcE,5654
|
27
27
|
ragaai_catalyst/tracers/agentic_tracing/tests/unique_decorator_test.py,sha256=Xk1cLzs-2A3dgyBwRRnCWs7Eubki40FVonwd433hPN8,4805
|
28
28
|
ragaai_catalyst/tracers/agentic_tracing/tracers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/agent_tracer.py,sha256=
|
29
|
+
ragaai_catalyst/tracers/agentic_tracing/tracers/agent_tracer.py,sha256=FOKJUMd48s8NFoTiZINeWBPA4IjMo5o1r9nuDEzIerA,20945
|
30
30
|
ragaai_catalyst/tracers/agentic_tracing/tracers/base.py,sha256=liLdiHdqc6BHH4YyvrdmX_fprXoeJchOqBwmzMJPrCc,14075
|
31
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py,sha256=
|
31
|
+
ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py,sha256=EWcse5vJdOO5a3uSuEL6TKRsnvKIW_H9qbUVgRTxq1M,25449
|
32
32
|
ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=tdwkpWx_eSyXtbpWTo9RG_cF_6q1F8oB0XyF4OiRKh8,10363
|
33
33
|
ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py,sha256=6FTA15xMnum9omM_0Jd9cMIuWdKu1gR5Tc8fOXAkP8E,10068
|
34
|
-
ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=
|
34
|
+
ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=Rln82_4BEL_4ULOIhWwu2-qGQ8J1yEaf9qKsEBuj76o,8427
|
35
35
|
ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=wsCwTK7tM_L3mdNrcg5Mq3D1k07XCHZkhOB26kz_rLY,1472
|
36
36
|
ragaai_catalyst/tracers/agentic_tracing/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=2Ab8odZXMpYFTh8a7tO53qx9RptF-xxyfgtFN0A6GzI,7690
|
@@ -54,7 +54,7 @@ ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hak
|
|
54
54
|
ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
|
55
55
|
ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
|
56
56
|
ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
|
57
|
-
ragaai_catalyst-2.1.
|
58
|
-
ragaai_catalyst-2.1.
|
59
|
-
ragaai_catalyst-2.1.
|
60
|
-
ragaai_catalyst-2.1.
|
57
|
+
ragaai_catalyst-2.1.2b4.dist-info/METADATA,sha256=yrtCVe68YRRwrejlCWGHpRGDo2e9Vh6dAnHJHGJvS4M,1804
|
58
|
+
ragaai_catalyst-2.1.2b4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
59
|
+
ragaai_catalyst-2.1.2b4.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
|
60
|
+
ragaai_catalyst-2.1.2b4.dist-info/RECORD,,
|
File without changes
|
File without changes
|