To clarify, with the below code, formatted_message does not contain any double curly braces, and if you pass formatted_message to a chat model, it won’t see double curly braces. The {user_input} template variable is set to the input string that is passed in.
from langchain.prompts import PromptTemplate
template = PromptTemplate.from_template(
"""
Hello, {{user}}!
Here is your input:
{user_input}
""".strip()
)
formatted_message = template.format(
user_input="example user inputs with {doubled curly braces}"
)
formatted_message = “Hello, {user}!\nHere is your input:\nexample user inputs with {doubled curly braces}”