fix: use docker qdrant for tests
This commit is contained in:
parent
f58a8edac6
commit
5472975557
3 changed files with 27 additions and 6 deletions
19
.github/workflows/vector_db_tests.yml
vendored
19
.github/workflows/vector_db_tests.yml
vendored
|
|
@ -135,6 +135,21 @@ jobs:
|
|||
run:
|
||||
shell: bash
|
||||
|
||||
services:
|
||||
qdrant:
|
||||
image: qdrant/qdrant:1.14.1
|
||||
env:
|
||||
QDRANT__LOG_LEVEL: ERROR
|
||||
QDRANT__SERVICE__API_KEY: qdrant_api_key
|
||||
QDRANT__SERVICE__ENABLE_TLS: 0
|
||||
options: >-
|
||||
--health-cmd "curl 127.0.0.1:6333 || exit 1"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 6333:6333
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@master
|
||||
|
|
@ -159,8 +174,8 @@ jobs:
|
|||
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||
VECTOR_DB_URL: ${{ secrets.QDRANT_API_URL }}
|
||||
VECTOR_DB_KEY: ${{ secrets.QDRANT_API_KEY }}
|
||||
VECTOR_DB_URL: 127.0.0.1
|
||||
VECTOR_DB_KEY: qdrant_api_key
|
||||
run: poetry run python ./cognee/tests/test_qdrant.py
|
||||
|
||||
run-postgres-tests:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
from typing import Dict, List, Optional
|
||||
from qdrant_client import AsyncQdrantClient, models
|
||||
|
||||
|
|
@ -147,14 +148,15 @@ class QDrantAdapter(VectorDBInterface):
|
|||
|
||||
Returns:
|
||||
--------
|
||||
|
||||
- AsyncQdrantClient: An instance of AsyncQdrantClient configured for database
|
||||
operations.
|
||||
"""
|
||||
is_prod = os.getenv("ENV").lower() == "prod"
|
||||
|
||||
if self.qdrant_path is not None:
|
||||
return AsyncQdrantClient(path=self.qdrant_path, port=6333)
|
||||
return AsyncQdrantClient(path=self.qdrant_path, port=6333, https=is_prod)
|
||||
elif self.url is not None:
|
||||
return AsyncQdrantClient(url=self.url, api_key=self.api_key, port=6333)
|
||||
return AsyncQdrantClient(url=self.url, api_key=self.api_key, port=6333, https=is_prod)
|
||||
|
||||
return AsyncQdrantClient(location=":memory:")
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,11 @@ async def main():
|
|||
from cognee.infrastructure.databases.vector import get_vector_engine
|
||||
|
||||
vector_engine = get_vector_engine()
|
||||
random_node = (await vector_engine.search("Entity_name", "Quantum computer"))[0]
|
||||
search_results = await vector_engine.search("Entity_name", "Quantum computer")
|
||||
|
||||
assert len(search_results) != 0, "The search results list is empty."
|
||||
|
||||
random_node = search_results[0]
|
||||
random_node_name = random_node.payload["text"]
|
||||
|
||||
search_results = await cognee.search(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue