ragaai-catalyst 1.0.7b3__py3-none-any.whl → 1.0.7b4__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.
@@ -339,11 +339,51 @@ class Experiment:
339
339
  Parse the response to get the results
340
340
  """
341
341
  try:
342
- parsed_response_df = pd.DataFrame(response["data"]["docs"])
343
- return True, parsed_response_df
342
+ x = pd.DataFrame(response["data"]["docs"])
343
+
344
+ column_names_to_replace = [
345
+ {item["columnName"]: item["displayName"]}
346
+ for item in response["data"]["columns"]
347
+ ]
348
+
349
+ if column_names_to_replace:
350
+ for item in column_names_to_replace:
351
+ x = x.rename(columns=item)
352
+
353
+ dict_cols = [
354
+ col
355
+ for col in x.columns
356
+ if x[col].dtype == "object"
357
+ and x[col].apply(lambda y: isinstance(y, dict)).any()
358
+ ]
359
+
360
+ for dict_col in dict_cols:
361
+ x[f"{dict_col}_reason"] = x[dict_col].apply(
362
+ lambda y: y.get("reason") if isinstance(y, dict) else None
363
+ )
364
+ x[f"{dict_col}_metric_config"] = x[dict_col].apply(
365
+ lambda y: (
366
+ y.get("metric_config") if isinstance(y, dict) else None
367
+ )
368
+ )
369
+ x[f"{dict_col}_passed"] = x[dict_col].apply(
370
+ lambda y: y.get("passed") if isinstance(y, dict) else None
371
+ )
372
+ x[f"{dict_col}_status"] = x[dict_col].apply(
373
+ lambda y: y.get("status") if isinstance(y, dict) else None
374
+ )
375
+
376
+ x = x.drop(columns=[dict_col])
377
+
378
+ x.columns = x.columns.str.replace("_reason_reason", "_reason")
379
+ x.columns = x.columns.str.replace("_reason_metric_config", "_metric_config")
380
+ x.columns = x.columns.str.replace("_reason_passed", "_passed")
381
+ x.columns = x.columns.str.replace("_reason_status", "_status")
382
+ return True, x
383
+
344
384
  except Exception as e:
345
- logger.error(f"Failed to parse response: {e}")
346
- return False, ""
385
+ logger.error(f"Failed to parse response: {e}", exc_info=True)
386
+ return False, pd.DataFrame()
347
387
 
348
388
 
349
389
  class FailedToRetrieveResults(Exception):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ragaai_catalyst
3
- Version: 1.0.7b3
3
+ Version: 1.0.7b4
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>
6
6
  Requires-Python: >=3.9
@@ -1,7 +1,7 @@
1
1
  ragaai_catalyst/__init__.py,sha256=0hf_H1xkhrpGnUWTbjvYOXXQta1S4JO2yud1Eqydt-I,226
2
2
  ragaai_catalyst/_version.py,sha256=JKt9KaVNOMVeGs8ojO6LvIZr7ZkMzNN-gCcvryy4x8E,460
3
3
  ragaai_catalyst/dataset.py,sha256=g0YH0QGDpCiJ4VULB3tukGFNLpWGw0ZRwLMP07ay2IE,3560
4
- ragaai_catalyst/experiment.py,sha256=2TOyHknEcNuWbDDO6cgDVAWc6wuhSqGCGYfKDOndqts,13161
4
+ ragaai_catalyst/experiment.py,sha256=7b81BGzZroUArS6UIsluNR6NWJSOcH8M4tFKiRRSoKc,14862
5
5
  ragaai_catalyst/ragaai_catalyst.py,sha256=DqEApmjxQufZZT4ap-IzoBmp3AX6RWMq7HXQ5kO0wsI,16468
6
6
  ragaai_catalyst/utils.py,sha256=TlhEFwLyRU690HvANbyoRycR3nQ67lxVUQoUOfTPYQ0,3772
7
7
  ragaai_catalyst/tracers/__init__.py,sha256=NppmJhD3sQ5R1q6teaZLS7rULj08Gb6JT8XiPRIe_B0,49
@@ -15,7 +15,7 @@ ragaai_catalyst/tracers/instrumentators/llamaindex.py,sha256=SMrRlR4xM7k9HK43hak
15
15
  ragaai_catalyst/tracers/instrumentators/openai.py,sha256=14R4KW9wQCR1xysLfsP_nxS7cqXrTPoD8En4MBAaZUU,379
16
16
  ragaai_catalyst/tracers/utils/__init__.py,sha256=KeMaZtYaTojilpLv65qH08QmpYclfpacDA0U3wg6Ybw,64
17
17
  ragaai_catalyst/tracers/utils/utils.py,sha256=ViygfJ7vZ7U0CTSA1lbxVloHp4NSlmfDzBRNCJuMhis,2374
18
- ragaai_catalyst-1.0.7b3.dist-info/METADATA,sha256=RBab5g5fSrrXqD4a-VWIuXdGQ33fZbE2qI4PUtLgTM8,5121
19
- ragaai_catalyst-1.0.7b3.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
20
- ragaai_catalyst-1.0.7b3.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
21
- ragaai_catalyst-1.0.7b3.dist-info/RECORD,,
18
+ ragaai_catalyst-1.0.7b4.dist-info/METADATA,sha256=AcE3Fj9TqlB4if-kqn70Kd0NPCae_8I1_FiS0iSe0tw,5121
19
+ ragaai_catalyst-1.0.7b4.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
20
+ ragaai_catalyst-1.0.7b4.dist-info/top_level.txt,sha256=HpgsdRgEJMk8nqrU6qdCYk3di7MJkDL0B19lkc7dLfM,16
21
+ ragaai_catalyst-1.0.7b4.dist-info/RECORD,,