Setter for the embeddings
property of VectorStore
#31353
tibor-mach
announced in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
The current implementations of vector databases override the
embeddings
property oflangchain_core.vectorstores.VectorStore
base class and use different names for the underlying object (the embedding function)For example in Chroma this is called
_embedding_function
and in Milvus the same object is calledembedding_func
(not even private, so presumably users are expected to be able to rewrite it?).This makes it difficult to work with these objects on a high level and swap one for another. One way to solve this would be to enforce the same name everywhere but a better solution is probably to add setters to these classes since it also allows users to set the
Embeddings
object later on, once theVectorStore
object has already been initialised.Motivation
It comes up when we are writing boilerplate code applied in different circumstances. Ideally, I would like to be able to write a class which instantiates a vector store based on given parameters independently of any specific embedding function (which I would like to set up later). and I would like to do it in a generic way without having to worry about the different names of the
langchain_core.embeddings.Embeddings
class object used by the vector store.Proposal (If applicable)
I think that all that is needed is to add a setter to the
embeddings
property in each of the VectorStore implementations. For example in Chroma it looks like this and in this is the implementation in Milvus (where it is calledembedding_func
rather than_embedding_function
).The example below is for
Chroma
:An alternative solution would be to allow users to use the Embeddings object as a callback in all VectorStore methods where it is used. I would actually prefer this as it fits my usecase better but it would be probably more work to do this.
Beta Was this translation helpful? Give feedback.
All reactions