Update my_memory_logic.py
Browse files- my_memory_logic.py +2 -3
my_memory_logic.py
CHANGED
|
@@ -4,8 +4,7 @@ import os
|
|
| 4 |
|
| 5 |
# Import your actual RAG chain (or pipeline) from pipeline.py
|
| 6 |
# We'll assume `rag_chain` is exposed by pipeline.py
|
| 7 |
-
from pipeline import
|
| 8 |
-
|
| 9 |
# We'll import the session-based classes from langchain_core
|
| 10 |
# If they're in different modules, adjust accordingly.
|
| 11 |
from langchain_core.chat_history import BaseChatMessageHistory
|
|
@@ -32,7 +31,7 @@ def get_session_history(session_id: str) -> BaseChatMessageHistory:
|
|
| 32 |
# This wraps your `rag_chain` so it automatically reads/writes
|
| 33 |
# conversation history from get_session_history for each session.
|
| 34 |
conversational_rag_chain = RunnableWithMessageHistory(
|
| 35 |
-
|
| 36 |
get_session_history, # fetches or creates ChatMessageHistory by session_id
|
| 37 |
input_messages_key="input", # key in the dict for user's new query
|
| 38 |
history_messages_key="chat_history", # key for existing chat logs
|
|
|
|
| 4 |
|
| 5 |
# Import your actual RAG chain (or pipeline) from pipeline.py
|
| 6 |
# We'll assume `rag_chain` is exposed by pipeline.py
|
| 7 |
+
from pipeline import run_with_chain_context
|
|
|
|
| 8 |
# We'll import the session-based classes from langchain_core
|
| 9 |
# If they're in different modules, adjust accordingly.
|
| 10 |
from langchain_core.chat_history import BaseChatMessageHistory
|
|
|
|
| 31 |
# This wraps your `rag_chain` so it automatically reads/writes
|
| 32 |
# conversation history from get_session_history for each session.
|
| 33 |
conversational_rag_chain = RunnableWithMessageHistory(
|
| 34 |
+
run_with_chain_context, # the main chain from pipeline.py
|
| 35 |
get_session_history, # fetches or creates ChatMessageHistory by session_id
|
| 36 |
input_messages_key="input", # key in the dict for user's new query
|
| 37 |
history_messages_key="chat_history", # key for existing chat logs
|