Repository navigation
fix: store user messages in the chat history in tutorial 48 - #497
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
The first pipeline only connected llm.replies to message_writer after the OutputAdapter was removed in deepset-ai#447, so the chat history kept only assistant messages and follow-up prompts lost earlier questions. Join the prompt and the replies with ListJoiner before writing.
|
Notebooks changed:
Review visual diffs and comment on any notebook cell. All comments sync back to this PR. Powered by ReviewNB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the conversational pipeline in tutorial 48 (Conversational RAG Agent) losing the user's questions.
Root cause: #447 removed the
OutputAdapter(message_joiner) from this tutorial and connectedllm.repliesstraight tomessage_writer.messages. The writer then stores only the assistant replies, so after two turns the chat history holds twoassistantmessages and nousermessage, and the second prompt sent to the LLM no longer contains the first question. The notebook text still says themessage_joinermerges the user message with the reply, and the stored outputs still show both roles.Fix: join the prompt and the replies with core
ListJoiner(list[ChatMessage])(not deprecated, nounsafe=True) beforemessage_writer, and refresh the stale pipeline-description output. The Agent pipeline already writesagent.messages(user + assistant) and is unchanged.Test: ran the notebook's chat-history cells with a stub generator, two turns, and checked the stored roles and that the second LLM call includes the first question.
['assistant', 'assistant'], assertion fails.['user', 'assistant', 'user', 'assistant'], passes.Reproduction: haystack-ai 3.5.0 and haystack-experimental 0.19.0.post1; build the first pipeline from the notebook, run two queries with a
chat_history_id, then callmessage_store.retrieve_messages(chat_history_id=..., last_k=None).This contribution was prepared with the help of an AI coding assistant (Claude Code); the change and the test were produced by that session and submitted by the account holder.