The Unofficial LangChain Docs Chatbot uses retrieval-augmented generation (RAG) and a large-language model (LLM) to answer questions about LangChain.
An example conversation in the Unofficial LangChain Docs Chatbot.
- The backend is a FastAPI application that uses the LangServe framework. It runs locally and exposes an
/invokeendpoint to receive questions and send answers. - The frontend is a Streamlit application. To run it on Streamlit Community Cloud, you must first expose the local backend to the internet using ngrok. Alternatively, you can run the frontend locally.
This project consists of four parts:
- load_and_split_data.py: Extracts text from HTML files containing the LangChain docs, splits the text into chunks, and writes the chunks to a JSONL file.
- create_vector_store_with_embeddings.py: Retrieves embeddings for each chunk and populates a Chroma vector store with the embeddings, chunks, and chunk metadata (source URL and unique ID).
- chatbot_api.py: Creates a conversational retrieval chain with memory enabled and launches a FastAPI application to make the endpoints available locally.
- streamlit_app.py: Launches the chatbot frontend as a Streamlit application that can be run locally or online using ngrok.