Subha95 commited on
Commit
ec49bb3
·
verified ·
1 Parent(s): 9b41328

Update chatbot_rag.py

Browse files
Files changed (1) hide show
  1. chatbot_rag.py +13 -14
chatbot_rag.py CHANGED
@@ -79,23 +79,22 @@ def build_qa():
79
  retriever = vectorstore.as_retriever(search_kwargs={"k": 3})
80
 
81
  prompt = PromptTemplate(
82
- input_variables=["context", "question"],
83
- template="""
84
- Use the following context to answer the question.
85
- - Answer from the docs
86
- - Answer in plain natural language.
87
- - Do not include code, imports, functions, or explanations of how to implement code.
88
- - If you don't know, just say "I don't know."
89
-
90
- Context:
91
- {context}
92
-
93
- Question: {question}
94
- Answer (one short sentence):
95
- """,
96
  )
97
 
98
 
 
99
  # 6. Helper functions
100
  def format_docs(docs):
101
  """Join document contents into a single string, skipping empty ones."""
 
79
  retriever = vectorstore.as_retriever(search_kwargs={"k": 3})
80
 
81
  prompt = PromptTemplate(
82
+ input_variables=["context", "question"],
83
+ template="""
84
+ You are a helpful assistant.
85
+ Use the following context to answer the question.
86
+ - If the answer is in the context, provide it in ONE short, plain sentence.
87
+ - If not in the context, say: "I don't know."
88
+
89
+ Context:
90
+ {context}
91
+ Question: {question}
92
+ Answer:
93
+ """,
 
 
94
  )
95
 
96
 
97
+
98
  # 6. Helper functions
99
  def format_docs(docs):
100
  """Join document contents into a single string, skipping empty ones."""