import pytest


# Fake embed_fn — returns deterministic vectors based on text content.
# Used in all tests that need an embed_fn without hitting an API.
async def fake_embed_fn(texts: list[str]) -> list[list[float]]:
    # Returns a 4-dim vector where each component is based on character ordinals.
    # Same text always produces the same vector.
    def to_vec(text: str) -> list[float]:
        base = [float(ord(c)) for c in text[:4].ljust(4)]
        norm = sum(x**2 for x in base) ** 0.5 or 1.0
        return [x / norm for x in base]

    return [to_vec(t) for t in texts]


DB_URL = "postgresql+asyncpg://postgres:postgres@localhost/dot_search_test"
