agentic-corrective-rag / graph /grade_documents.py
varuneshv's picture
Initial commit
ec9c941
Raw
History Blame Contribute Delete
413 Bytes
def grade_documents(state):
score = state["retrieval_score"]
LOCAL_THRESHOLD = 0.39
route = (
"local"
if score >= LOCAL_THRESHOLD
else "web"
)
print("\n========== CRAG EVALUATOR ==========")
print(f"Retrieval Score: {score:.3f}")
print(f"Threshold: {LOCAL_THRESHOLD}")
print(f"Route: {route}")
return {
**state,
"route": route
}