from langchain_core.prompts import ChatPromptTemplate
prompt = ChatPromptTemplate.from_messages([
{"role": "user", "content": "{input}"} # Dict instead of tuple
])
Error:
KeyError: 'type'

from langchain_core.prompts import ChatPromptTemplate
prompt = ChatPromptTemplate.from_messages([
{"role": "user", "content": "{input}"} # Dict instead of tuple
])
Error:
KeyError: 'type'
Fix:
prompt = ChatPromptTemplate.from_messages([
("human", "{input}") # ✅ Use tuple syntax
])
Tell us about your project and get help tailored to your problem.
Contact usEveryone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.