File size: 780 Bytes
eed34fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser

insights_bullet_prompt_template = """
Draw the key insights about objective, method, results and conclusions from the given excerpt in the form of bullet points. Also mention the figure or tables referred to along-with the corresponding bullet points
Note: if results and conclusions are not much different, feel free to combine them to avoid duplication of information
excerpt: {paper}
"""

insights_bullet_output_parser = StrOutputParser()
insights_bullet_prompt = PromptTemplate(
    template=insights_bullet_prompt_template,
    input_variables=["paper"],
)
insights_bullet_chain = (
    lambda model: insights_bullet_prompt | model | insights_bullet_output_parser
)