from upstash_vector import Index, Vector
import random
index = Index.from_env()
dimension = 128
upsert_amount = 100
vectors = [
Vector(
id=f"generated-id-{i}",
vector=[random.random() for _ in range(dimension)],
metadata={"some_field": f"some_value-{i}"}
) for i in range(upsert_amount)
]
index.upsert(vectors=vectors)
from upstash_vector import Index
import random
index = Index.from_env()
dimension = 128
upsert_amount = 100
vectors = [
(f"generated-id-{i}", [random.random() for _ in range(dimension)], {"some_field": f"some_value-{i}"})
for i in range(upsert_amount)
]
index.upsert(vectors=vectors)
from upstash_vector import Index
import random
index = Index.from_env()
dimension = 128
upsert_amount = 100
vectors = [
{"id": f"generated-id-{i}", "vector": [random.random() for _ in range(dimension)], "metadata": {"some_field": f"some_value-{i}"}}
for i in range(upsert_amount)
]
index.upsert(vectors=vectors)