Add full monorepo: virtual-banker, backend, frontend, docs, scripts, deployment
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
21
database/migrations/004_vector_extension.up.sql
Normal file
21
database/migrations/004_vector_extension.up.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Enable pgvector extension for RAG functionality
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
|
||||
-- Create knowledge_base table for RAG
|
||||
CREATE TABLE IF NOT EXISTS knowledge_base (
|
||||
id VARCHAR(255) PRIMARY KEY,
|
||||
tenant_id VARCHAR(255) NOT NULL,
|
||||
title VARCHAR(500),
|
||||
content TEXT NOT NULL,
|
||||
embedding vector(1536), -- OpenAI ada-002 dimension, adjust as needed
|
||||
metadata JSONB,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
INDEX idx_tenant (tenant_id)
|
||||
);
|
||||
|
||||
-- Create index for vector similarity search
|
||||
CREATE INDEX IF NOT EXISTS idx_knowledge_embedding ON knowledge_base
|
||||
USING ivfflat (embedding vector_cosine_ops)
|
||||
WITH (lists = 100);
|
||||
|
||||
Reference in New Issue
Block a user