Skip to content

Instantly share code, notes, and snippets.

View cutecutecat's full-sized avatar

cutecutecat cutecutecat

  • Southern University of Science and Technology
  • Shanghai, China
View GitHub Profile
@cutecutecat
cutecutecat / citus_pgvectors.py
Last active September 5, 2024 14:07
Citus with pgvecto.rs
import numpy as np
from pgvecto_rs.psycopg import register_vector
import psycopg
# generate random data
rows = 100000
dimensions = 128
embeddings = np.random.rand(rows, dimensions)
categories = np.random.randint(100, size=rows).tolist()
queries = np.random.rand(10, dimensions)