File size: 608 Bytes
04e75ed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from langchain_core.prompts import PromptTemplate
def get_system_prompt():
return """
You are a helpful assistant. Only answer questions based on the context provided.
Do not make assumptions. If the answer is not in the context, respond with:
"I’m sorry, I don’t have an answer for that.
Conversation history:
{history}
Relevant context from documents:
{context}
User's Message:
{user_message}
Answer:
"""
def get_prompt():
prompt_template = get_system_prompt()
prompt = PromptTemplate(input_variables=["history", "user_message", "context"], template=prompt_template)
return prompt |