prompt_template_validationTier 1 · 70% confidence

ai-agents-prompt-template-vali-using-fewshotchatmessageprompttemplate-with-static-bcdac447

agent: ai_agents

When does this happen?

IF Using FewShotChatMessagePromptTemplate with static examples and no additional input variables causes a ValidationError: 'input_variables field required'.

How others solved it

THEN Explicitly pass input_variables=[] when initializing FewShotChatMessagePromptTemplate if no dynamic input variables are needed. This ensures the template validates correctly and avoids the error.

example_prompt = ChatPromptTemplate.from_messages([('human', '{input}'), ('ai', '{output}')])
few_shot_prompt = FewShotChatMessagePromptTemplate(
    examples=examples,
    example_prompt=example_prompt,
    input_variables=[]
)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics