1Z0-1127-25 ChatPromptTemplate Practice Question
A developer is using LangChain's ChatPromptTemplate to construct a prompt for a conversational agent. The prompt should include a system message, a placeholder for conversation history, and the latest user query. Which TWO components should they include in the template?
⚠ Common exam trap
Oracle exams often test the distinction between message types used in prompt construction versus message types used in conversation history, leading candidates to incorrectly include `AIMessage` as a template component when it should only appear in the `history` placeholder.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
SystemMessage
The two necessary components are a SystemMessage to set the agent's behavior and a MessagesPlaceholder to store conversation history. The latest user query is provided as the input variable to the template at runtime, not as a static component in the template itself. Therefore, HumanMessage is not required in the template definition.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
AIMessage
Why it's wrong here
AIMessage is not used as a template component; it represents assistant messages that appear in the history, not in the template definition.
- ✓
SystemMessage
Why this is correct
SystemMessage is correct because it defines the system-level instruction for the agent.
- ✓
MessagesPlaceholder with variable name 'history'
Why this is correct
MessagesPlaceholder with variable name 'history' is correct as it holds the conversation history to maintain context.
- ✗
HumanMessage
Why it's wrong here
HumanMessage is not needed as a separate component because the latest user query is passed as the input variable to the template chain, not defined statically.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-1127-25 question from scratch — 768 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-1127-25 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-1127-25 exam.