From 232661a4ac988761cfbc05c0169d619f2d61d0d0 Mon Sep 17 00:00:00 2001 From: csunny Date: Sun, 8 Oct 2023 18:47:49 +0800 Subject: [PATCH] feat: auto register for vectorstores --- pilot/vector_store/connector.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pilot/vector_store/connector.py b/pilot/vector_store/connector.py index 7ff563415..efc248aba 100644 --- a/pilot/vector_store/connector.py +++ b/pilot/vector_store/connector.py @@ -1,8 +1,7 @@ -from pilot.vector_store.chroma_store import ChromaStore from pilot import vector_store from pilot.vector_store.base import VectorStoreBase -connector = {"Chroma": ChromaStore} +connector = {} class VectorStoreConnector: """VectorStoreConnector, can connect different vector db provided load document api_v1 and similar search api_v1. @@ -22,7 +21,8 @@ class VectorStoreConnector: self.connector_class = connector.get(vector_store_type) else: raise Exception(f"Vector Type Not support. {0}", vector_store_type) - + + print(self.connector_class) self.client = self.connector_class(ctx) @@ -55,4 +55,5 @@ class VectorStoreConnector: def _register(self): for cls in vector_store.__all__: if issubclass(getattr(vector_store, cls), VectorStoreBase): - connector.update({cls, getattr(vector_store, cls)}) \ No newline at end of file + _k, _v = cls, getattr(vector_store, cls) + connector.update({_k: _v}) \ No newline at end of file