ragaai-catalyst 2.1.4b2__py3-none-any.whl → 2.1.4b4__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.
@@ -218,7 +218,7 @@ class Component:
218
218
  id=interaction.get("id", str(uuid.uuid4())),
219
219
  type=interaction.get("interaction_type", ""),
220
220
  content=str(interaction.get("content", "")),
221
- timestamp=interaction.get("timestamp", datetime.utcnow().isoformat())
221
+ timestamp=interaction.get("timestamp", datetime.now().astimezone().isoformat())
222
222
  )
223
223
  )
224
224
  else:
@@ -117,7 +117,7 @@ class AgentTracerMixin:
117
117
  agent_type=agent_type,
118
118
  version=version,
119
119
  capabilities=capabilities or [],
120
- start_time=datetime.now(),
120
+ start_time=datetime.now().astimezone().isoformat(),
121
121
  memory_used=0,
122
122
  input_data=tracer._sanitize_input(args, kwargs),
123
123
  output_data=None,
@@ -167,7 +167,7 @@ class AgentTracerMixin:
167
167
  children_token = tracer.agent_children.set([])
168
168
 
169
169
  try:
170
- start_time = datetime.now()
170
+ start_time = datetime.now().astimezone().isoformat()
171
171
  result = method(self, *args, **kwargs)
172
172
 
173
173
  # Update agent component with method result
@@ -183,7 +183,7 @@ class AgentTracerMixin:
183
183
  tracer._sanitize_input(args, kwargs)
184
184
  )
185
185
  component["start_time"] = (
186
- start_time.isoformat()
186
+ start_time
187
187
  )
188
188
 
189
189
  # Get children accumulated during method execution
@@ -265,7 +265,7 @@ class AgentTracerMixin:
265
265
  if not self.auto_instrument_agent:
266
266
  return func(*args, **kwargs)
267
267
 
268
- start_time = datetime.now()
268
+ start_time = datetime.now().astimezone().isoformat()
269
269
  self.start_time = start_time
270
270
  self.input_data = self._sanitize_input(args, kwargs)
271
271
  start_memory = psutil.Process().memory_info().rss
@@ -390,7 +390,7 @@ class AgentTracerMixin:
390
390
  if not self.auto_instrument_agent:
391
391
  return await func(*args, **kwargs)
392
392
 
393
- start_time = datetime.now()
393
+ start_time = datetime.now().astimezone().isoformat()
394
394
  start_memory = psutil.Process().memory_info().rss
395
395
  component_id = str(uuid.uuid4())
396
396
 
@@ -533,7 +533,7 @@ class AgentTracerMixin:
533
533
  "source_hash_id": None,
534
534
  "type": "agent",
535
535
  "name": kwargs["name"],
536
- "start_time": start_time.isoformat(),
536
+ "start_time": start_time,
537
537
  "end_time": datetime.now().astimezone().isoformat(),
538
538
  "error": kwargs.get("error"),
539
539
  "parent_id": kwargs.get("parent_id"),
@@ -170,11 +170,11 @@ class BaseTracer:
170
170
  self.trace_id = str(uuid.uuid4())
171
171
 
172
172
  # Get the start time
173
- self.start_time = datetime.now().isoformat()
173
+ self.start_time = datetime.now().astimezone().isoformat()
174
174
 
