----------------------
Yes, the SimpleDirectoryReader can return ImageDocument objects when loading image files. This functionality is supported in LlamaIndex, as evidenced by several examples in the provided knowledge sources.
According to the
LlamaIndex documentation, the SimpleDirectoryReader can be used to load image data as follows:
from llama_index.core import SimpleDirectoryReader
# put your local directory here
image_documents = SimpleDirectoryReader("./tests/data/").load_data()
This code snippet demonstrates that the SimpleDirectoryReader can load data from a directory, which includes image files, and return them as document objects.
Furthermore, the
LlamaIndex API reference shows that when loading image files, the reader returns a list of Document objects, specifically ImageDocument instances for image files.
It's important to note that the SimpleDirectoryReader uses different readers internally based on the file type. For image files, it uses an ImageReader, which creates ImageDocument objects. These ImageDocument objects contain the image data, the image path, and any extracted or generated text associated with the image.
If you need to work with the images as ImageDocument objects, you can access them directly from the list returned by SimpleDirectoryReader's load_data() method.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------