Difference between Chroma.afrom_texts and Chroma.from_texts

1.4k views Asked by At

I am working with langchain and ChromaDB in python and I see that I have two options when creating the vectorestore:

db = Chroma.afrom_texts(docs, embedding_function)

This first one returns: db = <coroutine object VectorStore.afrom_texts at 0x00000258DCDDF680>

db = Chroma.from_texts(docs, embedding_function)

And the second one: db= <langchain.vectorstores.chroma.Chroma at 0x258dcf80b20>

I guess the second one is the normal one, but has anyone used the first one? Anyone knows what is that <coroutine object VectorStore.afrom_texts at 0x00000258DCDDF680>.

Besides. Is there a way to visualize the vectors, the numbers. I would like to explore a little bit. Thank you in advanced!

Just a learning question

1

There are 1 answers

1
Marcin Orlowski On

Chroma.from_texts() returns an instance of the Chroma class and is synchronous (and can be called as any other method in your code), while Chroma.afrom_texts() returns a coroutine which means is asynchronous and needs to be awaited for as it runs "in the background":

db = await Chroma.afrom_texts()