175
175
  self.data_key = [
176
176
  {
177
- "start_time": datetime.now().isoformat(),
177
+ "start_time": datetime.now().astimezone().isoformat(),
178
178
  "end_time": "",
179
179
  "spans": self.components,
180
180
  }
@@ -184,7 +184,7 @@ class BaseTracer:
184
184
  id=self.trace_id,
185
185
  trace_name=self.trace_name,
186
186
  project_name=self.project_name,
187
- start_time=datetime.now().isoformat(),
187
+ start_time=datetime.now().astimezone().isoformat(),
188
188
  end_time="", # Will be set when trace is stopped
189
189
  metadata=metadata,
190
190
  data=self.data_key,
@@ -194,8 +194,8 @@ class BaseTracer:
194
194
  def stop(self):
195
195
  """Stop the trace and save to JSON file"""
196
196
  if hasattr(self, "trace"):
197
- self.trace.data[0]["end_time"] = datetime.now().isoformat()
198
- self.trace.end_time = datetime.now().isoformat()
197
+ self.trace.data[0]["end_time"] = datetime.now().astimezone().isoformat()
198
+ self.trace.end_time = datetime.now().astimezone().isoformat()
199
199
 
200
200
  # Change span ids to int
201
201
  self.trace = self._change_span_ids_to_int(self.trace)
@@ -284,17 +284,25 @@ class BaseTracer:
284
284
  def __exit__(self, exc_type, exc_value, traceback):
285
285
  self.stop()
286
286
 
287
+ def _process_children(self, children_list, parent_id, current_id):
288
+ """Helper function to process children recursively."""
289
+ for child in children_list:
290
+ child["id"] = current_id
291
+ child["parent_id"] = parent_id
292
+ current_id += 1
293
+ # Recursively process nested children if they exist
294
+ if "children" in child["data"]:
295
+ current_id = self._process_children(child["data"]["children"], child["id"], current_id)
296
+ return current_id
297
+
287
298
  def _change_span_ids_to_int(self, trace):
288
299
  id, parent_id = 1, 0
289
300
  for span in trace.data[0]["spans"]:
290
301
  span.id = id
291
302
  span.parent_id = parent_id
292
303
  id += 1
293
- if span.type == "agent":
294
- for children in span.data["children"]:
295
- children["id"] = id
296
- children["parent_id"] = span.id
297
- id += 1
304
+ if span.type == "agent" and "children" in span.data:
305
+ id = self._process_children(span.data["children"], span.id, id)
298
306
  return trace
299
307
 
300
308
  def _change_agent_input_output(self, trace):
@@ -445,63 +453,169 @@ class BaseTracer:
445
453
  def add_tags(self, tags: List[str]):
446
454
  raise NotImplementedError
447
455
 
448
- # def _add_span_attributes_to_trace(self, trace):
449
- # if not hasattr(trace, 'data'):
450
- # return trace
451
- # for data in trace.data:
452
- # for span in data.get('spans', []):
453
- # if not hasattr(span, 'name'):
454
- # continue
455
- # span_name = span.name
456
- # if span_name in self.span_attributes_dict:
457
- # span_attributes = self.span_attributes_dict[span_name]
458
- # span = self._add_span_attributes_to_span(span_attributes, span)
459
- # if hasattr(span, 'type'):
460
- # if span.type == 'agent':
461
- # if hasattr(span, 'data'):
462
- # if 'children' in span.data:
463
- # span.data['children'] = self._add_span_attributes_to_children(span_attributes, span.data['children'])
464
-
465
- # return trace
466
-
467
- # def _add_span_attributes_to_children(self, span_attributes: SpanAttributes, children):
468
- # attributed_children = []
469
- # for child in children:
470
- # if 'name' not in child:
471
- # continue
472
- # child_name = child['name']
473
- # if child_name in self.span_attributes_dict:
474
- # span_attributes = self.span_attributes_dict[child_name]
475
- # child = self._add_span_attributes_to_span(span_attributes, child)
476
- # if 'type' in child:
477
- # if child['type'] == 'agent':
478
- # if 'data' in child:
479
- # if 'children' in child['data']:
480
- # child['data']['children'] = self._add_span_attributes_to_children(span_attributes, child['data']['children'])
481
- # attributed_children.append(child)
482
- # return attributed_children
483
-
484
- # def _add_span_attributes_to_span(self, span_attributes: SpanAttributes, span):
485
- # metadata = {
486
- # 'tags': span_attributes.tags,
487
- # 'user_metadata': span_attributes.metadata
488
- # }
489
- # metrics = span_attributes.metrics
490
- # feedback = span_attributes.feedback
491
- # if isinstance(span, dict):
492
- # span['metadata'] = metadata
493
- # span['metrics'] = metrics
494
- # span['feedback'] = feedback
495
- # else:
496
- # span.metadata = metadata
497
- # span.metrics = metrics
498
- # span.feedback = feedback
499
- # return span
456
+ def _process_child_interactions(self, child, interaction_id, interactions):
457
+ """
458
+ Helper method to process child interactions recursively.
459
+
460
+ Args:
461
+ child (dict): The child span to process
462
+ interaction_id (int): Current interaction ID
463
+ interactions (list): List of interactions to append to
464
+
465
+ Returns:
466
+ int: Next interaction ID to use
467
+ """
468
+ child_type = child.get("type")
469
+
470
+ if child_type == "tool":
471
+ # Tool call start
472
+ interactions.append(
473
+ {
474
+ "id": str(interaction_id),
475
+ "span_id": child.get("id"),
476
+ "interaction_type": "tool_call_start",
477
+ "name": child.get("name"),
478
+ "content": {
479
+ "parameters": [
480
+ child.get("data", {}).get("input", {}).get("args"),
481
+ child.get("data", {}).get("input", {}).get("kwargs"),
482
+ ]
483
+ },
484
+ "timestamp": child.get("start_time"),
485
+ "error": child.get("error"),
486
+ }
487
+ )
488
+ interaction_id += 1
489
+
490
+ # Tool call end
491
+ interactions.append(
492
+ {
493
+ "id": str(interaction_id),
494
+ "span_id": child.get("id"),
495
+ "interaction_type": "tool_call_end",
496
+ "name": child.get("name"),
497
+ "content": {
498
+ "returns": child.get("data", {}).get("output"),
499
+ },
500
+ "timestamp": child.get("end_time"),
501
+ "error": child.get("error"),
502
+ }
503
+ )
504
+ interaction_id += 1
505
+
506
+ elif child_type == "llm":
507
+ interactions.append(
508
+ {
509
+ "id": str(interaction_id),
510
+ "span_id": child.get("id"),
511
+ "interaction_type": "llm_call_start",
512
+ "name": child.get("name"),
513
+ "content": {
514
+ "prompt": child.get("data", {}).get("input"),
515
+ },
516
+ "timestamp": child.get("start_time"),
517
+ "error": child.get("error"),
518
+ }
519
+ )
520
+ interaction_id += 1
521
+
522
+ interactions.append(
523
+ {
524
+ "id": str(interaction_id),
525
+ "span_id": child.get("id"),
526
+ "interaction_type": "llm_call_end",
527
+ "name": child.get("name"),
528
+ "content": {
529
+ "response": child.get("data", {}).get("output")
530
+ },
531
+ "timestamp": child.get("end_time"),
532
+ "error": child.get("error"),
533
+ }
534
+ )
535
+ interaction_id += 1
536
+
537
+ elif child_type == "agent":
538
+ interactions.append(
539
+ {
540
+ "id": str(interaction_id),
541
+ "span_id": child.get("id"),
542
+ "interaction_type": "agent_call_start",
543
+ "name": child.get("name"),
544
+ "content": None,
545
+ "timestamp": child.get("start_time"),
546
+ "error": child.get("error"),
547
+ }
548
+ )
549
+ interaction_id += 1
500
550
 
501
- def span(self, span_name):
502
- if span_name not in self.span_attributes_dict:
503
- self.span_attributes_dict[span_name] = SpanAttributes(span_name)
504
- return self.span_attributes_dict[span_name]
551
+ # Process nested children recursively
552
+ if "children" in child.get("data", {}):
553
+ for nested_child in child["data"]["children"]:
554
+ interaction_id = self._process_child_interactions(
555
+ nested_child, interaction_id, interactions
556
+ )
557
+
558
+ interactions.append(
559
+ {
560
+ "id": str(interaction_id),
561
+ "span_id": child.get("id"),
562
+ "interaction_type": "agent_call_end",
563
+ "name": child.get("name"),
564
+ "content": child.get("data", {}).get("output"),
565
+ "timestamp": child.get("end_time"),
566
+ "error": child.get("error"),
567
+ }
568
+ )
569
+ interaction_id += 1
570
+
571
+ else:
572
+ interactions.append(
573
+ {
574
+ "id": str(interaction_id),
575
+ "span_id": child.get("id"),
576
+ "interaction_type": child_type,
577
+ "name": child.get("name"),
578
+ "content": child.get("data", {}),
579
+ "timestamp": child.get("start_time"),
580
+ "error": child.get("error"),
581
+ }
582
+ )
583
+ interaction_id += 1
584
+
585
+ # Process additional interactions and network calls
586
+ if "interactions" in child:
587
+ for interaction in child["interactions"]:
588
+ interaction["id"] = str(interaction_id)
589
+ interaction["span_id"] = child.get("id")
590
+ interaction["error"] = None
591
+ interactions.append(interaction)
592
+ interaction_id += 1
593
+
594
+ if "network_calls" in child:
595
+ for child_network_call in child["network_calls"]:
596
+ network_call = {}
597
+ network_call["id"] = str(interaction_id)
598
+ network_call["span_id"] = child.get("id")
599
+ network_call["interaction_type"] = "network_call"
600
+ network_call["name"] = None
601
+ network_call["content"] = {
602
+ "request": {
603
+ "url": child_network_call.get("url"),
604
+ "method": child_network_call.get("method"),
605
+ "headers": child_network_call.get("headers"),
606
+ },
607
+ "response": {
608
+ "status_code": child_network_call.get("status_code"),
609
+ "headers": child_network_call.get("response_headers"),
610
+ "body": child_network_call.get("response_body"),
611
+ },
612
+ }
613
+ network_call["timestamp"] = child_network_call.get("start_time")
614
+ network_call["error"] = child_network_call.get("error")
615
+ interactions.append(network_call)
616
+ interaction_id += 1
617
+
618
+ return interaction_id
505
619
 
506
620
  def format_interactions(self) -> dict:
507
621
  """
@@ -513,14 +627,14 @@ class BaseTracer:
513
627
  tool_call_end, llm_call, file_read, file_write, network_call.
514
628
 
515
629
  Returns:
516
- dict: A dictionary with "interactions" key containing a list of interactions
630
+ dict: A dictionary with "workflow" key containing a list of interactions
517
631
  sorted by timestamp.
518
632
  """
519
633
  interactions = []
520
634
  interaction_id = 1
521
635
 
522
636
  if not hasattr(self, "trace") or not self.trace.data:
523
- return {"interactions": []}
637
+ return {"workflow": []}
524
638
 
525
639
  for span in self.trace.data[0]["spans"]:
526
640
  # Process agent spans
@@ -539,159 +653,12 @@ class BaseTracer:
539
653
  )
