Cortex

Core Concepts

Understand the architecture and key abstractions

VectorDB

VectorDB is the central service. It defines high-level operations for vector lifecycle management.

MethodDescription
upsertInsert or update a single document
upsertManyBulk upsert documents
searchNearest-neighbour search with filters
getByIdFetch by ID (fails with DocumentNotFound)
deleteRemove entry by ID
pruneExpiredClean up documents past their expires_at

CollectionSchema

The schema for documents stored in the database:

{
  id: DocumentId,           // Branded string
  content: string,          // Primary text content
  category: string,         // Indexable category
  tags: string[],           // Indexable tags
  metadata_json: string,    // Arbitrary JSON string
  created_at: Date,
  expires_at: Date
}

QueryFilter

Filters applied during search, list, or deleteWhere:

FieldTypeDescription
categorystringMatch by category
tagsstring[]Match if any tag is present
activeAtDateOnly include docs expiring after this date

Error Types

  • VectorDBError - General storage failure
  • DocumentNotFound - Entry not found by ID
  • DimensionMismatch - Vector length doesn't match DB config

On this page