Fix pgvector integration: VECTOR(512) for voyage-3-lite, register_vector on connect
- voyage-3-lite returns 512 dims (not 1024) — migrated column + schema - register_vector now called once at connection time, not per-query - Removes per-function register_vector calls that caused type cast conflicts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
-- PostgreSQL, bez pgvector (embeddingy jako double precision[])
|
||||
-- pg_trgm pro fuzzy matching (volitelné)
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
|
||||
-- ─── Conversation sessions ────────────────────────────────────────────────────
|
||||
@@ -56,7 +57,7 @@ CREATE TABLE IF NOT EXISTS kb_memories (
|
||||
-- search
|
||||
tags TEXT[] DEFAULT '{}',
|
||||
importance FLOAT DEFAULT 0.5, -- 0..1
|
||||
embedding double precision[], -- Voyage AI voyage-3-lite (1024-dim), Python-side similarity
|
||||
embedding vector(512), -- Voyage AI voyage-3-lite (512-dim)
|
||||
fts TSVECTOR,
|
||||
|
||||
-- lifecycle
|
||||
@@ -94,4 +95,5 @@ CREATE INDEX IF NOT EXISTS kb_memories_project_idx ON kb_memories(project);
|
||||
CREATE INDEX IF NOT EXISTS kb_memories_importance_idx ON kb_memories(importance DESC);
|
||||
CREATE INDEX IF NOT EXISTS kb_memories_created_idx ON kb_memories(created_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS kb_memories_session_idx ON kb_memories(session_id);
|
||||
-- Note: embedding je double precision[] — similarity se počítá Python-side po FTS pre-filtru
|
||||
-- Vector index (aktivovat po ~1k řádcích pro lepší recall)
|
||||
-- CREATE INDEX kb_memories_vec_idx ON kb_memories USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
|
||||
|
||||
Reference in New Issue
Block a user