Files
lore-engine-poc/tests/conftest.py
Hermes add264eb04 T2: pgvector image embeddings — plugin, schema, seed, hook, tests
- docker-compose: swap postgres image to pgvector/pgvector:pg16
- postgres/init.sql: CREATE EXTENSION vector; image_embedding table
- plugins/embeddings.py: embed_images + search_images_semantic
  (sentence-transformers all-MiniLM-L6-v2, lazy-loaded, pgvector <=> cosine)
- plugins/images.py: register_image kicks off background embed worker
- seed.py: seed_embeddings writes 4 embeddings for the mock images
- README: semantic image search section + T3 note
- 11 tests across 4 files, all green:
    test_embeddings_plugin.py (4): schema, ordering, idempotency, stub
    test_embeddings_real_model.py (3): real MiniLM, acceptance queries
    test_register_image_hook.py (2): manifest row, end-to-end hook
    test_seed_embeddings.py (2): writes 4, idempotent
- Includes T3 consistency plugin skeleton (4 stub tools)
2026-06-16 14:30:10 +00:00

22 lines
815 B
Python

"""
conftest.py — test setup for the lore-engine-poc.
The plugin files do `from server import REGISTRY, get_postgres, ...` — so we
need `gateway/` on sys.path before importing any plugin module. We also
need `plugins/` on sys.path so `from plugins.embeddings import ...` works.
"""
import os
import sys
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
GATEWAY = os.path.join(ROOT, "gateway")
PLUGINS = os.path.join(ROOT, "plugins")
# Order matters: server first (so the `server` module is importable), then
# plugins (so `plugins.embeddings` resolves). The gateway package itself
# inserts itself at index 0 in server.py — we just need to make sure
# `server` is importable by the time plugins load.
for p in (GATEWAY, PLUGINS):
if p not in sys.path:
sys.path.insert(0, p)