diff --git a/src/ogx/providers/utils/memory/openai_vector_store_mixin.py b/src/ogx/providers/utils/memory/openai_vector_store_mixin.py index e68130a339..f6d10c5307 100644 --- a/src/ogx/providers/utils/memory/openai_vector_store_mixin.py +++ b/src/ogx/providers/utils/memory/openai_vector_store_mixin.py @@ -1121,14 +1121,8 @@ async def openai_search_vector_store( ) except Exception as e: - # Log the error and return empty results - logger.error("Error searching vector store", vector_store_id=vector_store_id, error=str(e)) - return VectorStoreSearchResponsePage( - search_query=request.query if isinstance(request.query, list) else [request.query], - data=[], - has_more=False, - next_page=None, - ) + logger.error("Failed to search vector store", vector_store_id=vector_store_id, error=str(e)) + raise def _build_reranker_params( self, diff --git a/tests/integration/vector_io/test_openai_vector_stores.py b/tests/integration/vector_io/test_openai_vector_stores.py index ec7d5071e0..a13489080a 100644 --- a/tests/integration/vector_io/test_openai_vector_stores.py +++ b/tests/integration/vector_io/test_openai_vector_stores.py @@ -3585,7 +3585,7 @@ def test_openai_vector_store_with_chunks( filtered_search = compat_client.vector_stores.search( vector_store_id=vector_store.id, query="artificial intelligence", - filters={"topic": "ai"}, + filters={"type": "eq", "key": "topic", "value": "ai"}, max_num_results=5, ) diff --git a/tests/unit/providers/vector_io/test_vector_io_stores_config.py b/tests/unit/providers/vector_io/test_vector_io_stores_config.py index c39b24840d..b09ddd1298 100644 --- a/tests/unit/providers/vector_io/test_vector_io_stores_config.py +++ b/tests/unit/providers/vector_io/test_vector_io_stores_config.py @@ -213,6 +213,32 @@ async def mock_query_chunks(*args, **kwargs): assert result.search_query == ["test query"] # Original query preserved +async def test_search_vector_store_propagates_backend_errors(vector_io_adapter): + """Test that exceptions from the vector store backend propagate to the caller.""" + vector_store_id = "test_store_error" + vector_io_adapter.openai_vector_stores[vector_store_id] = { + "id": vector_store_id, + "name": "Test Store", + "description": "", + "vector_store_id": "test_db", + "embedding_model": "test/embedding", + } + + async def mock_query_chunks(*args, **kwargs): + raise KeyError("chunk_content") + + vector_io_adapter.query_chunks = mock_query_chunks + + from ogx_api import OpenAISearchVectorStoreRequest + + request = OpenAISearchVectorStoreRequest(query="test query", max_num_results=5) + with pytest.raises(KeyError, match="chunk_content"): + await vector_io_adapter.openai_search_vector_store( + vector_store_id=vector_store_id, + request=request, + ) + + async def test_create_gin_index_executes_correct_sql(): from ogx.providers.remote.vector_io.pgvector.config import PGVectorHNSWVectorIndex from ogx.providers.remote.vector_io.pgvector.pgvector import PGVectorIndex