ragaai-catalyst 2.1.7.5b4__py3-none-any.whl → 2.1.7.5b6__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.
@@ -100,21 +100,27 @@ class RAGATraceExporter(SpanExporter):
100
100
  if self.post_processor!=None and self.tracer_type != "langchain":
101
101
  ragaai_trace_details['trace_file_path'] = self.post_processor(ragaai_trace_details['trace_file_path'])
102
102
  if self.tracer_type == "langchain":
103
- # Check if we're already in an event loop
104
- try:
105
- loop = asyncio.get_event_loop()
106
- if loop.is_running():
107
- # We're in a running event loop (like in Colab/Jupyter)
108
- # Create a future and run the coroutine
109
- future = asyncio.ensure_future(self.upload_rag_trace(ragaai_trace_details, additional_metadata, trace_id, self.post_processor))
110
- # We don't wait for it to complete as this would block the event loop
111
- logger.info(f"Scheduled async upload for trace {trace_id} in existing event loop")
112
- else:
113
- # No running event loop, use asyncio.run()
114
- asyncio.run(self.upload_rag_trace(ragaai_trace_details, additional_metadata, trace_id, self.post_processor))
115
- except RuntimeError:
116
- # No event loop exists, create one
117
- asyncio.run(self.upload_rag_trace(ragaai_trace_details, additional_metadata, trace_id, self.post_processor))
103
+ import threading
104
+
105
+ def upload_in_thread():
106
+ try:
107
+ thread_loop = asyncio.new_event_loop()
108
+ asyncio.set_event_loop(thread_loop)
109
+ try:
110
+ thread_loop.run_until_complete(
111
+ self.upload_rag_trace(ragaai_trace_details, additional_metadata, trace_id, self.post_processor)
112
+ )
113
+ logger.info(f"Successfully completed upload for trace {trace_id} in dedicated thread")
114
+ finally:
115
+ thread_loop.close()
116
+ except Exception as e:
117
+ logger.error(f"Error in upload thread for trace {trace_id}: {str(e)}")
118
+
119
+ upload_thread = threading.Thread(target=upload_in_thread)
120
+ upload_thread.daemon = True
121
+ upload_thread.start()
122
+ logger.info(f"Started dedicated upload thread for trace {trace_id}")
123
+
118
124
  else:
119
125
  self.upload_trace(ragaai_trace_details, trace_id)
120
126
  except Exception as e:
@@ -535,11 +535,18 @@ class Tracer(AgenticTracing):
535
535
  'max_upload_workers': self.max_upload_workers
536
536
  }
537
537
 
538
+ # Save the model_custom_cost before reinitialization
539
+ saved_model_custom_cost = self.model_custom_cost.copy()
540
+
538
541
  # Reinitialize self with new external_id and stored parameters
539
542
  self.__init__(
540
543
  external_id=external_id,
541
544
  **current_params
542
545
  )
546
+
547
+ # Restore the model_custom_cost after reinitialization
548
+ self.model_custom_cost = saved_model_custom_cost
549
+ self.dynamic_exporter.custom_model_cost = self.model_custom_cost
543
550
 
544
551
 
545
552
 
@@ -37,7 +37,8 @@ class UploadTraces:
37
37
  "model_name": {"columnType": "metadata"},
38
38
  "total_cost": {"columnType": "metadata", "dataType": "numerical"},
39
39
  "total_latency": {"columnType": "metadata", "dataType": "numerical"},
40
- "error": {"columnType": "metadata"}
40
+ "error": {"columnType": "metadata"},
41
+ "externalId": {"columnType": "externalId"}
41
42
  }
42
43
 
43
44
  if additional_metadata_keys:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragaai_catalyst
3
- Version: 2.1.7.5b4
3
+ Version: 2.1.7.5b6
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
6
  Requires-Python: <=3.13.2,>=3.10
@@ -31,8 +31,8 @@ ragaai_catalyst/tracers/distributed.py,sha256=MwlBwIxCAng-OI-7Ove_rkE1mTLeuW4Jw-
31
31
  ragaai_catalyst/tracers/langchain_callback.py,sha256=CB75zzG3-DkYTELj0vI1MOHQTY0MuQJfoHIXz9Cl8S8,34568
