Find answers from the community

Updated 2 months ago

Hi Is it posssible to return the image

Hi, Is it posssible to return the image along with the text in the query response? I am using llamaindex to create vector index from the pdfs which have text as well as images.
L
d
4 comments
You'll have to explicitly create ImageDocument objects I think, that contain the text as well as the image.

Then, the image will be available on the response.source_nodes list

(the below code will fail if the source node is not an image node)
response.source_nodes[0].node.image
If I am creating a vector index for a pdf which has images and text, so first step would be to identify whether image has been indexed or not.
If an image matches the query been asked then it has to be passed along with matching text to LLM model and then wait for the response.
lastly I will have to find whether image is available on the response or not
doesn't look easy, huhh
I don't think our default pdf loaders grab images tbh, you might have to manually create the ImageDocuments for this
Our image support likely needs work, but it hasn't been highly requested enough to prioritize it πŸ˜…
Add a reply
Sign up and join the conversation on Discord