Back
Tutorials

Chat With Your PDFs PART 1: An End-to-End LangChain Tutorial

Focused CEO, Austin Vance, shows you how to build a chat application with LangChain to ingest and query PDFs

Jan 23, 2024

By Austin Vance

Share:
  • linkedin
  • facebook
  • instagram
  • twitter

A common use case for developing AI chat bots is ingesting PDF documents and allowing users to ask questions, inspect the documents, and learn from them. In this tutorial we will start with a 100% blank project and build an end-to-end chat application that allows users to chat about the Epic Games vs Apple Lawsuit. There's a lot of content packed into this one video so please ask questions in the comments and I will do my best to help you get past any hurdles. 

In Part 1 You will Learn:

  • Create a new app using ‪@LangChain‬ 's LangServe

  • ingestion of PDFs using @unstructuredio‬

  • Chunking of documents via @LangChain‬'s SemanticChunker

  • Embedding chunks using @OpenAI‬'s embeddings API

  • Storing embedded chunks into a PGVector a vector database

  • Build a LCEL Chain for LangServe that uses PGVector as a retriever

  • Use the LangServe playground as a way to test our RAG

  • Stream output including document sources to a future front end.

In Part 2 we will focus on:

  • Creating a front end with Typescript, React, and Tailwind

  • Display sources of information along with the LLM output

  • Stream to the frontend with Server Sent Events

In Part 3 we will focus:

In Part 4 we will focus on:

  • Adding Memory to the @LangChain‬ Chain with PostgreSQL

  • Add Multiquery to the chain for better breadth of search

  • Add sessions to the Chat History
     


 

Github repo 

https://github.com/focused-labs/pdf_rag 

 


Chapters  

0:00 - Intro 
0:49 - Start a New LangServe Project 
2:22 - Start Building the Document Importer 
11:40 - Use the Semantic Chunker 
17:05 - Install & Use PGVector 
26:45 - Build the LLM Chain with LCEL 
32:00 - Retrieve Documents from PGVector 
36:10 - Complete the Chain 
39:35 - Inspect Documents coming back from Retriever 
40:40 - Use the Chain in LangServe 
42:00 - Add Types to your Chain 
43:50 - Use the LangServe Playground 
45:00 - Recap 
46:40 - Next time we will...

Back to Explore Focused Lab
/Contact us

Let’s build better software together