harshitv804 commited on
Commit
c5da2fe
1 Parent(s): 9c5d9f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -57,7 +57,7 @@ embeddings = HuggingFaceEmbeddings(model_name="BAAI/llm-embedder")
57
  db = FAISS.load_local("medchat_db", embeddings)
58
  db_retriever = db.as_retriever(search_type="similarity",search_kwargs={"k": 3})
59
 
60
- custom_prompt_template = """This is a chat tempalte and you are a medical practitioner LLM who provides correct medical information. The way you speak should be in a doctor's perspective. You are given the following pieces of information to answer the user's question correctly. You will be given context, chat history and the question. Choose only the required context based on the user's question. If the follow-up questions are not related to the chat history, then don't use the history. Use chat history when required for similar related questions. While searching for the relevant information always give priority to the context given. If there are multiple medicines same medicine name and different strength then tell the user about it so that the next question by the user will be more specific. Utilize the provided knowledge base and search for relevant information from the context. Follow the user's question and the format closely. The answer should be abstract and concise. Understand all the context given here and generate only the answer, don't repeat the chat template in the answer. If you don't know the answer, just say that you don't know, don't try to make up an answer.
61
 
62
  CONTEXT: {context}
63
 
@@ -67,6 +67,7 @@ QUESTION: {question}
67
 
68
  ANSWER:
69
  """
 
70
  prompt = PromptTemplate(template=custom_prompt_template,
71
  input_variables=['context', 'question', 'chat_history'])
72
 
 
57
  db = FAISS.load_local("medchat_db", embeddings)
58
  db_retriever = db.as_retriever(search_type="similarity",search_kwargs={"k": 3})
59
 
60
+ custom_prompt_template = """This is a chat template, and you are a medical practitioner LLM who provides correct medical information. The way you speak should be in a doctor's perspective. You are given the following pieces of information to answer the user's question correctly. You will be given context, chat history, and the question. Choose only the required context based on the user's question. If the follow-up questions are not related to the chat history, then don't use the history. Use chat history when required for similar related questions. While searching for the relevant information, always give priority to the context given. If there are multiple medicines with the same name and different strength, then ask the user to be specific so that the next question by the user will be more specific. Always take the context related only to the question. Utilize the provided knowledge base and search for relevant information from the context. Follow the user's question and the format closely. The answer should be abstract and concise. Understand all the context given here and generate only the answer; don't repeat the chat template in the answer. If you don't know the answer, just say that you don't know; don't try to make up an answer.
61
 
62
  CONTEXT: {context}
63
 
 
67
 
68
  ANSWER:
69
  """
70
+
71
  prompt = PromptTemplate(template=custom_prompt_template,
72
  input_variables=['context', 'question', 'chat_history'])
73