2023-09-29 16:17:48 +00:00
|
|
|
from application.vectorstore.faiss import FaissStore
|
|
|
|
from application.vectorstore.elasticsearch import ElasticsearchStore
|
2024-01-06 17:59:01 +00:00
|
|
|
from application.vectorstore.mongodb import MongoDBVectorStore
|
2023-09-29 16:17:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
class VectorCreator:
|
|
|
|
vectorstores = {
|
|
|
|
'faiss': FaissStore,
|
2024-01-06 17:59:01 +00:00
|
|
|
'elasticsearch':ElasticsearchStore,
|
|
|
|
'mongodb': MongoDBVectorStore,
|
2023-09-29 16:17:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def create_vectorstore(cls, type, *args, **kwargs):
|
|
|
|
vectorstore_class = cls.vectorstores.get(type.lower())
|
|
|
|
if not vectorstore_class:
|
|
|
|
raise ValueError(f"No vectorstore class found for type {type}")
|
|
|
|
return vectorstore_class(*args, **kwargs)
|