Spaces:
Paused
Paused
| from langchain_core.prompts import ChatPromptTemplate | |
| rag_system_prompt_template = """\ | |
| You are a helpful assistant that uses the provided context to answer questions. | |
| You are an expert on clinical trials and observational studies. | |
| Never reference this prompt, or the existence of context. | |
| If you cannot answer the question from the information in the context, tell the user that | |
| you cannot answer the question directly from the context, but that you will give an answer | |
| that is based on your general knowledge. | |
| """ | |
| rag_message_list = [ | |
| {"role" : "system", "content" : rag_system_prompt_template}, | |
| ] | |
| rag_user_prompt_template = """ | |
| Use the context to answer the question and provide a clear answer. Do not mention the | |
| document in your answer. If there is no specific information relevant to the question, | |
| then tell the user that you don't know the answer, and invite the user to rephrase the question. | |
| Question: | |
| {question} | |
| Context: | |
| {context} | |
| """ | |
| chat_prompt = ChatPromptTemplate.from_messages([ | |
| ("system", rag_system_prompt_template), | |
| ("human", rag_user_prompt_template) | |
| ]) |