Documentation Index
Fetch the complete documentation index at: https://docs.vectoraidb.actian.com/llms.txt
Use this file to discover all available pages before exploring further.
Update existing points by providing a new vector and optionally new payload data. The upsert operation replaces the point components you provide.
Update a single point
The update operation replaces the vector and optionally the payload. When updating a point, you must provide the vector, but payload is optional.
To update only specific payload fields, first retrieve the existing point, modify the payload, then upsert it back.
import random
from actian_vectorai import VectorAIClient, PointStruct
DIMENSION = 128
COLLECTION = "products"
# Connect to VectorAI DB server
with VectorAIClient("localhost:6574") as client:
# Generate new vector
updated_vector = [random.gauss(0, 1) for _ in range(DIMENSION)]
# Update point with new data
point = PointStruct(
id=1, # Point ID to update
vector=updated_vector, # New vector embedding
payload={ # New metadata (optional)
"name": "Gaming Laptop",
"category": "electronics",
"price": 1499.99,
"updated": True
}
)
# Upsert updated point
client.points.upsert(COLLECTION, [point])
print("Point updated successfully")
Update multiple points
The same replacement rules from single-point updates apply here. You must provide the vector, and payload is optional. Partial payload updates are not supported.
import random
from actian_vectorai import VectorAIClient, PointStruct
DIMENSION = 128
COLLECTION = "products"
# Connect to VectorAI DB server
with VectorAIClient("localhost:6574") as client:
# Prepare update data
updates = [
{"id": 2, "name": "5G Smartphone", "category": "electronics", "price": 899.99, "updated": True},
{"id": 3, "name": "Pro Tablet", "category": "electronics", "price": 799.99, "updated": True},
{"id": 4, "name": "Premium T-Shirt", "category": "clothing", "price": 49.99, "updated": True}
]
# Create points with new data
points = [
PointStruct(
id=item["id"], # Point ID to update
vector=[random.gauss(0, 1) for _ in range(DIMENSION)], # New vector
payload={k: v for k, v in item.items() if k != "id"} # Extract payload fields (optional)
)
for item in updates
]
# Batch update all points
client.points.upsert(COLLECTION, points)
print(f"Updated {len(points)} points")