haiku.rag/tests/multi_db/conftest.py
Yiorgis Gozadinos afdef92b5b
Finish the comment pass, and escape document fields everywhere Rich renders
`_rich_print_document` escapes uri, title and metadata, the sibling of
the escaped search-result renderer. The remaining comments and
docstrings that narrated rejected alternatives, consequences or history
now state the current invariant. The Sandbox class docstring names the
held connection close() releases, and wrapped docs paragraphs join to
one line.
2026-08-28 15:34:47 +03:00

28 lines
804 B
Python

from pathlib import Path
import pytest
from haiku.rag.config import get_config
@pytest.fixture(scope="module")
def vcr_cassette_dir(request):
"""Cassettes sit with the rest, under `tests/cassettes/multi_db/`."""
module = request.module.__name__.rsplit(".", 1)[-1]
return str(Path(__file__).parent.parent / "cassettes" / "multi_db" / module)
@pytest.fixture
def query_embedding(monkeypatch):
"""Vector search with no embedder behind it, recording the queries
embedded."""
from haiku.rag.embeddings import EmbedderWrapper
embedded: list[str] = []
async def embed_query(self, text):
embedded.append(text)
return [0.1] * get_config().embeddings.model.vector_dim
monkeypatch.setattr(EmbedderWrapper, "embed_query", embed_query)
return embedded