Replies: 1 comment 1 reply
-
@pprados, @baskaryan and I are working through the base abstractions right now for search and indexing. We want the implementation of the vectorstore to expose a more standardized filtering interface as part of its API. This should make it unnecessary to have a mapping between vectorstores and translators. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
The current implementation of
SelfQueryRetriever
relies on a list ofTranslator
s built in the function_get_builtin_translator()
. This function depends on all knownVectorStores
and returns the corresponding translator.The current implementation has maintainability and scalability issues. Indeed, when adding a new vector store, it is necessary to intervene in
langchain-community
andlangchain
to publish a new version. This is not aligned with the goal of modularizing into several components (See PR Fix SelfQuery with PGVector).Another difficulty is that
SelfQueryRetriever
is present inlangchain
, but relies on Translators present inlangchain-community
.We propose a new approach. Instead of having a mapping between
VectorStore
andTranslator
initialized by_get_builtin_translator()
, we believe it is more pertinent to use a global dictionary where the different implementations can register theirTranslator
s themselves.Thus, the code can be reorganized as follows:
GLOBAL_BUILTIN_TRANSLATORS
is proposedself_query/base.py
providesdef register_translator(vectorstore_cls: Type[VectorStore], translator_cls: Type[Visitor]) -> None
(or registers a lambda with kwargs, to handle cases like
QdrantTranslator(metadata_key=vectorstore.metadata_payload_key)
)SelfQueryRetriever
migrates tolangchain-core
orlangchain-community
VectorStore
has a mechanism to register its TranslatorThe different
Translator
s will be migrated to the respective projects withinlangchain-community
or others, likelangchain-postgres
for example. Thus, the differentTranslator
s are only registered if a code imports the correspondingVectorStore
.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions