|
from langchain.prompts import PromptTemplate
|
|
|
|
qa_template = (
|
|
"""
|
|
<|start_header_id|>system<|end_header_id|>
|
|
You are an AI assistant specialized in answering academic queries with accuracy and clarity.
|
|
|
|
### Instructions
|
|
- Read the user's question carefully.
|
|
- Provide a concise and informative answer based on available knowledge.
|
|
- If the question is unclear, ask for clarification.
|
|
- If you do not know the answer, respond with "I'm not sure."
|
|
|
|
### User Question
|
|
{question}
|
|
|
|
<|eot_id|><|start_header_id|>user<|end_header_id|>
|
|
|
|
Question: Please provide a detailed answer.
|
|
<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
|
Answer:
|
|
""")
|
|
|
|
summarization_template = (
|
|
"""
|
|
<|start_header_id|>system<|end_header_id|>
|
|
You are a highly skilled AI that specializes in summarizing academic content.
|
|
|
|
### Instructions
|
|
- Read the provided text carefully.
|
|
- Extract the most important key points while maintaining clarity.
|
|
- Summarize in a way that retains the core meaning but is concise.
|
|
- Output only the summary without additional explanations.
|
|
|
|
### Text to Summarize
|
|
{document_text}
|
|
|
|
<|eot_id|><|start_header_id|>user<|end_header_id|>
|
|
|
|
Task: Provide a concise summary.
|
|
<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
|
Summary:
|
|
""")
|
|
|
|
QA_PROMPT = PromptTemplate(
|
|
input_variables=["question"],
|
|
template=qa_template
|
|
)
|
|
|
|
SUMMARIZATION_PROMPT = PromptTemplate(
|
|
input_variables=["document_text"],
|
|
template=summarization_template
|
|
)
|
|
|