Feat/vector db pgvector (#3879)

This commit is contained in:
LiuVaayne 2024-05-10 17:20:30 +08:00 committed by GitHub
commit 875249eb00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 316 additions and 9 deletions

View file

@ -0,0 +1,30 @@
from core.rag.datasource.vdb.pgvector.pgvector import PGVector, PGVectorConfig
from core.rag.models.document import Document
from tests.integration_tests.vdb.test_vector_store import (
AbstractVectorTest,
get_example_text,
setup_mock_redis,
)
class TestPGVector(AbstractVectorTest):
def __init__(self):
super().__init__()
self.vector = PGVector(
collection_name=self.collection_name,
config=PGVectorConfig(
host="localhost",
port=5433,
user="postgres",
password="difyai123456",
database="dify",
),
)
def search_by_full_text(self):
hits_by_full_text: list[Document] = self.vector.search_by_full_text(query=get_example_text())
assert len(hits_by_full_text) == 0
def test_pgvector(setup_mock_redis):
TestPGVector().run_all_tests()