540
654
  interaction_id += 1
541
655
 
542
- # Process children of agent
656
+ # Process children of agent recursively
543
657
  if "children" in span.data:
544
658
  for child in span.data["children"]:
545
- child_type = child.get("type")
546
- if child_type == "tool":
547
- # Tool call start
548
- interactions.append(
549
- {
550
- "id": str(interaction_id),
551
- "span_id": child.get("id"),
552
- "interaction_type": "tool_call_start",
553
- "name": child.get("name"),
554
- "content": {
555
- "parameters": [
556
- child.get("data", {})
557
- .get("input")
558
- .get("args"),
559
- child.get("data", {})
560
- .get("input")
561
- .get("kwargs"),
562
- ]
563
- },
564
- "timestamp": child.get("start_time"),
565
- "error": child.get("error"),
566
- }
567
- )
568
- interaction_id += 1
569
-
570
- # Tool call end
571
- interactions.append(
572
- {
573
- "id": str(interaction_id),
574
- "span_id": child.get("id"),
575
- "interaction_type": "tool_call_end",
576
- "name": child.get("name"),
577
- "content": {
578
- "returns": child.get("data", {}).get("output"),
579
- },
580
- "timestamp": child.get("end_time"),
581
- "error": child.get("error"),
582
- }
583
- )
584
- interaction_id += 1
585
-
586
- elif child_type == "llm":
587
- interactions.append(
588
- {
589
- "id": str(interaction_id),
590
- "span_id": child.get("id"),
591
- "interaction_type": "llm_call_start",
592
- "name": child.get("name"),
593
- "content": {
594
- "prompt": child.get("data", {}).get("input"),
595
- },
596
- "timestamp": child.get("start_time"),
597
- "error": child.get("error"),
598
- }
599
- )
600
- interaction_id += 1
601
-
602
- interactions.append(
603
- {
604
- "id": str(interaction_id),
605
- "span_id": child.get("id"),
606
- "interaction_type": "llm_call_end",
607
- "name": child.get("name"),
608
- "content": {
609
- "response": child.get("data", {}).get("output")
610
- },
611
- "timestamp": child.get("end_time"),
612
- "error": child.get("error"),
613
- }
614
- )
615
- interaction_id += 1
616
-
617
- elif child_type == "agent":
618
- interactions.append(
619
- {
620
- "id": str(interaction_id),
621
- "span_id": child.get("id"),
622
- "interaction_type": "agent_call_start",
623
- "name": child.get("name"),
624
- "content": None,
625
- "timestamp": child.get("start_time"),
626
- "error": child.get("error"),
627
- }
628
- )
629
- interaction_id += 1
630
-
631
- interactions.append(
632
- {
633
- "id": str(interaction_id),
634
- "span_id": child.get("id"),
635
- "interaction_type": "agent_call_end",
636
- "name": child.get("name"),
637
- "content": child.get("data", {}).get("output"),
638
- "timestamp": child.get("end_time"),
639
- "error": child.get("error"),
640
- }
641
- )
642
- interaction_id += 1
643
-
644
- else:
645
- interactions.append(
646
- {
647
- "id": str(interaction_id),
648
- "span_id": child.get("id"),
649
- "interaction_type": child_type,
650
- "name": child.get("name"),
651
- "content": child.get("data", {}),
652
- "timestamp": child.get("start_time"),
653
- "error": child.get("error"),
654
- }
655
- )
656
- interaction_id += 1
657
-
658
- if "interactions" in child:
659
- for interaction in child["interactions"]:
660
- interaction["id"] = str(interaction_id)
661
- interaction["span_id"] = child.get("id")
662
- interaction["error"] = None
663
- interactions.append(interaction)
664
- interaction_id += 1
665
-
666
- if "network_calls" in child:
667
- for child_network_call in child["network_calls"]:
668
- network_call = {}
669
- network_call["id"] = str(interaction_id)
670
- network_call["span_id"] = child.get("id")
671
- network_call["interaction_type"] = "network_call"
672
- network_call["name"] = None
673
- network_call["content"] = {
674
- "request": {
675
- "url": child_network_call.get("url"),
676
- "method": child_network_call.get("method"),
677
- "headers": child_network_call.get("headers"),
678
- },
679
- "response": {
680
- "status_code": child_network_call.get(
681
- "status_code"
682
- ),
683
- "headers": child_network_call.get(
684
- "response_headers"
685
- ),
686
- "body": child_network_call.get("response_body"),
687
- },
688
- }
689
- network_call["timestamp"] = child_network_call[
690
- "start_time"
691
- ]
692
- network_call["error"] = child_network_call.get("error")
693
- interactions.append(network_call)
694
- interaction_id += 1
659
+ interaction_id = self._process_child_interactions(
660
+ child, interaction_id, interactions
661
+ )
695
662
 
