generative-ai icon indicating copy to clipboard operation
generative-ai copied to clipboard

Getting Error with custom embedding function

Open Aakif-cloud opened this issue 2 years ago • 2 comments

[~/.local/lib/python3.10/site-packages/chromadb/db/index/hnswlib.py](https://localhost:8080/#) in add(self, ids, embeddings, update)
    137         """Add or update embeddings to the index"""
    138 
--> 139         dim = len(embeddings[0])
    140 
    141         if self._index is None:

IndexError: list index out of range

Aakif-cloud avatar Jul 18 '23 11:07 Aakif-cloud

Hi @Aakif-cloud , this can happen if the embedding model was not (for some reason) successfully able to create an embedding for the input text, and so the embeddings variable becomes empty. You may want to consider doing a check that each embedding has the length you're expecting before adding it to your vector database.

polong-lin avatar Jul 21 '23 13:07 polong-lin

Where can i get the Embedding id?

AminaFaragai avatar Oct 15 '23 05:10 AminaFaragai