Spaces:
Running
Running
| # app/graph/rag_agent.py | |
| def rag_agent_node(state): | |
| """ | |
| Context is already fetched by router_node. | |
| This node exists to rerank or validate β keeps the graph extensible. | |
| Right now it passes state through; add reranking here later. | |
| """ | |
| # print("DEBUG β state received:", state) | |
| # β context already comes from router now | |
| context = state.get("context", "") | |
| sources = state.get("sources", []) | |
| score= state.get("score", 0.0) | |
| print(f"RAG AGENT β context length: {len(context)} | score: {score:.3f}") | |
| if not context: | |
| # Fallback: if somehow context is empty, reroute to general | |
| return { | |
| **state, | |
| "route": "general", | |
| } | |
| return { | |
| **state, | |
| # "context": context, | |
| # "sources": sources | |
| } | |