ragaai-catalyst 2.1.5b39__py3-none-any.whl → 2.1.5b40__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.
@@ -378,7 +378,7 @@ class AgenticTracing(
378
378
  super().add_component(component)
379
379
 
380
380
  # Handle error case
381
- if is_error:
381
+ if is_error and not self.current_agent_id.get():
382
382
  self.stop()
383
383
 
384
384
  def __enter__(self):
@@ -42,7 +42,7 @@ class DynamicTraceExporter(SpanExporter):
42
42
  self._project_id = project_id
43
43
  self._dataset_name = dataset_name
44
44
  self._user_details = user_details
45
- self._base_url = base_url,
45
+ self._base_url = base_url
46
46
  self._custom_model_cost = custom_model_cost
47
47
 
48
48
 
@@ -57,22 +57,37 @@ class DynamicTraceExporter(SpanExporter):
57
57
  Returns:
58
58
  SpanExportResult: Result of the export operation
59
59
  """
60
- # Update the exporter's properties
61
- self._update_exporter_properties()
62
-
63
- # Forward the call to the underlying exporter
64
- return self._exporter.export(spans)
65
-
60
+ try:
61
+ # Update the exporter's properties
62
+ self._update_exporter_properties()
63
+ except Exception as e:
64
+ raise Exception(f"Error updating exporter properties: {e}")
65
+
66
+ try:
67
+ # Forward the call to the underlying exporter
68
+ result = self._exporter.export(spans)
69
+ return result
70
+ except Exception as e:
71
+ raise Exception(f"Error exporting trace: {e}")
72
+
73
+
74
+
66
75
  def shutdown(self):
67
76
  """
68
77
  Shutdown the exporter by forwarding to the underlying exporter.
69
78
  Before shutting down, update the exporter's properties with the current values.
70
79
  """
71
- # Update the exporter's properties
72
- self._update_exporter_properties()
73
-
74
- # Forward the call to the underlying exporter
75
- return self._exporter.shutdown()
80
+ try:
81
+ # Update the exporter's properties
82
+ self._update_exporter_properties()
83
+ except Exception as e:
84
+ raise Exception(f"Error updating exporter properties: {e}")
85
+
86
+ try:
87
+ # Forward the call to the underlying exporter
88
+ return self._exporter.shutdown()
89
+ except Exception as e:
90
+ raise Exception(f"Error shutting down exporter: {e}")
76
91
 
77
92
  def _update_exporter_properties(self):
78
93
  """
@@ -35,6 +35,8 @@ class RAGATraceExporter(SpanExporter):
35
35
  for span in spans:
36
36
  span_json = json.loads(span.to_json())
37
37
  trace_id = span_json.get("context").get("trace_id")
38
+ if trace_id is None:
39
+ raise Exception("Trace ID is None")
38
40
 
39
41
  if trace_id not in self.trace_spans:
40
42
  self.trace_spans[trace_id] = list()
@@ -43,8 +45,14 @@ class RAGATraceExporter(SpanExporter):
43
45
 
44
46
  if span_json["parent_id"] is None:
45
47
  trace = self.trace_spans[trace_id]
46
- self.process_complete_trace(trace, trace_id)
47
- del self.trace_spans[trace_id]
48
+ try:
49
+ self.process_complete_trace(trace, trace_id)
50
+ except Exception as e:
51
+ raise Exception(f"Error processing complete trace: {e}")
52
+ try:
53
+ del self.trace_spans[trace_id]
54
+ except Exception as e:
55
+ raise Exception(f"Error deleting trace: {e}")
48
56
 
49
57
  return SpanExportResult.SUCCESS
50
58
 
@@ -223,7 +223,10 @@ def convert_json_format(input_trace, custom_model_cost):
223
223
  }
224
224
  final_trace["replays"]={"source":None}
225
225
  final_trace["data"]=[{}]
226
- final_trace["data"][0]["spans"] = get_spans(input_trace, custom_model_cost)
226
+ try:
227
+ final_trace["data"][0]["spans"] = get_spans(input_trace, custom_model_cost)
228
+ except Exception as e:
229
+ raise Exception(f"Error in get_spans function: {e}")
227
230
  final_trace["network_calls"] =[]
228
231
  final_trace["interactions"] = []
229
232
 
@@ -231,15 +234,15 @@ def convert_json_format(input_trace, custom_model_cost):
231
234
  if itr["type"]=="llm":