696
663
  # Add agent_end interaction
697
664
  interactions.append(
@@ -830,3 +797,8 @@ class BaseTracer:
830
797
  interaction["id"] = str(idx)
831
798
 
832
799
  return {"workflow": sorted_interactions}
800
+
801
+ def span(self, span_name):
802
+ if span_name not in self.span_attributes_dict:
803
+ self.span_attributes_dict[span_name] = SpanAttributes(span_name)
804
+ return self.span_attributes_dict[span_name]
@@ -69,7 +69,7 @@ class CustomTracerMixin:
69
69
  if not self.is_active or not self.auto_instrument_custom:
70
70
  return func(*args, **kwargs)
71
71
 
72
- start_time = datetime.now().astimezone()
72
+ start_time = datetime.now().astimezone().isoformat()
73
73
  start_memory = psutil.Process().memory_info().rss
74
74
  component_id = str(uuid.uuid4())
75
75
  hash_id = generate_unique_hash_simple(func)
@@ -91,7 +91,6 @@ class CustomTracerMixin:
91
91
  pass
92
92
  return trace_variables_func
93
93
 
94
- sys.settrace(trace_variables_func)
95
94
 
96
95
  # Start tracking network calls for this component
97
96
  self.start_component(component_id)
@@ -101,7 +100,7 @@ class CustomTracerMixin:
101
100
  result = func(*args, **kwargs)
102
101
 
103
102
  # Calculate resource usage
104
- end_time = datetime.now().astimezone()
103
+ end_time = datetime.now().astimezone().isoformat()
105
104
  end_memory = psutil.Process().memory_info().rss
106
105
  memory_used = max(0, end_memory - start_memory)
107
106
 
@@ -137,7 +136,7 @@ class CustomTracerMixin:
137
136
  # End tracking network calls for this component
138
137
  self.end_component(component_id)
139
138
 
140
- end_time = datetime.now().astimezone()
139
+ end_time = datetime.now().astimezone().isoformat()
141
140
 
142
141
  custom_component = self.create_custom_component(
143
142
  component_id=component_id,
@@ -156,16 +155,13 @@ class CustomTracerMixin:
156
155
 
157
156
  self.add_component(custom_component)
158
157
  raise
159
- finally:
160
- if trace_variables:
161
- sys.settrace(None)
162
158
 
163
159
  async def _trace_custom_execution(self, func, name, custom_type, version, trace_variables, *args, **kwargs):
164
160
  """Asynchronous version of custom tracing"""
165
161
  if not self.is_active or not self.auto_instrument_custom:
166
162
  return await func(*args, **kwargs)
167
163
 
168
- start_time = datetime.now().astimezone()
164
+ start_time = datetime.now().astimezone().isoformat()
169
165
  start_memory = psutil.Process().memory_info().rss
170
166
  component_id = str(uuid.uuid4())
171
167
  hash_id = generate_unique_hash_simple(func)
@@ -187,14 +183,12 @@ class CustomTracerMixin:
187
183
  pass
188
184
  return trace_variables_func
189
185
 
190
- sys.settrace(trace_variables_func)
191
-
192
186
  try:
193
187
  # Execute the function
194
188
  result = await func(*args, **kwargs)
195
189
 
196
190
  # Calculate resource usage
197
- end_time = datetime.now().astimezone()
191
+ end_time = datetime.now().astimezone().isoformat()
198
192
  end_memory = psutil.Process().memory_info().rss
199
193
  memory_used = max(0, end_memory - start_memory)
200
194
 
@@ -223,7 +217,7 @@ class CustomTracerMixin:
223
217
  "details": {}
224
218
  }
225
219
 
226
- end_time = datetime.now().astimezone()
220
+ end_time = datetime.now().astimezone().isoformat()
227
221
 
228
222
  custom_component = self.create_custom_component(
229
223
  component_id=component_id,
@@ -241,9 +235,6 @@ class CustomTracerMixin:
241
235
  )
242
236
  self.add_component(custom_component)
243
237
  raise
244
- finally:
245
- if trace_variables:
246
- sys.settrace(None)
247
238
 
248
239
  def create_custom_component(self, **kwargs):
249
240
  """Create a custom component according to the data structure"""
@@ -263,8 +254,8 @@ class CustomTracerMixin:
263
254
  "source_hash_id": None,
264
255
  "type": "custom",
265
256
  "name": kwargs["name"],
266
- "start_time": start_time.isoformat(),
267
- "end_time": kwargs["end_time"].isoformat(),
257
+ "start_time": start_time,
258
+ "end_time": kwargs["end_time"],
268
259
  "error": kwargs.get("error"),
269
260
  "parent_id": self.current_agent_id.get() if hasattr(self, 'current_agent_id') else None,
270
261
  "info": {
@@ -665,7 +665,7 @@ class LLMTracerMixin:
665
665
  "type": type(e).__name__,
666
666
  "message": str(e),
667
667
  "traceback": traceback.format_exc(),
668
- "timestamp": datetime.now().isoformat(),
668
+ "timestamp": datetime.now().astimezone().isoformat(),
669
669
  }
670
670
  }
