From 32d1e50a6f2a771032fd42512780c7acfb490ca3 Mon Sep 17 00:00:00 2001 From: Bill Murdock Date: Thu, 13 Feb 2025 18:44:55 -0500 Subject: [PATCH] test: Add qdrant to provider tests (#1039) # What does this PR do? This is a follow on to #1022 . It includes the changes I needed to be able to test the Qdrant support as requested by @terrytangyuan . I uncovered a lot of bigger, more systemic issues with the vector DB testing and I will open a new issue for those. For now, I am just delivering the work I already did on that. ## Test Plan As discussed on #1022: ``` podman pull qdrant/qdrant mkdir qdrant-data podman run -p 6333:6333 -v $(pwd)/qdrant-data:/qdrant/storage qdrant/qdrant ``` ``` ollama pull all-minilm:l6-v2 curl http://localhost:11434/api/embeddings -d '{"model": "all-minilm", "prompt": "Hello world"}' ``` ``` EMBEDDING_DIMENSION=384 QDRANT_URL=http://localhost pytest llama_stack/providers/tests/vector_io/test_vector_io.py -m "qdrant" -v -s --tb=short --embedding-model all-minilm:latest --disable-warnings ``` These show 3 tests passing and 15 deselected which is presumably working as intended. --------- Signed-off-by: Bill Murdock --- .../providers/tests/vector_io/conftest.py | 2 +- .../providers/tests/vector_io/fixtures.py | 28 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/llama_stack/providers/tests/vector_io/conftest.py b/llama_stack/providers/tests/vector_io/conftest.py index 3da64ff2e..1f9799100 100644 --- a/llama_stack/providers/tests/vector_io/conftest.py +++ b/llama_stack/providers/tests/vector_io/conftest.py @@ -57,7 +57,7 @@ DEFAULT_PROVIDER_COMBINATIONS = [ ), pytest.param( { - "inference": "bedrock", + "inference": "ollama", "vector_io": "qdrant", }, id="qdrant", diff --git a/llama_stack/providers/tests/vector_io/fixtures.py b/llama_stack/providers/tests/vector_io/fixtures.py index 30a2679d7..beb9b4ebd 100644 --- a/llama_stack/providers/tests/vector_io/fixtures.py +++ b/llama_stack/providers/tests/vector_io/fixtures.py @@ -17,6 +17,7 @@ from llama_stack.providers.inline.vector_io.faiss import FaissVectorIOConfig from llama_stack.providers.inline.vector_io.sqlite_vec import SQLiteVectorIOConfig from llama_stack.providers.remote.vector_io.chroma import ChromaVectorIOConfig from llama_stack.providers.remote.vector_io.pgvector import PGVectorVectorIOConfig +from llama_stack.providers.remote.vector_io.qdrant import QdrantConfig from llama_stack.providers.remote.vector_io.weaviate import WeaviateVectorIOConfig from llama_stack.providers.tests.resolver import construct_stack_for_test from llama_stack.providers.utils.kvstore.config import SqliteKVStoreConfig @@ -127,13 +128,26 @@ def vector_io_chroma() -> ProviderFixture: ) -VECTOR_IO_FIXTURES = [ - "faiss", - "pgvector", - "weaviate", - "chroma", - "sqlite_vec", -] +@pytest.fixture(scope="session") +def vector_io_qdrant() -> ProviderFixture: + url = os.getenv("QDRANT_URL") + if url: + config = QdrantConfig(url=url) + provider_type = "remote::qdrant" + else: + raise ValueError("QDRANT_URL must be set") + return ProviderFixture( + providers=[ + Provider( + provider_id="qdrant", + provider_type=provider_type, + config=config.model_dump(), + ) + ] + ) + + +VECTOR_IO_FIXTURES = ["faiss", "pgvector", "weaviate", "chroma", "qdrant", "sqlite_vec"] @pytest_asyncio.fixture(scope="session")