# main/examples/llm_prompt_optimization/evaluate_prompts.py
try:
formatted_prompt = prompt_template.format(instruction=instruction)
except KeyError:
# Handle prompts with different placeholder names
formatted_prompt = prompt_template.replace("{instruction}", instruction)
The fallback doesn't seem to handle the KeyError. If there's a key error wouldn't it mean that the prompt_template does not contain "{instruction}".