RAG (Retrieval Augmented Generation) Implementation
✅ Status: FULLY OPERATIONAL
As of November 7, 2025, RAG is completely working in OpenRegister. All major issues have been resolved.
Overview
RAG (Retrieval Augmented Generation) enables AI agents to answer questions using your data instead of only relying on their training data. When a user asks a question, OpenRegister:
- Vectorizes the question using an embedding model
- Searches for semantically similar content in vectors (objects & files)
- Retrieves the most relevant context
- Augments the AI's prompt with this context
- Generates an accurate, cited answer
Architecture
How It Works Step-by-Step
1. Vectorization (Data Ingestion)
Objects and files are converted to vectors when:
- They are created or updated (if enabled)
- Bulk vectorization is triggered manually
- Background job processes pending vectorization
Object Vectorization
// ObjectVectorizationStrategy extracts text
$object = [
'test' => 'mokum',
'Beschrijving' => 'Mokum is de kleur blauw',
'@self' => [
'id' => 'e88a328a-c7f1-416a-b4ba-e6d083bc080e',
'register' => 104,
'schema' => 306,
]
];
// Serialized as text for embedding
$text = "test: mokum\nBeschrijving: Mokum is de kleur blauw";
// Generate embedding (1536-dimensional vector for OpenAI)
$embedding = $vectorService->generateEmbedding($text);
// Store in oc_openregister_vectors
$vectorService->storeVector(
entityType: 'object',
entityId: '123',
embedding: $embedding,
model: 'text-embedding-3-small',
dimensions: 1536,
chunkText: $text,
metadata: [
'object_title' => 'mokum', // Extracted from custom fields
'uuid' => 'e88a328a...',
'register' => 104,
'schema' => 306,
]
);