-1
Daily
16,582
stars
3,227
forks
160
watchers
105
prs
301
issues
0
releases
README
AI PDF Chatbot & Agent Powered by LangChain and LangGraph This monorepo is a customizable template example of an AI chatbot agent that "ingests" PDF documents, stores embeddings in a vector database (Supabase), and then answers user queries using OpenAI (or another LLM provider) utilising LangChain and LangGraph as orchestration frameworks. This template is also an accompanying example to the book Learning LangChain (O'Reilly): Building AI and LLM applications with LangChain and LangGraph. [!IMPORTANT] This project is not actively maintained and is kept here for reference. Please do not expect responses to new issues or pull requests. Here's what the Chatbot UI looks like: Table of Contents 1. Features 2. Architecture Overview 3. Prerequisites 4. Installation 5. Environment Variables - Frontend Variables - Backend Variables 6. Local Development - Running the Backend - Running the Frontend 7. Usage - Uploading/Ingesting PDFs - Asking Questions - Viewing Chat History 8. Production Build & Deployment 9. Customizing the Agent 10. Troubleshooting 11. Next Steps --- Features - Document Ingestion Graph: Upload and parse PDFs into Document objects, then store vector embeddings into a vector database (we use Supabase in this example). - Retrieval Graph: Handle user questions, decide whether to retrieve documents or give a direct answer, then generate concise responses with references to the retrieved documents. - Streaming Responses: Real-time streaming of partial responses from the server to the client UI. - LangGraph Integration: Built using LangGraph’s state machine approach to orchestrate ingestion and retrieval, visualise your agentic workflow, and debug each step of the graph. - Next.js Frontend: Allows file uploads, real-time chat, and easy extension with React components and Tailwind. --- Architecture Overview ascii ┌─────────────────────┐ 1. Upload PDFs ┌───────────────────────────┐ │Frontend (Next.js) │ ──────────────────── │Backend (LangGraph) │ │ - React UI w/ chat │ │ - Ingestion Graph │ │ - Upload .pdf files │ │Backend (LangGraph) │ │ - Chat + SSE stream │ │ - Retrieval Graph │ │ - Display sources │ = 18 and that you have all dependencies installed. 5. Network Errors - Frontend must point to the correct NEXT_PUBLIC_LANGGRAPH_API_URL. By default, it is http://localhost:2024. Next Steps If you'd like to contribute to this project, feel free to open a pull request. Ensure it is well documented and includes tests in the test files. If you'd like to learn more about building AI chatbots and agents with LangChain and LangGraph, check out the book Learning LangChain (O'Reilly).
Discussions
#465Cannot read properties of undefined (reading 'text')1 comments · 2024-04-19#462Request failed with status code 4041 comments · 2024-03-13#454What are the versions of LangChain and Pinecone in this repo?1 comments · 2024-01-18#429Cannot get yarn to install0 comments · 2023-11-03#427Why are the answers less detailed than chat.openAI.com?0 comments · 2023-10-31#426Having trouble importing modules0 comments · 2023-10-30#420Getting InsufficientQuotaError2 comments · 2023-10-13#413Slack bot0 comments · 2023-09-17