671
671
  raise
@@ -708,7 +708,7 @@ class LLMTracerMixin:
708
708
  parent_agent_id = self.current_agent_id.get()
709
709
  self.start_component(component_id)
710
710
 
711
- start_time = datetime.now()
711
+ start_time = datetime.now().astimezone().isoformat()
712
712
  error_info = None
713
713
  result = None
714
714
 
@@ -721,7 +721,7 @@ class LLMTracerMixin:
721
721
  "type": type(e).__name__,
722
722
  "message": str(e),
723
723
  "traceback": traceback.format_exc(),
724
- "timestamp": datetime.now().isoformat(),
724
+ "timestamp": datetime.now().astimezone().isoformat(),
725
725
  }
726
726
  }
727
727
  raise
@@ -346,7 +346,7 @@ class AgenticTracing(
346
346
  version=self.version.get(),
347
347
  capabilities=self.capabilities.get(),
348
348
  start_time=self.start_time,
349
- end_time=datetime.now(),
349
+ end_time=datetime.now().astimezone().isoformat(),
350
350
  memory_used=0,
351
351
  input_data=self.input_data,
352
352
  output_data=None,
@@ -105,10 +105,10 @@ def monkey_patch_urllib(network_tracer):
105
105
  method = url.get_method()
106
106
  url_str = url.full_url
107
107
 
108
- start_time = datetime.now()
108
+ start_time = datetime.now().astimezone()
109
109
  try:
110
110
  response = original_urlopen(url, data, timeout, *args, **kwargs)
111
- end_time = datetime.now()
111
+ end_time = datetime.now().astimezone()
112
112
  network_tracer.record_call(
113
113
  method=method,
114
114
  url=url_str,
@@ -122,7 +122,7 @@ def monkey_patch_urllib(network_tracer):
122
122
  )
123
123
  return response
124
124
  except Exception as e:
125
- end_time = datetime.now()
125
+ end_time = datetime.now().astimezone()
126
126
  network_tracer.record_call(
127
127
  method=method,
128
128
  url=url_str,
@@ -144,10 +144,10 @@ def monkey_patch_requests(network_tracer):
144
144
  original_request = requests.Session.request
145
145
 
146
146
  def patched_request(self, method, url, *args, **kwargs):
147
- start_time = datetime.now()
147
+ start_time = datetime.now().astimezone()
148
148
  try:
149
149
  response = original_request(self, method, url, *args, **kwargs)
150
- end_time = datetime.now()
150
+ end_time = datetime.now().astimezone()
151
151
  network_tracer.record_call(
152
152
  method=method,
153
153
  url=url,
@@ -161,7 +161,7 @@ def monkey_patch_requests(network_tracer):
161
161
  )
162
162
  return response
163
163
  except Exception as e:
164
- end_time = datetime.now()
164
+ end_time = datetime.now().astimezone()
165
165
  network_tracer.record_call(
166
166
  method=method,
167
167
  url=url,
@@ -184,7 +184,7 @@ def monkey_patch_http_client(network_tracer):
184
184
  original_https_request = HTTPSConnection.request
185
185
 
186
186
  def patched_request(self, method, url, body=None, headers=None, *args, **kwargs):
187
- start_time = datetime.now()
187
+ start_time = datetime.now().astimezone()
188
188
  try:
189
189
  result = (
190
190
  original_http_request(self, method, url, body, headers, *args, **kwargs)
@@ -194,7 +194,7 @@ def monkey_patch_http_client(network_tracer):
194
194
  )
195
195
  )
196
196
  response = self.getresponse()
197
- end_time = datetime.now()
197
+ end_time = datetime.now().astimezone()
198
198
  network_tracer.record_call(
199
199
  method=method,
200
200
  url=f"{self._http_vsn_str} {self.host}:{self.port}{url}",
@@ -208,7 +208,7 @@ def monkey_patch_http_client(network_tracer):
208
208
  )
209
209
  return result
210
210
  except Exception as e:
211
- end_time = datetime.now()
211
+ end_time = datetime.now().astimezone()
212
212
  network_tracer.record_call(
213
213
  method=method,
214
214
  url=f"{self._http_vsn_str} {self.host}:{self.port}{url}",
@@ -233,10 +233,10 @@ def monkey_patch_socket(network_tracer):
233
233
 
234
234
  def patched_create_connection(address, *args, **kwargs):
235
235
  host, port = address
236
- start_time = datetime.now()
236
+ start_time = datetime.now().astimezone()
237
237
  try:
238
238
  result = original_create_connection(address, *args, **kwargs)
239
- end_time = datetime.now()
239
+ end_time = datetime.now().astimezone()
240
240
  network_tracer.record_call(
241
241
  method="CONNECT",
242
242
  url=f"{host}:{port}",
@@ -245,7 +245,7 @@ def monkey_patch_socket(network_tracer):
245
245
  )
246
246
  return result
247
247
  except Exception as e:
248
- end_time = datetime.now()
248
+ end_time = datetime.now().astimezone()
249
249
  network_tracer.record_call(
250
250
  method="CONNECT",
251
251
  url=f"{host}:{port}",
@@ -265,10 +265,10 @@ def restore_socket(original_create_connection):
265
265
 
266
266
  async def patch_aiohttp_trace_config(network_tracer):
267
267
  async def on_request_start(session, trace_config_ctx, params):
268
- trace_config_ctx.start = datetime.now()
268
+ trace_config_ctx.start = datetime.now().astimezone()
269
269
 
270
270
  async def on_request_end(session, trace_config_ctx, params):
271
- end_time = datetime.now()
271
+ end_time = datetime.now().astimezone()
272
272
  response = params.response
273
273
  network_tracer.record_call(
274
274
  method=params.method,
@@ -58,7 +58,7 @@ class UserInteractionTracer:
58
58
  "component_id": self.component_id.get(),
59
59
  "interaction_type": "input",
60
60
  "content": content,
61
- "timestamp": datetime.now().isoformat()
61
+ "timestamp": datetime.now().astimezone().isoformat()
62
62
  })
63
63
  return content
64
64
 
@@ -70,7 +70,7 @@ class UserInteractionTracer:
70
70
  "component_id": self.component_id.get(),
71
71
  "interaction_type": "output",
72
72
  "content": content,
73
- "timestamp": datetime.now().isoformat()
73
+ "timestamp": datetime.now().astimezone().isoformat()
74
74
  })
75
75
  return self.original_print(*args, **kwargs)
76
76
 
@@ -112,7 +112,7 @@ class UserInteractionTracer:
112
112
  "component_id": self.component_id.get(),
113
113
  "interaction_type": interaction_type,
114
114
  "file_path": file_path,
115
- "timestamp": datetime.now().isoformat()
115
+ "timestamp": datetime.now().astimezone().isoformat()
116
116
  }
