ragaai-catalyst 2.0.4__py3-none-any.whl → 2.0.5__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.
@@ -80,7 +80,8 @@ class Evaluation:
80
80
  try:
81
81
  response = requests.get(
82
82
  f'{self.base_url}/v1/llm/llm-metrics',
83
- headers=headers)
83
+ headers=headers,
84
+ timeout=self.timeout)
84
85
  response.raise_for_status()
85
86
  metric_names = [metric["name"] for metric in response.json()["data"]["metrics"]]
86
87
  return metric_names
@@ -111,7 +112,8 @@ class Evaluation:
111
112
  response = requests.post(
112
113
  f'{self.base_url}/v1/llm/docs',
113
114
  headers=headers,
114
- json=data)
115
+ json=data,
116
+ timeout=self.timeout)
115
117
  response.raise_for_status()
116
118
  if response.status_code == 200:
117
119
  return response.json()["data"]["columns"]
@@ -203,7 +205,8 @@ class Evaluation:
203
205
  try:
204
206
  response = requests.get(
205
207
  f'{self.base_url}/v1/llm/llm-metrics',
206
- headers=headers)
208
+ headers=headers,
209
+ timeout=self.timeout)
207
210
  response.raise_for_status()
208
211
  metrics_schema = [metric for metric in response.json()["data"]["metrics"]]
209
212
  return metrics_schema
@@ -233,8 +236,15 @@ class Evaluation:
233
236
  #checking if provider is one of the allowed providers
234
237
  if key.lower()=="provider" and value.lower() not in sub_providers:
235
238
  raise ValueError("Enter a valid provider name. The following Provider names are supported: OpenAI, Azure, Gemini, Groq")
236
-
237
- base_json["metricSpec"]["config"]["params"][key] = {"value": value}
239
+
240
+ if key.lower()=="threshold":
241
+ if len(value)>1:
242
+ raise ValueError("'threshold' can only take one argument gte/lte/eq")
243
+ else:
244
+ for key_thres, value_thres in value.items():
245
+ base_json["metricSpec"]["config"]["params"][key] = {f"{key_thres}":value_thres}
246
+ else:
247
+ base_json["metricSpec"]["config"]["params"][key] = {"value": value}
238
248
 
239
249
 
240
250
  # if metric["config"]["model"]:
@@ -253,12 +263,15 @@ class Evaluation:
253
263
  }
254
264
  try:
255
265
  response = requests.get(
256
- f'{self.base_url}/v1/llm/filter?datasetId={str(self.dataset_id)}',
257
- headers=headers
258
- )
266
+ f"{self.base_url}/v2/llm/dataset/{str(self.dataset_id)}?initialCols=0",
267
+ headers=headers,
268
+ timeout=self.timeout,
269
+ )
259
270
  response.raise_for_status()
260
- executed_metric_response = response.json()["data"]["filter"]
261
- executed_metric_list = [item["displayName"] for item in executed_metric_response]
271
+ dataset_columns = response.json()["data"]["datasetColumnsResponses"]
272
+ dataset_columns = [item["displayName"] for item in dataset_columns]
273
+ executed_metric_list = [data for data in dataset_columns if not data.startswith('_')]
274
+
262
275
  return executed_metric_list
263
276
  except requests.exceptions.HTTPError as http_err:
264
277
  logger.error(f"HTTP error occurred: {http_err}")
@@ -301,7 +314,8 @@ class Evaluation:
301
314
  response = requests.post(
302
315
  f'{self.base_url}/playground/metric-evaluation',
303
316
  headers=headers,
304
- json=metric_schema_mapping
317
+ json=metric_schema_mapping,
318
+ timeout=self.timeout
305
319
  )
306
320
  if response.status_code == 400:
307
321
  raise ValueError(response.json()["message"])
@@ -327,14 +341,14 @@ class Evaluation:
327
341
  "Authorization": f"Bearer {os.getenv('RAGAAI_CATALYST_TOKEN')}",
