Sdm0 commited on
Commit
baa5c1b
·
verified ·
1 Parent(s): 0317f7d

fix: expose skipped RAGAS state

Browse files
Files changed (1) hide show
  1. api.py +7 -1
api.py CHANGED
@@ -82,7 +82,13 @@ def _public_job(job: dict[str, Any]) -> dict[str, Any]:
82
  def _with_ragas(job: dict[str, Any]) -> dict[str, Any]:
83
  result = _public_job(job)
84
  task_id = result.get("ragas_task_id")
85
- if task_id:
 
 
 
 
 
 
86
  with _ragas_lock:
87
  task = _ragas_tasks.get(task_id)
88
  if not task:
 
82
  def _with_ragas(job: dict[str, Any]) -> dict[str, Any]:
83
  result = _public_job(job)
84
  task_id = result.get("ragas_task_id")
85
+ if not task_id:
86
+ result["ragas"] = {
87
+ "status": "skipped",
88
+ "scores": result.get("ragas_scores") or {},
89
+ "reason": "No retrieval context was available for RAGAS evaluation",
90
+ }
91
+ else:
92
  with _ragas_lock:
93
  task = _ragas_tasks.get(task_id)
94
  if not task: