花括号解析报错
LangChain 03:Message解析
# 原来的(会触发模板解析)
executor_prompt_tpl = ChatPromptTemplate.from_messages([
("system", executor_prompt.format(past_steps=past_steps_str, current_step=current_plan_str)),
("placeholder", "{messages}")
])
past_steps_str:'{"actionTitle": "...", "symbols": ["TSLA","AAPL"], ...} I have fetched ...'
导致解析错误
# ✅ 用 SystemMessage 固定文本;用 MessagesPlaceholder 承载对话消息
executor_prompt_tpl = ChatPromptTemplate.from_messages([
SystemMessage(content=executor_prompt.format(
past_steps=past_steps_str,
current_step=current_plan_str
)),
MessagesPlaceholder("messages"),
])