mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-07 10:25:17 +03:00
2.2 KiB
2.2 KiB
In [1]:
from langchain.llms import OpenAI
from langchain import PromptTemplate, LLMChainIn [2]:
template = """Question: {question}
Answer: Let's think step by step."""
prompt = PromptTemplate(template=template, input_variables=["question"])In [3]:
llm = OpenAI()In [4]:
llm_chain = LLMChain(prompt=prompt, llm=llm)In [5]:
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"
llm_chain.run(question)Out [5]:
' Justin Bieber was born in 1994, so the NFL team that won the Super Bowl in that year was the Dallas Cowboys.'