Spaces:
Running
Running
from langchain_core.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate | |
system_template = '''The following are passages from the books and teachings of Paramhansa Yogananda, his disciples, or other | |
sources related to the Self-Realization Fellowship / Yogoda Satsanga Society. | |
Extract the most relevant quotes from the given passage that directly address the user's original query and are the most helpful and/or insipriational to the user. | |
Ensure that quotes are verbatim and provide specific information related to the query. | |
''' | |
system_message = SystemMessagePromptTemplate.from_template(system_template) | |
human_message_template = '''Here is the original query: {query} \n\n | |
Here is the passage: {passage} | |
Now think step-by-step and follow the instructions carefully: | |
1. Read the original query carefully. | |
2. Analyze the given passage and identify sections that directly address the query. | |
3. Extract the most relevant quotes, ensuring they are verbatim from the passage. | |
4. Rank the quotes based on their relevance and importance to the query. | |
5. Return the top 3 most relevant quotes in the specified format.''' | |
human_message = HumanMessagePromptTemplate.from_template(human_message_template) | |
quote_finder_prompt = ChatPromptTemplate.from_messages([ | |
system_message, human_message | |
]) |