Skip to documentation
Open Workflow Studio
On this page

Vector DB

Workflow reference | Cached product-search samples

Kind: VectorDb
Configuration object: vectorDb

Use the Vector DB toolbox category to index, upsert, search, read, delete, or clear a bounded local vector collection.

Inputs

input selects the operation data from current and named bindings:

Operation Input
Index Input for the nested embedding generator.
Upsert Record array, or { "records": [...], "space": "embedding-space-id" }.
Search Vector array, or { "vector": [...], "space": "...", "topK": 4, "where": {...} }.
Read No data required; incoming edges can establish ordering.
Delete Array of 1-1,000 unique record IDs.
Clear No data required; incoming edges can establish ordering.

Each record contains a nonblank, unique id of at most 128 characters, a finite nonzero numeric vector, and an object metadata. All stored vectors share the same dimensions.

An optional space identifier binds an index to its embedding model, endpoint, and dimension configuration. Search and Upsert must supply the same identifier whenever the collection has one. The product samples derive it from the actual Embed request.

Metadata filters apply before scoring and top-K selection. where accepts up to 16 exact scalar matches or numeric gte/lte bounds:

{"vector":[1,0],"where":{"category":"Lighting","priceUsd":{"gte":10,"lte":60}}}

Configuration

Property Default Usage
collection "sample-vectors" Shared collection name with 1-128 ASCII letters, digits, periods, hyphens, or underscores.
operation Index Index, Upsert, Search, Read, Delete, or Clear.
startFromScratch false Index and Upsert can replace the collection instead of reusing or merging it. Other operations require false.
input Input expression Typed operation input; remains a valid expression for all operations.
topK 5 Default Search result limit, 1-100. A query object's topK can override it.
generator Unset Index requires a nested workflow. Other operations leave it unset.

The Index generator returns records with optional embedding-space identity. A matching source/model fingerprint reuses the existing index. Changed source input, model endpoints, model identities, request settings, or run-variable values rebuild it. Index writes after successful generation.

Both app modes use the vectors table in BenchiusWorkflowData. Synthetic Data has a separate table and remains intact when vector records or a vector collection are removed.

Outputs

Index, Upsert, Read, and Delete return a collection containing version, fingerprint, dimensions, space, and records. Upsert and Delete invalidate the index fingerprint so later Index execution rebuilds altered records.

Search returns dimensions, totalRecords, matchingRecords, and matches. Each match contains id, score, and the original metadata. Cosine scores are clamped to -1 through 1. Ties use stable ordinal ID ordering. A filter that matches no records returns an empty array; searching an absent or empty collection fails explicitly.

Clear removes only its named collection and returns { "collection": "...", "cleared": true }.

Collections support up to 1,000 records, 4,096 dimensions, and 16 MiB of JSON, subject to smaller host budgets. Invalid counts, dimensions, nonfinite or zero vectors, duplicate IDs, mismatched spaces, malformed filters, and storage failures are explicit errors.

Example

This complete local workflow upserts two vectors, then searches the same collection. Run with [1,0]; it makes no model calls.

{
  "schemaVersion": 1,
  "id": "local-vector-search",
  "name": "Local vector search",
  "nodes": [
    {
      "id": "write-vectors",
      "kind": "VectorDb",
      "vectorDb": {
        "collection": "example-vectors",
        "operation": "Upsert",
        "input": {
          "function": "literal",
          "value": "[{\"id\":\"lamp\",\"vector\":[1,0],\"metadata\":{\"category\":\"Lighting\"}},{\"id\":\"bottle\",\"vector\":[0,1],\"metadata\":{\"category\":\"Accessories\"}}]"
        }
      }
    },
    {
      "id": "search-vectors",
      "kind": "VectorDb",
      "vectorDb": {
        "collection": "example-vectors",
        "operation": "Search",
        "topK": 1,
        "input": { "function": "input", "value": "query" }
      }
    }
  ],
  "edges": [
    {
      "source": "write-vectors",
      "target": "search-vectors",
      "inputName": "query",
      "transform": { "function": "literal", "value": "[1,0]" }
    }
  ]
}

The standalone node schema is:

{
  "id": "read-index",
  "name": "Read saved vectors",
  "kind": "VectorDb",
  "vectorDb": { "collection": "example-vectors", "operation": "Read" }
}

Custom hosts pass an IWorkflowDataStore to WorkflowRunner. Packaged hosts use WorkflowFileDataStore; configure Workflow:DataDirectory for writable storage and a persistent mount when needed.

An unhandled error has occurred. Reload 🗙