Back to Browse

LangChain Tutorial (Python) #5: Adding Chat History to Chatbot

23.6K views
Jan 26, 2024
14:29

#openai #langchain We can supercharge a simple Retrieval Chain by including the Conversation History in the chain and vector retrieval. This will allow users to ask follow up questions, and the model will be able to recall information from the chat history. ☕ Buy me a coffee: https://www.buymeacoffee.com/leonvanzyl 📑 Useful Links: Langchain Python docs: https://python.langchain.com/docs/get_started/introduction Source Code: https://github.com/leonvanzyl/langchain-python-tutorial Langsmith: https://www.langchain.com/langsmith 💬 Chat with Like-Minded Individuals on Discord: https://discord.gg/VwHZzbNawh 🕒 TIMESTAMPS: 00:00 - Intro 00:37 - Project setup 01:29 - Grab user input from terminal 03:45 - Add a Chat Loop 04:43 - Add Chat History 05:17 - HumanMessage and AIMessage Schemas 07:07 - MessagesPlaceholder 08:00 - Dynamically build chat history 08:52 - Add History to Retrieval 09:15 - Intro to Langsmith 09:35 - Intro to History Aware Retrievers 10:23 - Add History Aware Retriever 11:36 - Retriever Prompt 13:04 - Display generated query in Langsmith 14:12 - Congrats!

Download

1 formats

Video Formats

360pmp419.5 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

LangChain Tutorial (Python) #5: Adding Chat History to Chatbot | NatokHD