ragaai-catalyst 2.2.3b0__py3-none-any.whl → 2.2.3b2__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.
@@ -136,9 +136,7 @@ class FileSpanExporter(SpanExporter):
136
136
  """
137
137
  async with aiohttp.ClientSession() as session:
138
138
  if not os.getenv("RAGAAI_CATALYST_TOKEN"):
139
- raise ValueError(
140
- "RAGAAI_CATALYST_TOKEN not found. Cannot upload traces."
141
- )
139
+ logger.error("RAGAAI_CATALYST_TOKEN not found. Cannot upload traces.")
142
140
 
143
141
  try:
144
142
  upload_stat = await self.raga_client.check_and_upload_files(
@@ -60,7 +60,7 @@ class RagaExporter:
60
60
  self.secret_key = os.getenv("RAGAAI_CATALYST_SECRET_KEY")
61
61
  self.max_urls = 20
62
62
  if not self.access_key or not self.secret_key:
63
- raise ValueError(
63
+ logger.error(
64
64
  "RAGAAI_CATALYST_ACCESS_KEY and RAGAAI_CATALYST_SECRET_KEY environment variables must be set"
65
65
  )
66
66
  if not os.getenv("RAGAAI_CATALYST_TOKEN"):
@@ -68,7 +68,7 @@ class RagaExporter:
68
68
 
69
69
  create_status_code = self._create_schema()
70
70
  if create_status_code != 200:
71
- raise Exception(
71
+ logger.error(
72
72
  "Failed to create schema. Please consider raising an issue."
73
73
  )
74
74
  # elif status_code != 200:
@@ -51,7 +51,7 @@ class RAGATraceExporter(SpanExporter):
51
51
  span_json = json.loads(span.to_json())
52
52
  trace_id = span_json.get("context").get("trace_id")
53
53
  if trace_id is None:
54
- raise Exception("Trace ID is None")
54
+ logger.error("Trace ID is None")
55
55
 
56
56
  if trace_id not in self.trace_spans:
57
57
  self.trace_spans[trace_id] = list()
@@ -63,11 +63,11 @@ class RAGATraceExporter(SpanExporter):
63
63
  try:
64
64
  self.process_complete_trace(trace, trace_id)
65
65
  except Exception as e:
66
- raise Exception(f"Error processing complete trace: {e}")
66
+ logger.error(f"Error processing complete trace: {e}")
67
67
  try:
68
68
  del self.trace_spans[trace_id]
69
69
  except Exception as e:
70
- raise Exception(f"Error deleting trace: {e}")
70
+ logger.error(f"Error deleting trace: {e}")
71
71
  except Exception as e:
72
72
  logger.warning(f"Error processing span: {e}")
73
73
  continue
@@ -166,7 +166,7 @@ class Tracer(AgenticTracing):
166
166
  project["name"] for project in response.json()["data"]["content"]
167
167
  ]
168
168
  if project_name not in project_list:
169
- raise ValueError("Project not found. Please enter a valid project name")
169
+ logger.error("Project not found. Please enter a valid project name")
170
170
 
171
171
  self.project_id = [
172
172
  project["id"] for project in response.json()["data"]["content"] if project["name"] == project_name
@@ -177,7 +177,6 @@ class Tracer(AgenticTracing):
177
177
 
178
178
  except requests.exceptions.RequestException as e:
179
179
  logger.error(f"Failed to retrieve projects list: {e}")
180
- raise
181
180
 
182
181
  # if tracer_type == "langchain":
183
182
  # instrumentors = []
@@ -367,11 +366,11 @@ class Tracer(AgenticTracing):
367
366
  })
368
367
  """
369
368
  if not isinstance(cost_config, dict):
370
- raise TypeError("cost_config must be a dictionary")
369
+ logger.error("cost_config must be a dictionary")
371
370
 
372
371
  required_keys = {"model_name", "input_cost_per_million_token", "output_cost_per_million_token"}
373
372
  if not all(key in cost_config for key in required_keys):
374
- raise ValueError(f"cost_config must contain all required keys: {required_keys}")
373
+ logger.error(f"cost_config must contain all required keys: {required_keys}")
375
374
 
376
375
  model_name = cost_config["model_name"]
377
376
  self.model_custom_cost[model_name] = {
@@ -400,7 +399,7 @@ class Tracer(AgenticTracing):
400
399
  return value
401
400
  """
402
401
  if not callable(masking_func):
403
- raise TypeError("masking_func must be a callable")
402
+ logger.error("masking_func must be a callable")
404
403
 
405
404
  def recursive_mask_values(obj, parent_key=None):
406
405
  """Apply masking to all values in nested structure."""
@@ -475,7 +474,7 @@ class Tracer(AgenticTracing):
475
474
  def post_processor_func(original_trace_json_path: os.PathLike) -> os.PathLike
476
475
  """
477
476
  if not callable(post_processor_func):
478
- raise TypeError("post_processor_func must be a callable")
477
+ logger.error("post_processor_func must be a callable")
479
478
  self.post_processor = post_processor_func
480
479
  # Register in parent AgenticTracing class
481
480
  super().register_post_processor(post_processor_func)
@@ -578,7 +577,7 @@ class Tracer(AgenticTracing):
578
577
  "llama_index": LlamaIndexInstrumentor,
579
578
  }
580
579
  if tracer_type not in instrumentors:
581
- raise ValueError(f"Invalid tracer type: {tracer_type}")
580
+ logger.error(f"Invalid tracer type: {tracer_type}")
582
581
  return instrumentors[tracer_type]().get()
583
582
 
584
583
  @contextmanager
@@ -699,9 +698,7 @@ class Tracer(AgenticTracing):
699
698
  """
700
699
  async with aiohttp.ClientSession() as session:
701
700
  if not os.getenv("RAGAAI_CATALYST_TOKEN"):
702
- raise ValueError(
703
- "RAGAAI_CATALYST_TOKEN not found. Cannot upload traces."
704
- )
701
+ logger.error("RAGAAI_CATALYST_TOKEN not found. Cannot upload traces.")
705
702
 
706
703
  try:
707
704
  upload_stat = await asyncio.wait_for(
@@ -785,7 +782,7 @@ class Tracer(AgenticTracing):
785
782
  AttributeError: If the tracer_type is not an agentic tracer or if the dynamic_exporter is not initialized.
786
783
  """
787
784
  if not self.tracer_type.startswith("agentic/") or not hasattr(self, "dynamic_exporter"):
788
- raise AttributeError("This method is only available for agentic tracers with a dynamic exporter.")
785
+ logger.error("This method is only available for agentic tracers with a dynamic exporter.")
789
786
 
790
787
  for key, value in kwargs.items():
791
788
  if hasattr(self.dynamic_exporter, key):
@@ -852,7 +849,7 @@ class Tracer(AgenticTracing):
852
849
  AttributeError: If the tracer_type is not 'agentic/llamaindex' or if the dynamic_exporter is not initialized.
853
850
  """
854
851
  if not self.tracer_type.startswith("agentic/") or not hasattr(self, "dynamic_exporter"):
855
- raise AttributeError("This method is only available for agentic tracers with a dynamic exporter.")
852
+ logger.error("This method is only available for agentic tracers with a dynamic exporter.")
856
853
 
857
854
  # Get the latest list of unique files
858
855
  list_of_unique_files = self.file_tracker.get_unique_files()