Spaces:
Sleeping
Sleeping
File size: 1,097 Bytes
c4eb0c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from langchain_core.prompts import ChatPromptTemplate
class PromptTemplates:
"""
The PromptTemplates class represents a collection of prompt templates used for generating chat prompts.
Attributes:
rag_QA_prompt (ChatPromptTemplate): A prompt template for generating RAG QA prompts.
Methods:
__init__(): Initializes all prompt templates as instance variables.
get_rag_qa_prompt(): Returns the RAG QA prompt.
Example usage:
prompt_templates = PromptTemplates()
rag_qa_prompt = prompt_templates.get_rag_qa_prompt()
"""
def __init__(self):
# Initializes all prompt templates as instance variables
self.rag_QA_prompt = ChatPromptTemplate.from_template("""
CONTEXT:
{context}
QUERY:
{question}
Answer the query in a pretty format if the context is related to it; otherwise, answer: 'Sorry, I can't answer. Please ask another question.'
""")
def get_rag_qa_prompt(self):
# Returns the RAG QA prompt
return self.rag_QA_prompt
|