232
235
  if "tokens" in itr["info"]:
233
236
  if "prompt_tokens" in itr["info"]["tokens"]:
234
- final_trace["metadata"]["tokens"]["prompt_tokens"] += itr["info"]["tokens"]['prompt_tokens']
235
- final_trace["metadata"]["cost"]["input_cost"] += itr["info"]["cost"]['input_cost']
237
+ final_trace["metadata"]["tokens"]["prompt_tokens"] += itr["info"]["tokens"].get('prompt_tokens', 0.0)
238
+ final_trace["metadata"]["cost"]["input_cost"] += itr["info"]["cost"].get('input_cost', 0.0)
236
239
  if "completion_tokens" in itr["info"]["tokens"]:
237
- final_trace["metadata"]["tokens"]["completion_tokens"] += itr["info"]["tokens"]['completion_tokens']
238
- final_trace["metadata"]["cost"]["output_cost"] += itr["info"]["cost"]['output_cost']
240
+ final_trace["metadata"]["tokens"]["completion_tokens"] += itr["info"]["tokens"].get('completion_tokens', 0.0)
241
+ final_trace["metadata"]["cost"]["output_cost"] += itr["info"]["cost"].get('output_cost', 0.0)
239
242
  if "tokens" in itr["info"]:
240
243
  if "total_tokens" in itr["info"]["tokens"]:
241
- final_trace["metadata"]["tokens"]["total_tokens"] += itr["info"]["tokens"]['total_tokens']
242
- final_trace["metadata"]["cost"]["total_cost"] += itr["info"]["cost"]['total_cost']
244
+ final_trace["metadata"]["tokens"]["total_tokens"] += itr["info"]["tokens"].get('total_tokens', 0.0)
245
+ final_trace["metadata"]["cost"]["total_cost"] += itr["info"]["cost"].get('total_cost', 0.0)
243
246
 
244
247
  # get the total tokens, cost
245
248
  final_trace["metadata"]["total_cost"] = final_trace["metadata"]["cost"]["total_cost"]
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ragaai_catalyst
3
- Version: 2.1.5b39
3
+ Version: 2.1.5b40
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>, Tushar Kumar <tushar.kumar@raga.ai>
6
- Requires-Python: <3.13,>=3.10
6
+ Requires-Python: <3.13,>=3.9
7
7
  Description-Content-Type: text/markdown
8
8
  License-File: LICENSE
9
9
  Requires-Dist: aiohttp>=3.10.2
@@ -49,7 +49,7 @@ ragaai_catalyst/tracers/agentic_tracing/tracers/base.py,sha256=Kmy1kgwy19e7MuMMq
49
49
  ragaai_catalyst/tracers/agentic_tracing/tracers/custom_tracer.py,sha256=OBJJjFSvwRjCGNJyqX3yIfC1W05ZN2QUXasCJ4gmCjQ,13930
50
50
  ragaai_catalyst/tracers/agentic_tracing/tracers/langgraph_tracer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  ragaai_catalyst/tracers/agentic_tracing/tracers/llm_tracer.py,sha256=z-qzmCQCkhyW0aLDUR_rNq4pmxhAaVhNY-kZQsox-Ws,50221
52
- ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=PYYNNeFfsQpw5D4A0jzwNYhAvC1bMT5vtAGaTsgk2xY,16112
52
+ ragaai_catalyst/tracers/agentic_tracing/tracers/main_tracer.py,sha256=aiFobQb5ePPhyRADXJTZgI8_PrSGhjXnOu9W_o3ngEA,16148
53
53
  ragaai_catalyst/tracers/agentic_tracing/tracers/network_tracer.py,sha256=m8CxYkl7iMiFya_lNwN1ykBc3Pmo-2pR_2HmpptwHWQ,10352
54
54
  ragaai_catalyst/tracers/agentic_tracing/tracers/tool_tracer.py,sha256=xxrliKPfdfbIZRZqMnUewsaTD8_Hv0dbuoBivNZGD4U,21674
55
55
  ragaai_catalyst/tracers/agentic_tracing/tracers/user_interaction_tracer.py,sha256=bhSUhNQCuJXKjgJAXhjKEYjnHMpYN90FSZdR84fNIKU,4614