32
32
  ragaai_catalyst/tracers/llamaindex_callback.py,sha256=ZY0BJrrlz-P9Mg2dX-ZkVKG3gSvzwqBtk7JL_05MiYA,14028
33
33
  ragaai_catalyst/tracers/llamaindex_instrumentation.py,sha256=Ys_jLkvVqo12bKgXDmkp4TxJu9HkBATrFE8cIcTYxWw,14329
34
- ragaai_catalyst/tracers/tracer.py,sha256=W5dS2h4IQrqbE_rgFY-1CrVCSs7WSFrDCny9_RASyjY,43593
35
- ragaai_catalyst/tracers/upload_traces.py,sha256=yfg1vHP5quz2Vb8xkas_vzXwIrTVqRwrmFNCTrWvFdg,6938
34
+ ragaai_catalyst/tracers/tracer.py,sha256=w9Poa2dsN3WNMPEH_v4M7SqFF_MQp_iSam4A-qcoAXM,43921
35
+ ragaai_catalyst/tracers/upload_traces.py,sha256=w1clGGfdOMpStUJX40NAlxe6dcFdN4pwcezyII0bGYA,6994
36
36
  ragaai_catalyst/tracers/agentic_tracing/README.md,sha256=X4QwLb7-Jg7GQMIXj-SerZIgDETfw-7VgYlczOR8ZeQ,4508
37
37
  ragaai_catalyst/tracers/agentic_tracing/__init__.py,sha256=yf6SKvOPSpH-9LiKaoLKXwqj5sez8F_5wkOb91yp0oE,260
38
38
  ragaai_catalyst/tracers/agentic_tracing/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -77,7 +77,7 @@ ragaai_catalyst/tracers/exporters/__init__.py,sha256=wQbaqyeIjVZxYprHCKZ9BeiqxeX
77
77
  ragaai_catalyst/tracers/exporters/dynamic_trace_exporter.py,sha256=v2V-y1l9t9gQQbqoi2jlEhm1xRQjR5yTyr6rxSriXCE,6303
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=C88pZ_n4mNv1Fc3qOOOm5JQdoTvQzHcjS7mSImslQ0I,13313
80
+ ragaai_catalyst/tracers/exporters/ragaai_trace_exporter.py,sha256=K5dy54bgUjYMDNT48qBuwx8ta245yQPIczCkFviAyd4,13290
81
81
  ragaai_catalyst/tracers/instrumentators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
82
  ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
83
83
  ragaai_catalyst/tracers/utils/convert_langchain_callbacks_output.py,sha256=SehrD7q8ytAiUYoWr406b4mWs3Lk0Rcy6Ekkihh22TI,1703
@@ -88,8 +88,8 @@ ragaai_catalyst/tracers/utils/model_prices_and_context_window_backup.json,sha256
88
88
  ragaai_catalyst/tracers/utils/rag_trace_json_converter.py,sha256=adCKk7Nj8307XYYg2sB-QT-66OShOs2iTGwNVwqbHig,19373
89
89
  ragaai_catalyst/tracers/utils/trace_json_converter.py,sha256=E0_QfciQMMpCtQYrNB4l8HJhlaFalr5bkMqkVRgQahY,14073
90
90
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
91
- ragaai_catalyst-2.1.7.5b4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
92
- ragaai_catalyst-2.1.7.5b4.dist-info/METADATA,sha256=Z0X9VzL8SIUjeobOKLCf70qmiBwp79VQwyTTbCt6MxQ,17607
93
- ragaai_catalyst-2.1.7.5b4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
94
- ragaai_catalyst-2.1.7.5b4.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
95
- ragaai_catalyst-2.1.7.5b4.dist-info/RECORD,,
91
+ ragaai_catalyst-2.1.7.5b6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
92
+ ragaai_catalyst-2.1.7.5b6.dist-info/METADATA,sha256=xpZy8rtoEBjykChpgpFoIq_CfcqftU4yxR9ExxiROK4,17607
93
+ ragaai_catalyst-2.1.7.5b6.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
94
+ ragaai_catalyst-2.1.7.5b6.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
95
+ ragaai_catalyst-2.1.7.5b6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.4.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5