File size: 1,313 Bytes
ce5d5d0
 
8658715
 
 
ce5d5d0
 
 
 
6b66af2
 
8658715
 
ce5d5d0
 
 
 
 
 
8658715
6b66af2
 
 
ce5d5d0
 
 
 
 
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
##############################################################################
# Exercise 1:
# Please utilize Chainlit's app playground for prompt engineering and
# experimentation. Once done, modify the prompts template below with your
# newly developed prompts.
##############################################################################
from langchain.prompts import PromptTemplate


template = """Please act as an expert financial analyst when you answer the questions and pay special attention to the financial statements.  Operating margin is also known as op margin and is calculated by dividing operating income by revenue.
Given the following extracted parts of a long document and a question, create a final answer with references ("SOURCES"). Operating margin is also known as op margin.
If you don't know the answer, just say that you don't know. Don't try to make up an answer.
ALWAYS return a "SOURCES" field in your answer, with the format "SOURCES: <source1>, <source2>, <source3>, ...".

QUESTION: {question}
=========
{summaries}
=========
FINAL ANSWER:"""

PROMPT = PromptTemplate(
    template=template, input_variables=["summaries", "question"]
)

EXAMPLE_PROMPT = PromptTemplate(
    template="Content: {page_content}\nSource: {source}",
    input_variables=["page_content", "source"],
)