Skip to content

Commit

Permalink
Refactor vector_factory.py to use pgvector as the default vector store
Browse files Browse the repository at this point in the history
  • Loading branch information
vaayne committed Apr 27, 2024
1 parent 93e225c commit b378adf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/core/rag/datasource/vdb/vector_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ def _init_vector(self) -> BaseVector:
else:
dataset_id = self._dataset.id
collection_name = Dataset.gen_collection_name_by_id(dataset_id)
index_struct_dict = {"type": "relyt", "vector_store": {"class_prefix": collection_name}}
index_struct_dict = {
"type": "pgvector",
"vector_store": {"class_prefix": collection_name}}
self._dataset.index_struct = json.dumps(index_struct_dict)
dim = len(self._embeddings.embed_query("hello relyt"))
return PGVector(
collection_name=collection_name,
config=PGVectorConfig(
Expand All @@ -158,7 +159,6 @@ def _init_vector(self) -> BaseVector:
password=config.get("PGVECTOR_PASSWORD"),
database=config.get("PGVECTOR_DATABASE"),
),
dimension=dim,
)
else:
raise ValueError(f"Vector store {config.get('VECTOR_STORE')} is not supported.")
Expand Down

0 comments on commit b378adf

Please sign in to comment.