Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cyborg.co/llms.txt

Use this file to discover all available pages before exploring further.

Adds new vectors to the index or updates existing ones. Supports both dictionary format and separate arrays for IDs and vectors.
# Option 1: Dictionary format
index.upsert(items)

# Option 2: Separate arrays  
index.upsert(ids, vectors)

Parameters

Option 1: Dictionary Format

ParameterTypeDefaultDescription
itemsList[Dict]-List of dictionaries containing vector data
Where each dictionary can contain:
[
  {
    "id": str, # Unique identifier for the vector
    "vector": List[float], # The vector data
    "contents": str, # Optional text content associated with the vector
    "metadata": Dict # Optional key-value pairs for filtering and retrieval
  },
  ...
]

Option 2: Separate Arrays

ParameterTypeDefaultDescription
idsList[str]-List of unique vector identifiers
vectorsList[List[float]] or np.ndarray-Vector data as 2D array

Returns

None

Example Usage

Dictionary Format

# Basic vector upsert
items = [
    {
        'id': 'doc1',
        'vector': [0.1, 0.2, 0.3, 0.4]
    },
    {
        'id': 'doc2', 
        'vector': [0.5, 0.6, 0.7, 0.8]
    }
]

index.upsert(items)

Separate Arrays

import numpy as np

# Using separate arrays
ids = ['vec1', 'vec2', 'vec3']
vectors = np.random.rand(3, 128).astype(np.float32)

index.upsert(ids, vectors)