File size: 1,226 Bytes
2fae179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from langchain.prompts import PromptTemplate

qa_template = (
"""
<|im_start|>system
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."  <|im_end|>

<|im_start|>user
### User Question
{question} <|im_end|>
<|im_start|>assistant
Answer:
""")

summarization_template = (
"""
<|im_start|>system
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. <|im_end|>

<|im_start|>user
### Text to Summarize 
{document_text} <|im_end|>

<|im_start|>assistant
Summary:
""")

QA_PROMPT = PromptTemplate(
    input_variables=["question"],
    template=qa_template
)

SUMMARIZATION_PROMPT = PromptTemplate(
    input_variables=["document_text"],
    template=summarization_template
)