0

This is the code for creating collection in ChromaDB:

client = chromadb.Client()
collection = client.create_collection(
  name="collection_name",
  metadata={"hnsw:space": "cosine"}
)

and this is for adding data to collection:

collection.add(
  documents=a['documents'],
  metadatas=b['metadatas'],
  ids=c['ids']
) 

Is there a way to speed up this process? I was expecting it to work faster or more efficiently.

Ro.oT
  • 623
  • 6
  • 15

1 Answers1

0

Found the answer: The thing slowing down was collection.add() which had to create embeddings.

If you have already created and stored embeddings, then just input them in the collection.add() along with documents, ids, metadata. In this way, the function doesn't have to create embeddings thus saving time.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83