Skip to content
المشاريع

حول

Embeddable library or single binary for indexing and searching 1B vectors

أدوات التطوير

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
٠
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

CoreNN

Database for querying billions of vectors and embeddings in sublinear time on commodity machines.

Read the accompanying blog post for details and an accessible deep dive and in-depth technical report.

Getting started

Rust

fn main() {
  let db = CoreNN::create("/path/to/db", Cfg {
    // Specify the dimensionality of your vectors.
    dim: 3,
    // All other config options are optional.
    ...Default::default()
  });
  let key = "my_entry".to_string();
  let vec: Vec<f32> = vec![0.3, 0.6, 0.9];
  db.insert(&key, &vec);
  // For per-vector quantized int8: `db.insert_qi8(&key, &qvec_i8, scale, zero_point)`.

  // Later...
  let db = CoreNN::open("/path/to/db");
  let query: Vec<f32> = vec![1.0, 1.3, 1.7];
  // Returns Vec of (key, distance) pairs.
  let k100 = db.query(&query, 100);
  assert_eq!(k100[0].0.as_str(), "my_entry");
}

Python

from corenn_py import CoreNN

db = CoreNN.create("/path/to/db", {
  # Specify the dimensionality of your vectors.
  "dim": 3,
  # All other config options are optional.
})
keys = [
  "my_entry_1",
  "my_entry_2",
]
vectors = np.array([
  [0.3, 0.6, 0.9],
  [0.4, 1.1, 0.0],
])
# Or insert_bf16, insert_f16
# Or insert_i8 (per-vector quantized int8 + scale/zero_point arrays)
db.insert_f32(keys, vectors)

# Later...
db = CoreNN.open("/path/to/db")
queries = np.array([
  [1.0, 1.3, 1.7],
  [7.3, 2.5, 0.0],
])
# Returns a list of (key, distance) tuples
# for each query vector
# (so returns a list of lists).
k100 = db.query_f32(queries, 100)

Node.js

import { CoreNN } from "@corenn/node";

const db = CoreNN.create("/path/to/db", {
  // Specify the dimensionality of your vectors.
  dim: 3,
  // All other config options are optional.
});
db.insert([
  {
    key: "my_entry_1",
    vector: new Float32Array([0.5, 4.1, 2.2]),
    // Or per-vector quantized int8:
    // vector: { data: new Int8Array([..]), scale: 0.01, zeroPoint: 0 },
  },
  {
    key: "my_entry_2",
    vector: new Float32Array([3.1, 7.7, 6.4]),
  },
]);

// Later...
const db = CoreNN.open("/path/to/db");
// Array of { key, distance } objects.
const results = db.query(
  new Float32Array([0.0, 1.1, 2.2]),
  100,
);

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…