117
117
  interaction.update(kwargs)
118
118
  self.interactions.append(interaction)
@@ -1959,6 +1959,20 @@
1959
1959
  "litellm_provider": "mistral",
1960
1960
  "mode": "embedding"
1961
1961
  },
1962
+ "deepseek/deepseek-reasoner": {
1963
+ "max_tokens": 8192,
1964
+ "max_input_tokens": 64000,
1965
+ "max_output_tokens": 8192,
1966
+ "input_cost_per_token": 5.5e-07,
1967
+ "input_cost_per_token_cache_hit": 1.4e-07,
1968
+ "output_cost_per_token": 2.19e-06,
1969
+ "litellm_provider": "deepseek",
1970
+ "mode": "chat",
1971
+ "supports_function_calling": true,
1972
+ "supports_assistant_prefill": true,
1973
+ "supports_tool_choice": true,
1974
+ "supports_prompt_caching": true
1975
+ },
1962
1976
  "deepseek/deepseek-chat": {
1963
1977
  "max_tokens": 4096,
1964
1978
  "max_input_tokens": 128000,
@@ -58,7 +58,7 @@ class LlamaIndexTracer:
58
58
  ) -> None:
59
59
  trace = {
60
60
  "event_type": event_type,
61
- "timestamp": datetime.now().isoformat(),
61
+ "timestamp": datetime.now().astimezone().isoformat(),
62
62
  "payload": payload,
63
63
  "status": "started",
64
64
  "event_id": event_id,
@@ -82,7 +82,7 @@ class LlamaIndexTracer:
82
82
  ) -> None:
