Back to All questionsHow do I fix KeyError: 'Invalid prompt schema' when loading prompt YAML files with literal braces?
Ask questionyaml
# prompt.yaml
type: prompt
input_variables:
- name
template: |
Generate JSON:
{
"name": "{name}"
}
python
from langchain_core.prompts import load_prompt
prompt = load_prompt("prompt.yaml")
Error:
text
KeyError: 'Invalid prompt schema; check for mismatched or missing input parameters'
1 answerHelpful solutions from the community
Fix: Escape braces in YAML:
yaml
template: |
Generate JSON:
{{
"name": "{name}"
}}
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.