328
342
  'X-Project-Id': str(self.project_id),
329
343
  }
330
- data = {"jobId": self.jobId}
331
344
  try:
332
- response = requests.post(
345
+ response = requests.get(
333
346
  f'{self.base_url}/job/status',
334
347
  headers=headers,
335
- json=data)
348
+ timeout=self.timeout)
336
349
  response.raise_for_status()
337
- status_json = response.json()["data"]["status"]
350
+ if response.json()["success"]:
351
+ status_json = [item["status"] for item in response.json()["data"]["content"] if item["id"]==self.jobId][0]
338
352
  if status_json == "Failed":
339
353
  return print("Job failed. No results to fetch.")
340
354
  elif status_json == "In Progress":
@@ -373,7 +387,8 @@ class Evaluation:
373
387
  response = requests.post(
374
388
  f'{self.base_url}/v1/llm/docs',
375
389
  headers=headers,
376
- json=data)
390
+ json=data,
391
+ timeout=self.timeout)
377
392
  response.raise_for_status()
378
393
  return response.json()
379
394
  except requests.exceptions.HTTPError as http_err:
@@ -392,7 +407,7 @@ class Evaluation:
392
407
  try:
393
408
  response = get_presignedUrl()
394
409
  preSignedURL = response["data"]["preSignedURL"]
395
- response = requests.get(preSignedURL)
410
+ response = requests.get(preSignedURL, timeout=self.timeout)
396
411
  response.raise_for_status()
397
412
  return response.text
398
413
  except requests.exceptions.HTTPError as http_err:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ragaai_catalyst
3
- Version: 2.0.4
3
+ Version: 2.0.5
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
@@ -1,7 +1,7 @@
1
1
  ragaai_catalyst/__init__.py,sha256=T0-X4yfIAe26-tWx6kLwNkKIjaFoQL2aNLIRp5wBG5w,424
2
2
  ragaai_catalyst/_version.py,sha256=JKt9KaVNOMVeGs8ojO6LvIZr7ZkMzNN-gCcvryy4x8E,460
3
3
  ragaai_catalyst/dataset.py,sha256=XjI06Exs6-64pQPQlky4mtcUllNMCgKP-bnM_t9EWkY,10920
4
- ragaai_catalyst/evaluation.py,sha256=qSiSIvUr2FvIGdisUzwWEYWllXDIiLKv5D00URBgGSw,18495
4
+ ragaai_catalyst/evaluation.py,sha256=PR7rMkvZ4km26B24sSc60GPNS0JkrUMIYo5CPEqX2Qw,19315
5
5
  ragaai_catalyst/experiment.py,sha256=8KvqgJg5JVnt9ghhGDJvdb4mN7ETBX_E5gNxBT0Nsn8,19010
6
6
  ragaai_catalyst/prompt_manager.py,sha256=ZMIHrmsnPMq20YfeNxWXLtrxnJyMcxpeJ8Uya7S5dUA,16411
7
7
  ragaai_catalyst/proxy_call.py,sha256=nlMdJCSW73sfN0fMbCbtIk6W992Nac5FJvcfNd6UDJk,5497
@@ -19,7 +19,7 @@ ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hak
19
19
  ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
20
20
  ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
21
21
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
22
- ragaai_catalyst-2.0.4.dist-info/METADATA,sha256=XfU--Yoer4WL2NfZ7RNJcojMkMDR5bfL8J36NV6HqQA,6625
23
- ragaai_catalyst-2.0.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
24
- ragaai_catalyst-2.0.4.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
25
- ragaai_catalyst-2.0.4.dist-info/RECORD,,
22
+ ragaai_catalyst-2.0.5.dist-info/METADATA,sha256=tWppjo0sERHjjugIOAWdwD1p05HO6T6N_E1KYd9G9hY,6625
23
+ ragaai_catalyst-2.0.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
24
+ ragaai_catalyst-2.0.5.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
25
+ ragaai_catalyst-2.0.5.dist-info/RECORD,,