ragaai-catalyst 2.0.2__py3-none-any.whl → 2.0.3__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/dataset.py +6 -2
- ragaai_catalyst/evaluation.py +19 -6
- ragaai_catalyst/tracers/exporters/file_span_exporter.py +3 -2
- {ragaai_catalyst-2.0.2.dist-info → ragaai_catalyst-2.0.3.dist-info}/METADATA +2 -1
- {ragaai_catalyst-2.0.2.dist-info → ragaai_catalyst-2.0.3.dist-info}/RECORD +7 -7
- {ragaai_catalyst-2.0.2.dist-info → ragaai_catalyst-2.0.3.dist-info}/WHEEL +0 -0
- {ragaai_catalyst-2.0.2.dist-info → ragaai_catalyst-2.0.3.dist-info}/top_level.txt +0 -0
ragaai_catalyst/dataset.py
CHANGED
@@ -5,7 +5,7 @@ from typing import Union
|
|
5
5
|
import logging
|
6
6
|
from .ragaai_catalyst import RagaAICatalyst
|
7
7
|
import pandas as pd
|
8
|
-
|
8
|
+
import pdb
|
9
9
|
logger = logging.getLogger(__name__)
|
10
10
|
get_token = RagaAICatalyst.get_token
|
11
11
|
|
@@ -213,6 +213,7 @@ class Dataset:
|
|
213
213
|
|
214
214
|
#### put csv to presigned URL
|
215
215
|
def put_csv_to_presignedUrl(url):
|
216
|
+
# pdb.set_trace()
|
216
217
|
headers = {
|
217
218
|
'Content-Type': 'text/csv',
|
218
219
|
'x-ms-blob-type': 'BlockBlob',
|
@@ -232,8 +233,11 @@ class Dataset:
|
|
232
233
|
raise
|
233
234
|
|
234
235
|
try:
|
236
|
+
|
235
237
|
put_csv_response = put_csv_to_presignedUrl(url)
|
236
|
-
|
238
|
+
# pdb.set_trace()
|
239
|
+
print(put_csv_response)
|
240
|
+
if put_csv_response.status_code not in (200, 201):
|
237
241
|
raise ValueError('Unable to put csv to the presignedUrl')
|
238
242
|
except Exception as e:
|
239
243
|
logger.error(f"Error in put_csv_to_presignedUrl: {e}")
|
ragaai_catalyst/evaluation.py
CHANGED
@@ -160,10 +160,7 @@ class Evaluation:
|
|
160
160
|
"model": "null",
|
161
161
|
"params": {
|
162
162
|
"model": {
|
163
|
-
"value": "gpt-4o"
|
164
|
-
},
|
165
|
-
"threshold": {
|
166
|
-
"gte": 0.5
|
163
|
+
"value": "gpt-4o-mini"
|
167
164
|
}
|
168
165
|
},
|
169
166
|
"mappings": "mappings"
|
@@ -200,12 +197,23 @@ class Evaluation:
|
|
200
197
|
def _update_base_json(self, metrics):
|
201
198
|
metric_schema_mapping = {"datasetId":self.dataset_id}
|
202
199
|
metrics_schema_response = self._get_metrics_schema_response()
|
200
|
+
sub_providers = ["openai","azure","gemini","groq"]
|
203
201
|
metricParams = []
|
204
202
|
for metric in metrics:
|
205
203
|
base_json = self._get_metricParams()
|
206
204
|
base_json["metricSpec"]["name"] = metric["name"]
|
207
|
-
|
208
|
-
|
205
|
+
|
206
|
+
#pasing model configuration
|
207
|
+
for key, value in metric["config"].items():
|
208
|
+
#checking if provider is one of the allowed providers
|
209
|
+
if key.lower()=="provider" and value.lower() not in sub_providers:
|
210
|
+
raise ValueError("Enter a valid provider name. The following Provider names are supported: OpenAI, Azure, Gemini, Groq")
|
211
|
+
|
212
|
+
base_json["metricSpec"]["config"]["params"][key] = {"value": value}
|
213
|
+
|
214
|
+
|
215
|
+
# if metric["config"]["model"]:
|
216
|
+
# base_json["metricSpec"]["config"]["params"]["model"]["value"] = metric["config"]["model"]
|
209
217
|
base_json["metricSpec"]["displayName"] = metric["column_name"]
|
210
218
|
mappings = self._get_mapping(metric["name"], metrics_schema_response)
|
211
219
|
base_json["metricSpec"]["config"]["mappings"] = mappings
|
@@ -241,6 +249,11 @@ class Evaluation:
|
|
241
249
|
|
242
250
|
def add_metrics(self, metrics):
|
243
251
|
executed_metric_list = self._get_executed_metrics_list()
|
252
|
+
metrics_name = self.list_metrics()
|
253
|
+
user_metric_names = [metric["name"] for metric in metrics]
|
254
|
+
for user_metric in user_metric_names:
|
255
|
+
if user_metric not in metrics_name:
|
256
|
+
raise ValueError("Enter a valid metric name")
|
244
257
|
column_names = [metric["column_name"] for metric in metrics]
|
245
258
|
for column_name in column_names:
|
246
259
|
if column_name in executed_metric_list:
|
@@ -87,6 +87,7 @@ class FileSpanExporter(SpanExporter):
|
|
87
87
|
f.write(json.dumps(export_data) + "\n")
|
88
88
|
|
89
89
|
|
90
|
+
tracer_json_file_path = os.path.join(os.getcwd(), "tracer_debug.json")
|
90
91
|
if os.path.exists(json_file_path):
|
91
92
|
with open(json_file_path, "r") as f:
|
92
93
|
data = json.load(f)
|
@@ -94,7 +95,6 @@ class FileSpanExporter(SpanExporter):
|
|
94
95
|
with open(json_file_path, "w") as f:
|
95
96
|
logger.debug(f"Appending to json file: {json_file_path}")
|
96
97
|
json.dump(data, f)
|
97
|
-
|
98
98
|
else:
|
99
99
|
with open(json_file_path, "w") as f:
|
100
100
|
logger.debug(f"Writing json file: {json_file_path}")
|
@@ -104,7 +104,8 @@ class FileSpanExporter(SpanExporter):
|
|
104
104
|
# self._upload_task = self._run_async(self._upload_traces(json_file_path= self.sync_file))
|
105
105
|
self._run_async(self._upload_traces(json_file_path=self.sync_file))
|
106
106
|
self.sync_file = json_file_path
|
107
|
-
# asyncio.run(self.server_upload(json_file_path)
|
107
|
+
# asyncio.run(self.server_upload(json_file_path)
|
108
|
+
|
108
109
|
|
109
110
|
def _run_async(self, coroutine):
|
110
111
|
"""Run an asynchronous coroutine in a separate thread."""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ragaai_catalyst
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.3
|
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.9
|
@@ -20,6 +20,7 @@ Requires-Dist: langchain-core>=0.2.11
|
|
20
20
|
Requires-Dist: langchain>=0.2.11
|
21
21
|
Requires-Dist: openai>=1.35.10
|
22
22
|
Requires-Dist: pandas>=2.1.1
|
23
|
+
Requires-Dist: tenacity==8.3.0
|
23
24
|
Provides-Extra: dev
|
24
25
|
Requires-Dist: pytest; extra == "dev"
|
25
26
|
Requires-Dist: pytest-cov; extra == "dev"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
ragaai_catalyst/__init__.py,sha256=kxR70lWGd_b5q6wn7wg8h_Oth5EohSqzMPjWMe1Za50,334
|
2
2
|
ragaai_catalyst/_version.py,sha256=JKt9KaVNOMVeGs8ojO6LvIZr7ZkMzNN-gCcvryy4x8E,460
|
3
|
-
ragaai_catalyst/dataset.py,sha256=
|
4
|
-
ragaai_catalyst/evaluation.py,sha256=
|
3
|
+
ragaai_catalyst/dataset.py,sha256=XjI06Exs6-64pQPQlky4mtcUllNMCgKP-bnM_t9EWkY,10920
|
4
|
+
ragaai_catalyst/evaluation.py,sha256=4cgCKPhFtnPdYsBcN8jTxTHcysycz-cQbau_MCiIUYg,16474
|
5
5
|
ragaai_catalyst/experiment.py,sha256=8KvqgJg5JVnt9ghhGDJvdb4mN7ETBX_E5gNxBT0Nsn8,19010
|
6
6
|
ragaai_catalyst/prompt_manager.py,sha256=ZMIHrmsnPMq20YfeNxWXLtrxnJyMcxpeJ8Uya7S5dUA,16411
|
7
7
|
ragaai_catalyst/ragaai_catalyst.py,sha256=5Q1VCE7P33DtjaOtVGRUgBL8dpDL9kjisWGIkOyX4nE,17426
|
@@ -9,7 +9,7 @@ ragaai_catalyst/utils.py,sha256=TlhEFwLyRU690HvANbyoRycR3nQ67lxVUQoUOfTPYQ0,3772
|
|
9
9
|
ragaai_catalyst/tracers/__init__.py,sha256=NppmJhD3sQ5R1q6teaZLS7rULj08Gb6JT8XiPRIe_B0,49
|
10
10
|
ragaai_catalyst/tracers/tracer.py,sha256=eaGJdLEIjadHpbWBXBl5AhMa2vL97SVjik4U1L8gros,9591
|
11
11
|
ragaai_catalyst/tracers/exporters/__init__.py,sha256=kVA8zp05h3phu4e-iHSlnznp_PzMRczB7LphSsZgUjg,138
|
12
|
-
ragaai_catalyst/tracers/exporters/file_span_exporter.py,sha256=
|
12
|
+
ragaai_catalyst/tracers/exporters/file_span_exporter.py,sha256=RgGteu-NVGprXKkynvyIO5yOjpbtA41R3W_NzCjnkwE,6445
|
13
13
|
ragaai_catalyst/tracers/exporters/raga_exporter.py,sha256=rQ5Wj71f2Ke3qLlV8KiWCskbGBR-ia_hlzDx86rPrEo,18188
|
14
14
|
ragaai_catalyst/tracers/instrumentators/__init__.py,sha256=FgnMQupoRTzmVsG9YKsLQera2Pfs-AluZv8CxwavoyQ,253
|
15
15
|
ragaai_catalyst/tracers/instrumentators/langchain.py,sha256=yMN0qVF0pUVk6R5M1vJoUXezDo1ejs4klCFRlE8x4vE,574
|
@@ -17,7 +17,7 @@ ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hak
|
|
17
17
|
ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
|
18
18
|
ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
|
19
19
|
ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
|
20
|
-
ragaai_catalyst-2.0.
|
21
|
-
ragaai_catalyst-2.0.
|
22
|
-
ragaai_catalyst-2.0.
|
23
|
-
ragaai_catalyst-2.0.
|
20
|
+
ragaai_catalyst-2.0.3.dist-info/METADATA,sha256=gWehjEvbhpzWjNBDrYAD5RshBEOSL__-Dz-cejkOyvs,6497
|
21
|
+
ragaai_catalyst-2.0.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
22
|
+
ragaai_catalyst-2.0.3.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
|
23
|
+
ragaai_catalyst-2.0.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|