Open
Description
Description
I'm trying to use ImageReader
with LlamaIndex TS to create embeddings for images, but I receive the following error:
Error: Invalid node type: IMAGE
I couldn't find any TypeScript example in the documentation showing how to use ImageReader
with embeddings and vector stores. My goal is to index both PDF (text) and image files in the same vector store for retrieval.
Code snippet:
const llmOpenApi = openai({
apiKey: OPENAI_API_KEY,
model: 'gpt-4o',
});
Settings.llm = llmOpenApi;
Settings.embedModel = new HuggingFaceEmbedding({
modelType: 'sentence-transformers/all-MiniLM-L6-v2',
});
const pdfReader = new PDFReader();
const imageReader = new ImageReader();
const vectorStore = new QdrantVectorStore({
url: QDRANT_URL,
});
const pdfFiles = [path.join(dataDir, 'my-document.pdf')];
const imageFiles = [path.join(dataDir, 'my-image.png')];
let documents: Document[] = [];
for (const file of pdfFiles) {
documents = documents.concat(await pdfReader.loadData(file));
}
for (const file of imageFiles) {
documents = documents.concat(await imageReader.loadData(file));
}
const index = await VectorStoreIndex.fromDocuments(documents, {
vectorStores: {
TEXT: vectorStore,
IMAGE: vectorStore,
},
});
Expected behavior
- I expect to be able to embed and index both text and image documents using the same or separate vector stores, as suggested by the multimodal support in the docs.
Actual behavior
- The error
Invalid node type: IMAGE
is thrown at index creation.
Versions
"@llamaindex/huggingface": "^0.1.13",
"@llamaindex/openai": "^0.4.3",
"@llamaindex/qdrant": "^0.1.19",
"@llamaindex/readers": "^3.1.7",
"@llamaindex/workflow": "^1.1.7",
"llamaindex": "^0.11.6"
Additional context
- I couldn't find any working TypeScript example for multimodal indexing (text + image).
- I suspect the issue is related to embedding model selection or how
ImageReader
creates nodes, but the error message isn't clear. - What is the recommended way to embed and index images in LlamaIndex TS? Is there a supported embedding model for images in TypeScript?
Metadata
Metadata
Assignees
Labels
No labels