Recommended system instruction to use chat history? #28162
jsmith173
announced in
Ask Dosu (Archived)
Replies: 1 comment 1 reply
-
The recommended system instruction for using chat history is to use a prompt that includes a from langchain_core.prompts import MessagesPlaceholder
contextualize_q_system_prompt = (
"Given a chat history and the latest user question "
"which might reference context in the chat history, "
"formulate a standalone question which can be understood "
"without the chat history. Do NOT answer the question, "
"just reformulate it if needed and otherwise return it as is."
)
contextualize_q_prompt = ChatPromptTemplate.from_messages(
[
("system", contextualize_q_system_prompt),
MessagesPlaceholder("chat_history"),
("human", "{input}"),
]
) This setup helps incorporate historical messages into the current processing logic [1]. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
@dosu
What is the recommended system instruction to use chat history?
I have "You are a helpful assistant." but this does not seems correct
Beta Was this translation helpful? Give feedback.
All reactions