Cortex

API Reference

Services

Core Effect services provided by Cortex for vector storage, semantic retrieval, and document lifecycle management.

VectorDB

The VectorDB service is the primary abstraction for interacting with vector collections. It provides a type-safe, Effect-native interface for CRUD operations and semantic search.

Methods

  • upsert

    Inserts or updates a single document.

    ParameterType
    payloadUpsertPayload
    ReturnsEffect< CollectionSchema, VectorDBError | DimensionMismatch >
  • upsertMany

    Bulk upsert multiple documents efficiently.

    ParameterType
    payloadsReadonlyArray< UpsertPayload >
    ReturnsEffect< ReadonlyArray< CollectionSchema >, VectorDBError | DimensionMismatch >
  • Semantic similarity search using vector distance. Results are ordered by score descending.

    ParameterType
    queryVectorVector
    limitnumber
    filterQueryFilter (optional)
    ReturnsEffect< ReadonlyArray< SearchResult >, VectorDBError | DimensionMismatch >
  • getById

    Retrieves a document by its ID. Fails with DocumentNotFound if the ID does not exist.

    ParameterType
    idDocumentId
    ReturnsEffect< CollectionSchema, VectorDBError | DocumentNotFound >
  • findById

    Retrieves a document by its ID. Returns an Option instead of failing if the ID is missing.

    ParameterType
    idDocumentId
    ReturnsEffect< Option< CollectionSchema >, VectorDBError >
  • delete

    Deletes a document by ID. Fails with DocumentNotFound if the ID does not exist.

    ParameterType
    idDocumentId
    ReturnsEffect< void, VectorDBError | DocumentNotFound >
  • deleteWhere

    Deletes multiple documents matching a filter.

    ParameterType
    filterQueryFilter
    ReturnsEffect< number, VectorDBError > (count of deleted docs)
  • list

    Retrieves a list of documents matching an optional filter and pagination settings.

    ParameterType
    filterQueryFilter (optional)
    paginationPagination (optional)
    ReturnsEffect< ReadonlyArray< CollectionSchema >, VectorDBError >
  • count

    Returns the number of documents matching an optional filter.

    ParameterType
    filterQueryFilter (optional)
    ReturnsEffect< number, VectorDBError >
  • pruneExpired

    Removes all documents where expires_at is less than or equal to the provided date.

    ParameterType
    asOfDate
    ReturnsEffect< number, VectorDBError > (count of deleted docs)

On this page