Complete the code to import the main LangChain class for building LLM apps.
from langchain.chains import [1]
The LLMChain class is the core building block in LangChain for chaining language model calls.
Complete the code to create a prompt template in LangChain.
from langchain.prompts import [1] prompt = [1](template="Hello, {name}!")
PromptTemplate is the class used to create prompt templates with variables.
Fix the error in this LangChain code to run the chain with input variables.
result = chain.run([1])The run method expects a dictionary of input variables, so use {'name': 'Alice'}.
Fill both blanks to create an LLMChain with OpenAI model and prompt template.
from langchain.llms import [1] from langchain.prompts import [2] from langchain.chains import LLMChain chain = LLMChain(llm=[1](), prompt=[2](template="Hello, {name}!"))
OpenAI is the LLM class and PromptTemplate is used for the prompt in LLMChain.
Fill all three blanks to build and run a LangChain app that greets a user.
from langchain.llms import [1] from langchain.prompts import [2] from langchain.chains import LLMChain chain = LLMChain(llm=[1](), prompt=[2](template="Hello, {name}!")) output = chain.run([3]) print(output)
Use OpenAI as the LLM, PromptTemplate for the prompt, and pass inputs as a dictionary {'name': 'Bob'} to run.