|
from langchain_core.prompts import PromptTemplate |
|
from langchain_core.output_parsers import StrOutputParser |
|
|
|
tldr_prompt_template = """ |
|
Create a mind map of the given research paper along the given lines: |
|
what is {title}? |
|
what this paper brings to the research community including how it is different from existing work? |
|
what novel ideas/techniques are presented in this paper? |
|
|
|
The above sections may differ from paper to paper, hence you may need to adjust the structure accordingly by dropping / merging one or more sections. |
|
|
|
Here is the research paper abstract: ####{paper}#### |
|
|
|
Ensure that the outline is structured in Markdown format for clarity, facilitating its integration into documents or presentations. |
|
""" |
|
|
|
|
|
tldr_output_parser = StrOutputParser() |
|
tldr_prompt = PromptTemplate( |
|
template=tldr_prompt_template, |
|
input_variables=["title", "paper"], |
|
) |
|
tldr_chain = lambda model: tldr_prompt | model | tldr_output_parser |
|
|