Complete the code to import the ChatPromptTemplate class from langchain.prompts.
from langchain.prompts import [1]
The class ChatPromptTemplate is imported from langchain.prompts to create chat prompt templates.
Complete the code to create a ChatPromptTemplate with a system message and a human message.
from langchain.prompts import ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate prompt = ChatPromptTemplate.from_messages([ SystemMessagePromptTemplate.from_template("You are a helpful assistant."), [1].from_template("Hello, how can I help you?") ])
The human message part of the conversation uses HumanMessagePromptTemplate to define the user's input.
Fix the error in the code by completing the method to format messages with input variables.
response = prompt.format_messages([1]="What is the weather today?")
The input variable name used in the prompt template is usually input to pass user text.
Fill both blanks to create a ChatPromptTemplate with system and human messages using templates.
prompt = ChatPromptTemplate.from_messages([
[1].from_template("You are an expert."),
[2].from_template("Tell me about {{input}}.")
])The system message uses SystemMessagePromptTemplate and the human message uses HumanMessagePromptTemplate.
Fill all three blanks to create a ChatPromptTemplate with system, human, and AI messages.
prompt = ChatPromptTemplate.from_messages([
[1].from_template("You are a helpful assistant."),
[2].from_template("What is the capital of France?"),
[3].from_template("Paris is the capital of France.")
])The system message uses SystemMessagePromptTemplate, the human message uses HumanMessagePromptTemplate, and the AI message uses AIMessagePromptTemplate.