83
83
  trace = {
84
84
  "event_type": event_type,
85
- "timestamp": datetime.now().isoformat(),
85
+ "timestamp": datetime.now().astimezone().isoformat(),
86
86
  "payload": payload,
87
87
  "status": "completed",
88
88
  "event_id": event_id,
@@ -220,7 +220,7 @@ class LlamaIndexTracer:
220
220
  user_detail["trace_id"] = self._generate_trace_id()
221
221
  metadata = user_detail["metadata"]
222
222
  metadata["log_source"] = "llamaindex_tracer"
223
- metadata["recorded_on"] = datetime.utcnow().isoformat().replace('T', ' ')
223
+ metadata["recorded_on"] = datetime.now().astimezone().replace('T', ' ')
224
224
  user_detail["metadata"] = metadata
225
225
  return user_detail
226
226
 
@@ -116,7 +116,7 @@ class Tracer(AgenticTracing):
116
116
  self.base_url = f"{RagaAICatalyst.BASE_URL}"
117
117
  self.timeout = 30
118
118
  self.num_projects = 100
119
- self.start_time = datetime.datetime.now(datetime.timezone.utc)
119
+ self.start_time = datetime.datetime.now().astimezone().isoformat()
120
120
 
121
121
  if update_llm_cost:
122
122
  # First update the model costs file from GitHub
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ragaai_catalyst
3
- Version: 2.1.4b2
3
+ Version: 2.1.4b4
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
@@ -12,13 +12,13 @@ ragaai_catalyst/ragaai_catalyst.py,sha256=FdqMzwuQLqS2-3JJDsTQ8uh2itllOxfPrRUjb8
12
12
  ragaai_catalyst/synthetic_data_generation.py,sha256=uDV9tNwto2xSkWg5XHXUvjErW-4P34CTrxaJpRfezyA,19250
13
13
  ragaai_catalyst/utils.py,sha256=TlhEFwLyRU690HvANbyoRycR3nQ67lxVUQoUOfTPYQ0,3772
14
14
  ragaai_catalyst/tracers/__init__.py,sha256=yxepo7iVjTNI_wFdk3Z6Ghu64SazVyszCPEHYrX5WQk,50
15
- ragaai_catalyst/tracers/llamaindex_callback.py,sha256=vPE7MieKjfwLrLUnnPs20Df0xNYqoCCj-Mt2NbiuiKU,14023
16
- ragaai_catalyst/tracers/tracer.py,sha256=Q-C5lMXh6p5bqnDEQaqoK6C9H-V1odSi_YrYYT0jeW0,15581
15
+ ragaai_catalyst/tracers/llamaindex_callback.py,sha256=HGs0TgtSgn8xXL8CSgdL9ymvYQGxZCNmPY5tRTw-I4s,14047
16
+ ragaai_catalyst/tracers/tracer.py,sha256=4RaLmtAvVA-KT-O4Oi5T-VLVFmKqhbWjHYNxuQ6Fktk,15585
17
17
  ragaai_catalyst/tracers/upload_traces.py,sha256=hs0PEmit3n3_uUqrdbwcBdyK5Nbkik3JQVwJMEwYTd4,4796
18
18
  ragaai_catalyst/tracers/agentic_tracing/README.md,sha256=X4QwLb7-Jg7GQMIXj-SerZIgDETfw-7VgYlczOR8ZeQ,4508
19
19
  ragaai_catalyst/tracers/agentic_tracing/__init__.py,sha256=yf6SKvOPSpH-9LiKaoLKXwqj5sez8F_5wkOb91yp0oE,260
20
20
  ragaai_catalyst/tracers/agentic_tracing/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- ragaai_catalyst/tracers/agentic_tracing/data/data_structure.py,sha256=yRIWO4Lg2dUQy2IRjNxfrItj8haKVeULYAyEibinji0,9233
21
+ ragaai_catalyst/tracers/agentic_tracing/data/data_structure.py,sha256=nFnwqL1-Uznwndi2ugDnhziUbIASlcBYnM6Dyq7pPt8,9243
22
22
  ragaai_catalyst/tracers/agentic_tracing/tests/FinancialAnalysisSystem.ipynb,sha256=0qZxjWqYCTAVvdo3Tsp544D8Am48wfeMQ9RKpKgAL8g,34291
23
23
  ragaai_catalyst/tracers/agentic_tracing/tests/GameActivityEventPlanner.ipynb,sha256=QCMFJYbGX0fd9eMW4PqyQLZjyWuTXo7n1nqO_hMLf0s,4225
24
24
  ragaai_catalyst/tracers/agentic_tracing/tests/TravelPlanner.ipynb,sha256=fU3inXoemJbdTkGAQl_N1UwVEZ10LrKv4gCEpbQ4ISg,43481
@@ -26,14 +26,15 @@ 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=unr4AVpXu2IJeNz_oL-fEtJ-tNmbCgdWJN5euCfdC8c,24951
30
- ragaai_catalyst/tracers/agentic_tracing/tracers/base.py,sha256=z2e1kGVAi_oBK__tCs0OiSVMYjqAeAdXd7CeZYzYWJA,34660
31
- ragaai_catalyst/tracers/agentic_tracing/tracers/custom_tracer.py,sha256=tcOXzWTZlDdlBamCR0g5Sks5WwmKCK93R0ijIbDeSpI,12467
32
- ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py,sha256=9EYrfkMYNYXYur9msb0wmxJlN_c58mzSj-GTDbLb154,28759
33
- ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=Tthd1lm_QKeY8E4HLYWW9djujnOO_5X-LIKnv1pNwJI,15092
34
- ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py,sha256=Tq9by4DV51UR4BCUc3fnAiNR4SZku-gOaOfjJryowAA,10218
29
+ ragaai_catalyst/tracers/agentic_tracing/tracers/agent_tracer.py,sha256=IpcSJG8lxghWmkIpcOvQ_4G0OqK79-Y2_75CEa5dHtg,25027
30
+ ragaai_catalyst/tracers/agentic_tracing/tracers/base.py,sha256=xNiWN0xJDm0GbnB0jo8xFnt-BO0-x4CmaHInsWxHREA,31266
31
+ ragaai_catalyst/tracers/agentic_tracing/tracers/custom_tracer.py,sha256=uay8lU7T-CKsVu8KvWX31qfMqufK9S3Ive7XKo2Ksmk,12252
32
+ ragaai_catalyst/tracers/agentic_tracing/tracers/langgraph_tracer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py,sha256=NzMLIf21foZplOBx2zq32sUHV8geBNQmI2B-sIoSpPI,28810
34
+ ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=5zUfKG87-sJPvDY56uueEL4J8Qk797vl0WDVbqhbx7Y,15117
35
+ ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py,sha256=CviGiAg0W0krJxORMBDTosQytIoJDQ5RwU6xt_U_mOg,10408
35
36
  ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=PD027GHkbEwLUINXYradgblSEN8d2cqkHwpyX3RP_uw,11627
36
- ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=nrRqjHgAPNJjlU-WgLKqfQ92SzT7usV45T4jW4hwhrc,4575
37
+ ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=bhSUhNQCuJXKjgJAXhjKEYjnHMpYN90FSZdR84fNIKU,4614
37
38
  ragaai_catalyst/tracers/agentic_tracing/upload/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
39
  ragaai_catalyst/tracers/agentic_tracing/upload/upload_agentic_traces.py,sha256=1MDKXAAPzOEdxFKWWQrRgrmM3kz--DGXSywGXQmR3lQ,6041
39
40
  ragaai_catalyst/tracers/agentic_tracing/upload/upload_code.py,sha256=HgpMgI-JTWZrizcM7GGUIaAgaZF4aRT3D0dJXVEkblY,4271
@@ -45,7 +46,7 @@ ragaai_catalyst/tracers/agentic_tracing/utils/file_name_tracker.py,sha256=515NND
45
46
  ragaai_catalyst/tracers/agentic_tracing/utils/generic.py,sha256=WwXT01xmp8MSr7KinuDCSK9a1ifpLcT7ajFkvYviG_A,1190
46
47
  ragaai_catalyst/tracers/agentic_tracing/utils/get_user_trace_metrics.py,sha256=vPZ4dn4EHFW0kqd1GyRpsYXbfrRrd0DXCmh-pzsDBNE,1109
47
48
  ragaai_catalyst/tracers/agentic_tracing/utils/llm_utils.py,sha256=wlXCuaRe81s-7FWdJ_MquXFGRZZfNrZxLIIxl-Ohbqk,15541
48
- ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json,sha256=GTeYvV1eclT9ZeJV9KqZRKev7_P0DeIP9ji8KfbCD68,293328
49
+ ragaai_catalyst/tracers/agentic_tracing/utils/model_costs.json,sha256=weznWpRd6N5X-O8lkzVA6nd5LSYJKa62s3GZL51NQpU,293833
49
50
  ragaai_catalyst/tracers/agentic_tracing/utils/span_attributes.py,sha256=MqeRNGxzeuh9qTK0NbYMftl9V9Z0V7gMgBoHkrXP56k,1592
50
51
  ragaai_catalyst/tracers/agentic_tracing/utils/trace_utils.py,sha256=RciiDdo2riibEoM8X0FKHaXi78y3bWwNkV8U0leqigk,3508
51
52
  ragaai_catalyst/tracers/agentic_tracing/utils/unique_decorator.py,sha256=DQHjcEuqEKsNSWaNs7SoOaq50yK4Jsl966S7mBnV-zA,5723
@@ -59,7 +60,7 @@ ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hak
59
60
  ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
60
61
  ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
61
62
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
62
- ragaai_catalyst-2.1.4b2.dist-info/METADATA,sha256=hAIHL6OVFHUiGDUdh94meRnU5YUhuBdRcco94cTtA8c,12770
63
- ragaai_catalyst-2.1.4b2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
64
- ragaai_catalyst-2.1.4b2.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
65
- ragaai_catalyst-2.1.4b2.dist-info/RECORD,,
63
+ ragaai_catalyst-2.1.4b4.dist-info/METADATA,sha256=4xoAwoSRRw5GD6yEeygoXU49jMKM4RXa1_MWLV9EblA,12770
64
+ ragaai_catalyst-2.1.4b4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
65
+ ragaai_catalyst-2.1.4b4.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
66
+ ragaai_catalyst-2.1.4b4.dist-info/RECORD,,