Sdm0 commited on
Commit
7b0fe38
·
verified ·
1 Parent(s): 87e93c9

fix: always provide grounded RAGAS query

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -433,6 +433,10 @@ def _ragas_inputs_from_state(state, endpoint_name: str) -> dict | None:
433
  """Extract the inputs RAGAS needs from the finished graph state."""
434
  context_chunks = state.values.get("context_chunks", [])
435
  query = state.values.get("diff", "") or ""
 
 
 
 
436
  contexts = [c.content for c in context_chunks if c.content]
437
  # When vector retrieval is disabled on a small host, evaluate against the
438
  # PR diff itself. This preserves a grounded context for RAGAS instead of
 
433
  """Extract the inputs RAGAS needs from the finished graph state."""
434
  context_chunks = state.values.get("context_chunks", [])
435
  query = state.values.get("diff", "") or ""
436
+ if not query:
437
+ changed = state.values.get("changed_files", [])
438
+ paths = [getattr(item, "path", "") for item in changed if getattr(item, "path", "")]
439
+ query = "Review changed files: " + ", ".join(paths) if paths else "Review the pull request changes"
440
  contexts = [c.content for c in context_chunks if c.content]
441
  # When vector retrieval is disabled on a small host, evaluate against the
442
  # PR diff itself. This preserves a grounded context for RAGAS instead of