05. RAG chain to remember interactive

Chain creation method to remember previous conversations

Advance knowledge to understand this

# API KEY A configuration file for managing environment variables
from dotenv import load_dotenv

# API KEY load information
load_dotenv()
 True 
# LangSmith set up tracking. https://smith.langchain.com
# !pip install langchain-teddynote
from langchain_teddynote import logging

# Enter a project name.
logging.langsmith("CH12-RAG")
 Start tracking LangSmith. 
[Project name] 
CH12-RAG 

One. Add only dialogs to regular Chain

Create a chain that records the conversation ( chain_with_history )

Run the first question

Then run the question

2. RAG + RunnableWithMessageHistory

First, create a regular RAG Chain. However, in the six-stage prompt {chat_history} Be sure to add

Define functions to save the conversation

Run the first question

Execute subsequent questions

Last updated