a synopsis given a title of a play and the era it is set in.llm = OpenAI(temperature=.7)synopsis_template = """You are a playwright. Given the title of play and the era it is set in, it is your job to write a synopsis for that title.Title: {title}Era: {era}Playwright: This is a synopsis for the above play:"""synopsis_prompt_template = PromptTemplate(input_variables=["title", "era"], template=synopsis_template)synopsis_chain = LLMChain(llm=llm, prompt=synopsis_prompt_template, output_key="synopsis")# This is an LLMChain to write a review of a play given a synopsis.llm = OpenAI(temperature=.7)template = """You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.Play Synopsis:{synopsis}Review from a New York Times play critic of the above play:"""prompt_template = PromptTemplate(input_variables=["synopsis"], template=template)review_chain = LLMChain(llm=llm, prompt=prompt_template, output_key="review")# This is the overall chain where we run these two chains in sequence.from langchain.chains import SequentialChainoverall_chain = SequentialChain(    chains=[synopsis_chain, review_chain],    input_variables=["era", "title"],    # Here we return multiple variables    output_variables=["synopsis", "review"],    verbose=True)overall_chain({"title":"Tragedy at sunset on the beach", "era": "Victorian England"})    > Entering new SequentialChain chain...    > Finished chain.    {'title': 'Tragedy at sunset on the beach',     'era': 'Victorian England',     'synopsis': "\n\nThe play follows the story of John, a young man from a wealthy Victorian family, who dreams of a better life for himself. He soon meets a beautiful young woman named Mary, who shares his dream. The two fall in love and decide to elope and start a new life together.\n\nOn their journey, they make their way to a beach at sunset, where they plan to exchange their vows of love. Unbeknownst to them, their plans are overheard by John's father, who
The next step after calling a language model is to make a series of calls to a language model. This is particularly useful when you want to take the output from one call and use it as the input to another.
The next step after calling a language model is to make a series of calls to a language model. This is particularly useful when you want to take the output from one call and use it as the input to another. ->: a synopsis given a title of a play and the era it is set in.llm = OpenAI(temperature=.7)synopsis_template = """You are a playwright. Given the title of play and the era it is set in, it is your job to write a synopsis for that title.Title: {title}Era: {era}Playwright: This is a synopsis for the above play:"""synopsis_prompt_template = PromptTemplate(input_variables=["title", "era"], template=synopsis_template)synopsis_chain = LLMChain(llm=llm, prompt=synopsis_prompt_template, output_key="synopsis")# This is an LLMChain to write a review of a play given a synopsis.llm = OpenAI(temperature=.7)template = """You are a play critic from the New York Times. Given the synopsis of play, it is your job to write a review for that play.Play Synopsis:{synopsis}Review from a New York Times play critic of the above play:"""prompt_template = PromptTemplate(input_variables=["synopsis"], template=template)review_chain = LLMChain(llm=llm, prompt=prompt_template, output_key="review")# This is the overall chain where we run these two chains in sequence.from langchain.chains import SequentialChainoverall_chain = SequentialChain(    chains=[synopsis_chain, review_chain],    input_variables=["era", "title"],    # Here we return multiple variables    output_variables=["synopsis", "review"],    verbose=True)overall_chain({"title":"Tragedy at sunset on the beach", "era": "Victorian England"})    > Entering new SequentialChain chain...    > Finished chain.    {'title': 'Tragedy at sunset on the beach',     'era': 'Victorian England',     'synopsis': "\n\nThe play follows the story of John, a young man from a wealthy Victorian family, who dreams of a better life for himself. He soon meets a beautiful young woman named Mary, who shares his dream. The two fall in love and decide to elope and start a new life together.\n\nOn their journey, they make their way to a beach at sunset, where they plan to exchange their vows of love. Unbeknownst to them, their plans are overheard by John's father, who