"""Shared test fakes (no network, deterministic).""" from __future__ import annotations from app.config import Settings class FakeEmbedder: """Duck-typed stand-in for :class:`app.rag.llm.LLMClient` (see the ``Embedder`` protocol in :mod:`app.rag.importer`). Returns deterministic vectors of *dim* dimensions; records every call so tests can assert batching behaviour. """ def __init__(self, dim: int = 768) -> None: self.dim = dim self.settings = Settings(_env_file=None) # pyright: ignore[reportCallIssue] self.embed_batches = 0 self.calls: list[list[str]] = [] async def embed(self, texts: list[str]) -> list[list[float]]: self.calls.append(list(texts)) self.embed_batches += 1 return [[0.01 * (i % 97) for i in range(self.dim)] for _ in texts]