Spaces:
Sleeping
Sleeping
Update modules/railway_rag/railway_base_rag.py
Browse files
modules/railway_rag/railway_base_rag.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
# Railway Rules RAG Module
|
| 2 |
from helpers.hf_llm import generate_text
|
|
|
|
| 3 |
SYSTEM_PROMPT = (
|
| 4 |
"You are a railway rules assistant.\n"
|
| 5 |
"You must answer the user question ONLY if the provided railway rules, clearly and directly contain the answer.\n"
|
|
@@ -76,12 +77,12 @@ def answer_with_rag(query: str):
|
|
| 76 |
"- Do not add external knowledge.\n"
|
| 77 |
)
|
| 78 |
prompt = f"""
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
answer_text = generate_text(
|
| 86 |
prompt=prompt,
|
| 87 |
max_new_tokens=350,
|
|
|
|
| 1 |
# Railway Rules RAG Module
|
| 2 |
from helpers.hf_llm import generate_text
|
| 3 |
+
from modules.railway_rag.retrieval_engine import retrieve_rules
|
| 4 |
SYSTEM_PROMPT = (
|
| 5 |
"You are a railway rules assistant.\n"
|
| 6 |
"You must answer the user question ONLY if the provided railway rules, clearly and directly contain the answer.\n"
|
|
|
|
| 77 |
"- Do not add external knowledge.\n"
|
| 78 |
)
|
| 79 |
prompt = f"""
|
| 80 |
+
{SYSTEM_PROMPT}
|
| 81 |
+
|
| 82 |
+
{user_prompt}
|
| 83 |
+
|
| 84 |
+
Answer clearly and concisely.
|
| 85 |
+
"""
|
| 86 |
answer_text = generate_text(
|
| 87 |
prompt=prompt,
|
| 88 |
max_new_tokens=350,
|