Conversational memory retrieval and answer generation
What this workflow does
Interactive chat user asks a question, the system retrieves a similar archived conversation using embeddings and FAISS, answers with the LLM, and archives older exchanges back into the vector store.
Purpose
Maintain a chat that can recall relevant past conversations while continuing the dialogue
What it produces
messages / retrieved_conversation / vector_index / vector_items
Who relies on it
Interactive chat user
Why this workflow matters
- Improves continuity of long-running conversations
- Preserves older exchanges as searchable embeddings
- Returns an LLM-generated response informed by recent and retrieved context
Implementation references
- GetUserQuestionNode cookbook/pocketflow-chat-memory/nodes.py · lines 6–35
- EmbedNode.post() cookbook/pocketflow-chat-memory/nodes.py · lines 124–143
- EmbedNode.prep() cookbook/pocketflow-chat-memory/nodes.py · lines 94–104
- AnswerNode.post() cookbook/pocketflow-chat-memory/nodes.py · lines 74–91
- RetrieveNode.prep() cookbook/pocketflow-chat-memory/nodes.py · lines 146–165
- RetrieveNode.exec() cookbook/pocketflow-chat-memory/nodes.py · lines 167–193
- GetUserQuestionNode.exec() cookbook/pocketflow-chat-memory/nodes.py · lines 15–24
- GetUserQuestionNode.prep() cookbook/pocketflow-chat-memory/nodes.py · lines 7–13
- create_chat_flow() cookbook/pocketflow-chat-memory/flow.py · lines 4–30
- run_chat_memory_demo() cookbook/pocketflow-chat-memory/main.py · lines 3–23
- AnswerNode.exec() cookbook/pocketflow-chat-memory/nodes.py · lines 65–72
- EmbedNode.exec() cookbook/pocketflow-chat-memory/nodes.py · lines 106–122
- AnswerNode.prep() cookbook/pocketflow-chat-memory/nodes.py · lines 38–63
- RetrieveNode.post() cookbook/pocketflow-chat-memory/nodes.py · lines 195–203
- GetUserQuestionNode.post() cookbook/pocketflow-chat-memory/nodes.py · lines 26–35
- call_llm() cookbook/pocketflow-chat-memory/utils/call_llm.py · lines 4–13
- get_embedding() cookbook/pocketflow-chat-memory/utils/get_embedding.py · lines 5–17
- create_index() cookbook/pocketflow-chat-memory/utils/vector_index.py · lines 4–5
- add_vector() cookbook/pocketflow-chat-memory/utils/vector_index.py · lines 7–15
- search_vectors() cookbook/pocketflow-chat-memory/utils/vector_index.py · lines 17–41