Skip to content
Discussion options

You must be logged in to vote

To add chat memory functionality to the achat method, you can follow a similar approach as with the chat method. Here's how you can modify the achat method to include chat memory:

  1. Retrieve chat history: Get the chat history from the memory buffer.
  2. Add the new message to the chat history: Append the new user message to the chat history.
  3. Process the message with the query pipeline: Use the query pipeline to process the message.
  4. Add the response to the chat history: Append the assistant's response to the chat history.
  5. Update the memory: Store the updated chat history back in the memory buffer.

Here's the updated code:

from llama_index.legacy.chat_engine.types import (
    AgentChatResponse,…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@SarahSohana27
Comment options

@dosubot
Comment options

Answer selected by SarahSohana27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant