Spaces:
Running
Running
Update app/graph/nodes/rag_answer_node.py
Browse files
app/graph/nodes/rag_answer_node.py
CHANGED
|
@@ -1,49 +1,4 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
| 3 |
-
# from langchain_core.prompts import PromptTemplate
|
| 4 |
-
# from app.core.llm_engine import run_llm
|
| 5 |
-
# from app.core.prompts.rag_prompt import rag_prompt
|
| 6 |
-
# # rag_prompt = PromptTemplate(
|
| 7 |
-
# # input_variables=["context", "query"],
|
| 8 |
-
# # template=(
|
| 9 |
-
# # "You are a document intelligence system.\n"
|
| 10 |
-
# # "Answer ONLY using the provided context.\n"
|
| 11 |
-
# # "If answer is not present, say: 'Not in document'.\n\n"
|
| 12 |
-
|
| 13 |
-
# # "Keep response concise:\n"
|
| 14 |
-
# # "- Short explanation\n"
|
| 15 |
-
# # "- Bullet points if useful\n"
|
| 16 |
-
# # "- Max 120 words\n\n"
|
| 17 |
-
|
| 18 |
-
# # "Avoid repeating the question.\n\n"
|
| 19 |
-
|
| 20 |
-
# # "Context:\n{context}\n\n"
|
| 21 |
-
# # "Question:\n{query}\n\n"
|
| 22 |
-
# # "Answer:"
|
| 23 |
-
# # )
|
| 24 |
-
# # )
|
| 25 |
-
|
| 26 |
-
# def rag_answer_node(state):
|
| 27 |
-
# response = run_llm(rag_prompt, {
|
| 28 |
-
# "context": state.get("context", ""),
|
| 29 |
-
# "query": state.get("query")
|
| 30 |
-
# })
|
| 31 |
-
|
| 32 |
-
# return {
|
| 33 |
-
# **state,
|
| 34 |
-
# "final_answer": response
|
| 35 |
-
# }
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
from app.core.llm_engine import llm
|
| 49 |
from app.core.prompts.rag_prompt import rag_prompt
|
|
|
|
| 1 |
+
# app/graph/rag_answer_node.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
from app.core.llm_engine import llm
|
| 4 |
from app.core.prompts.rag_prompt import rag_prompt
|