Spaces:
Running
Running
File size: 458 Bytes
26f5539 195e631 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # app/graph/rag_answer_node.py
from app.core.llm_engine import llm
from app.core.prompts.rag_prompt import rag_prompt
from langchain_core.output_parsers import StrOutputParser
chain = rag_prompt | llm | StrOutputParser()
def rag_answer_node(state):
response = chain.invoke({
"context": state.get("context", ""),
"query": state.get("query")
})
return {
**state,
"final_answer": response
} |