Anish13 commited on
Commit
5dec220
1 Parent(s): 92ca4d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -34,9 +34,9 @@ model = HuggingFaceHub(
34
  task="conversational",
35
  model_kwargs={"temperature": 0.8, "max_length": 1000},
36
  )
37
- template = """Answer the quesiton based on the given context.
38
- {context}
39
- Question: {question}
40
  Helpful Answer:"""
41
  QA_CHAIN_PROMPT = PromptTemplate.from_template(template)
42
 
@@ -73,6 +73,7 @@ def greet(question, pdf_file):
73
  print("chat_history: ", chat_history)
74
  a = load_db(pdf_file, 5)
75
  r = a.invoke({"question": question, "chat_history": chat_history})
 
76
  match = re.search(r'Helpful Answer:(.*)', r['answer'])
77
  if match:
78
  helpful_answer = match.group(1).strip()
 
34
  task="conversational",
35
  model_kwargs={"temperature": 0.8, "max_length": 1000},
36
  )
37
+ template = """<s>[INST] You are a friendly study tutor chatbot that has access to a database of documents provided by the students. Use the chat history and your existing knowledge to answer the follow up question in a helpful and friendly way. Make sure your tone is that of a friendly study buddy. [/INST]
38
+ Chat History: {context}
39
+ Follow up question: {question}
40
  Helpful Answer:"""
41
  QA_CHAIN_PROMPT = PromptTemplate.from_template(template)
42
 
 
73
  print("chat_history: ", chat_history)
74
  a = load_db(pdf_file, 5)
75
  r = a.invoke({"question": question, "chat_history": chat_history})
76
+ print(a.return_source_documents)
77
  match = re.search(r'Helpful Answer:(.*)', r['answer'])
78
  if match:
79
  helpful_answer = match.group(1).strip()