From the course: Advanced RAG Applications with Vector Databases

Unlock the full course today

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

Demo: Query images with text

Demo: Query images with text

- [Instructor] We're going to pick up right where we left off. So, with our vectors already stored, the first thing we do is create a retriever object out of the vector store. This part should be familiar. This next part will not be as familiar. We need two more imports here, BytesIO and Images. These are for handling byte data and image data. In this code block, we create three functions, a resizing function to feed the data into OpenAI, a function to check if you're in Base64, a function to check if the string is in Base64 and a function to split image and text input. The resizing function takes an input in the form of a Base64 string, and it uses the image and BytesIO library to open that string as an image, resizes the image, saves the resized image and returns that as a Base64-encoded string again. The next function simply checks if you have a Base64 string. The third function takes your series of docs. The next function takes your input documents, checks if you are using an…

Contents