* refactor(memory): rename package second-brain to memory * refactor(memory): use OpenAI env naming and fix trailing slash * feat(memory): add chunking with env-configurable size and overlap * feat(memory): dedup search results by source in top-K * test(memory): add chunking, batching, dedup, live tests * docs(memory): update README and project map after rename * docs(handoff): add handoff and ADR-032 for memory refactor * docs(handoff): set PR number * fix(ci): reduce index.py complexity to rank A --------- Co-authored-by: opencode-agent <agent@opencode.local>
21 lines
581 B
Python
21 lines
581 B
Python
import os
|
|
|
|
import pytest
|
|
|
|
os.environ.setdefault("OPENAI_BASE_URL", "http://test/v1")
|
|
|
|
from src.memory.embedder import embed_texts
|
|
|
|
|
|
@pytest.mark.skipif(not os.environ.get("RUN_LIVE"), reason="needs RUN_LIVE=1")
|
|
def test_live_embed_single() -> None:
|
|
r = embed_texts(["hello world"])
|
|
assert len(r) == 1
|
|
assert len(r[0]) > 100
|
|
|
|
|
|
@pytest.mark.skipif(not os.environ.get("RUN_LIVE"), reason="needs RUN_LIVE=1")
|
|
def test_live_embed_batch() -> None:
|
|
r = embed_texts(["text one", "text two", "text three"])
|
|
assert len(r) == 3
|
|
assert all(len(emb) > 100 for emb in r)
|