Back to All questionsWhy do I get KeyError: 'Input to PromptTemplate is missing variables {\'"content"\'}' when passing input dictionary variables?
Ask questionpython
from langchain_core.prompts import PromptTemplate
prompt = PromptTemplate(
template="Summarize: {content}",
input_variables=["content"]
)
formatted = prompt.format({"content": "Text"})
Error:
text
KeyError: 'Input to PromptTemplate is missing variables {\'"content"\'}'
1 answerHelpful solutions from the community
Fix:
python
formatted = prompt.format(content="Text")
Need a custom solution?
Tell us about your project and get help tailored to your problem.
Contact usHave an answer? Join the conversation.
Everyone can read. Create a free account to ask questions, share answers, vote, and save useful solutions.