Spaces:
Running
Running
File size: 562 Bytes
8986591 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | """
app/nodes/rag.py
βββββββββββββββββ
CHECKPOINT 2 β RAG node
Retrieves relevant document chunks and stores them in state so the
LLM node can inject them into its prompt.
"""
from app.state import AgentState
from app.rag.store import retrieve_context
def rag_node(state: AgentState) -> AgentState:
context = retrieve_context(state["query"])
print(f"[RAG] Retrieved {len(context.splitlines())} chunk(s).")
log = state.get("node_log", []) + ["rag"]
return {**state, "rag_context": context, "node_log": log}
|