@@ -74,10 +74,10 @@ ragaai_catalyst/tracers/agentic_tracing/utils/trace_utils.py,sha256=go7FVnofviAT
74
74
  ragaai_catalyst/tracers/agentic_tracing/utils/unique_decorator.py,sha256=G027toV-Km20JjKrc-Y_PilQ8ABEKrBvvzgLTnqVg7I,5819
75
75
  ragaai_catalyst/tracers/agentic_tracing/utils/zip_list_of_unique_files.py,sha256=4TeCGsFF26249fV6dJHLTZDrRa93SG9oer4rudoF8Y4,19443
76
76
  ragaai_catalyst/tracers/exporters/__init__.py,sha256=wQbaqyeIjVZxYprHCKZ9BeiqxeXYBKjzEgP79LWNxCU,293
77
- ragaai_catalyst/tracers/exporters/dynamic_trace_exporter.py,sha256=dAT2WIvkQLl8RrXdhDwm0NxhxytV6PP4ZViYJ6jlOQg,4553
77
+ ragaai_catalyst/tracers/exporters/dynamic_trace_exporter.py,sha256=w9U8UTxvTbGTDUoMtsgy2BsdpYp-APTKFdGV4o5JPaM,5051
78
78
  ragaai_catalyst/tracers/exporters/file_span_exporter.py,sha256=RgGteu-NVGprXKkynvyIO5yOjpbtA41R3W_NzCjnkwE,6445
79
79
  ragaai_catalyst/tracers/exporters/raga_exporter.py,sha256=6xvjWXyh8XPkHKSLLmAZUQSvwuyY17ov8pv2VdfI0qA,17875
80
- ragaai_catalyst/tracers/exporters/ragaai_trace_exporter.py,sha256=OhPnquuOOxoCtx7cGYdnsQJZ8lNnl0alm3A2Wc4Bl2g,4814
80
+ ragaai_catalyst/tracers/exporters/ragaai_trace_exporter.py,sha256=s8zIUMrUKhtGrg-32XZnlJPKXWSyHo_WiJ1DoTcHVRg,5170
81
81
  ragaai_catalyst/tracers/instrumentators/__init__.py,sha256=FgnMQupoRTzmVsG9YKsLQera2Pfs-AluZv8CxwavoyQ,253
82
82
  ragaai_catalyst/tracers/instrumentators/langchain.py,sha256=yMN0qVF0pUVk6R5M1vJoUXezDo1ejs4klCFRlE8x4vE,574
83
83
  ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hakE8rkrWHxMlmtmWD-AX6TeByc,416
@@ -88,10 +88,10 @@ ragaai_catalyst/tracers/utils/convert_llama_instru_callback.py,sha256=8qLo7x4Zsn
88
88
  ragaai_catalyst/tracers/utils/extraction_logic_llama_index.py,sha256=ZhPs0YhVtB82-Pq9o1BvCinKE_WPvVxPTEcZjlJbFYM,2371
89
89
  ragaai_catalyst/tracers/utils/langchain_tracer_extraction_logic.py,sha256=XS2_x2qneqEx9oAighLg-LRiueWcESLwIC2r7eJT-Ww,3117
90
90
  ragaai_catalyst/tracers/utils/model_prices_and_context_window_backup.json,sha256=C3uwkibJ08C9sOX-54kulZYmJlIpZ-SQpfE6HNGrjbM,343502
91
- ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=9I3cidegQuedauvUF2NoZiNCPSjCaaskkaXxCcUJ9Po,12285
91
+ ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=qXSYKr4JMUpGQsB3mnr9_2qH6FqzUhCynNqlDp1IWTs,12440
92
92
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
93
- ragaai_catalyst-2.1.5b39.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
94
- ragaai_catalyst-2.1.5b39.dist-info/METADATA,sha256=bIq4JlzWIo7te22u94rhmkGGxCtBNsFoGeiJv5IVMDo,22061
95
- ragaai_catalyst-2.1.5b39.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
96
- ragaai_catalyst-2.1.5b39.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
97
- ragaai_catalyst-2.1.5b39.dist-info/RECORD,,
93
+ ragaai_catalyst-2.1.5b40.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
94
+ ragaai_catalyst-2.1.5b40.dist-info/METADATA,sha256=9R85Gfk5NuK3Q2TrvsYwza4g66Zqfzk3uf4mFihCdlI,22060
95
+ ragaai_catalyst-2.1.5b40.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
96
+ ragaai_catalyst-2.1.5b40.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
97
+ ragaai_catalyst-2.1.5b40.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5