From the course: Hands-On AI: Building LLM-Powered Apps

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Solution: Enabling load PDF to Chainlit app

Solution: Enabling load PDF to Chainlit app - Python Tutorial

From the course: Hands-On AI: Building LLM-Powered Apps

Solution: Enabling load PDF to Chainlit app

- [Instructor] Welcome back. Hopefully you enjoyed the exercise to add PDF loading and processing capability to our chat with PDF application. So that's go to app slash app.py. Let's first load the PDF file. We will use PDF plumber loader to load the temporary file that user have uploaded and then we can use loader.load. There are a wide variety of PDF loaders in the lichen library and I am picking PDF plumber only because I am familiar with it. You are free to use other PDF loader as well. After we load the PDF file, the file is long so we will have to chunk them into smaller documents as we mentioned previously. So we will use one of Lichen's document transformer called recursive character text Splitter to split our document into pieces. As we mentioned in the previous videos, we do have to budget and keep in mind about large language models contact length. Since we're using GPT 3.5, 16K, it has 16K context length. So if we set chunk size to 3000 and we are retrieving five tokens…

Contents