🚧 WIP 🚧 Vector database plugin for Postgres, written in Rust, specifically designed for LLM.

Overview

pgvecto.rs

discord invitation link trackgit-views all-contributors

pgvecto.rs is a Postgres extension that provides vector similarity search functions. It is written in Rust and based on pgrx.

Features

  • cosine_distance: cosine distance
  • dot_product_distance: dot product distance
  • square_euclidean_distance: square Euclidean distance

Build from source

cargo install cargo-pgrx
cargo pgrx init
cargo pgrx run

Getting Started

-- install the extension
DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;
-- check the extension related functions
\df+

-- call the distance function through operators

-- square Euclidean distance
SELECT array[1, 2, 3] <-> array[3, 2, 1];
-- dot product distance
SELECT array[1, 2, 3] <#> array[3, 2, 1];
-- cosine distance
SELECT array[1, 2, 3] <=> array[3, 2, 1];

-- create table
CREATE TABLE items (id bigserial PRIMARY KEY, emb numeric[]);
-- insert values
INSERT INTO items (emb) VALUES (ARRAY[1,2,3]), (ARRAY[4,5,6]);
-- query the similar embeddings
SELECT * FROM items ORDER BY emb <-> ARRAY[3,2,1] LIMIT 5;
-- query the neighbors within a certain distance
SELECT * FROM items WHERE emb <-> ARRAY[3,2,1] < 5;

Roadmap

See the open issues

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Ce Gao
Ce Gao

πŸ’Ό πŸ–‹ πŸ“–
Keming
Keming

πŸ› πŸ’» πŸ“– πŸ€” πŸš‡
Jinjing Zhou
Jinjing Zhou

🎨 πŸ€” πŸ“†
Alex Chi
Alex Chi

πŸ’»
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

Acknowledgements

Thanks to the following projects:

  • pgrx - Postgres extension framework in Rust
  • pgvector - Postgres extension for vector similarity search written in C
You might also like...
A tiny embedding database in pure Rust.

tinyvector - a tiny embedding database in pure Rust ✨ Features Tiny: It's in the name. It's literally just an axum server. Extremely easy to customize

A plugin for Jupyter Notebooks that shows you its energy use.

Jupyter Energy Jupyter Notebooks are a data science tool mostly used for statistics and machine learning, some of the most energy-intensive computing

Msgpack serialization/deserialization library for Python, written in Rust using PyO3, and rust-msgpack. Reboot of orjson. msgpack.org[Python]

ormsgpack ormsgpack is a fast msgpack library for Python. It is a fork/reboot of orjson It serializes faster than msgpack-python and deserializes a bi

Fwumious Wabbit, fast on-line machine learning toolkit written in Rust
Fwumious Wabbit, fast on-line machine learning toolkit written in Rust

Fwumious Wabbit is a very fast machine learning tool built with Rust inspired by and partially compatible with Vowpal Wabbit (much love! read more abo

Simple neural network library for classification written in Rust.

Cogent A note I continue working on GPU stuff, I've made some interesting things there, but ultimately it made me realise this is far too monumental a

RustFFT is a high-performance FFT library written in pure Rust.

RustFFT is a high-performance FFT library written in pure Rust. It can compute FFTs of any size, including prime-number sizes, in O(nlogn) time.

l2 is a fast, Pytorch-style Tensor+Autograd library written in Rust
l2 is a fast, Pytorch-style Tensor+Autograd library written in Rust

l2 β€’ πŸ€– A Pytorch-style Tensor+Autograd library written in Rust Installation β€’ Contributing β€’ Authors β€’ License β€’ Acknowledgements Made by Bilal Khan

Reinforcement learning library written in Rust

REnforce Reinforcement library written in Rust This library is still in early stages, and the API has not yet been finalized. The documentation can be

Barnes-Hut t-SNE implementation written in Rust.
Barnes-Hut t-SNE implementation written in Rust.

bhtsne Barnes-Hut implementation of t-SNE written in Rust. The algorithm is described with fine detail in this paper by Laurens van der Maaten. Instal

Comments
  • feat: Roadmap

    feat: Roadmap

    Feature:

    • Vectorize distance operations
    • Custom Index using IVF
    • Custom index using HNSW
    • Custom index using ScaNN
    • Support Vec8, Vec16

    Tests:

    • Add benchmarks
    • Add unit tests

    Reference

    • https://github.com/pgvector/pgvector
    • ​https://github.com/postgres/postgres/tree/master/contrib/bloom
    opened by VoVAllen 1
Owner
TensorChord
Cloud native AI infrastructure
TensorChord
A vector with a fixed capacity. (Rust)

arrayvec OR A vector with fixed capacity. Please read the API documentation here License Dual-licensed to be compatible with the Rust project. License

bluss 522 Dec 20, 2022
Qdrant - vector similarity search engine with extended filtering support

Vector Similarity Search Engine with extended filtering support Qdrant (read: quadrant ) is a vector similarity search engine. It provides a productio

qdrant 3.5k Dec 30, 2022
FFSVM stands for "Really Fast Support Vector Machine"

In One Sentence You trained a SVM using libSVM, now you want the highest possible performance during (real-time) classification, like games or VR. Hig

Ralf Biedert 53 Nov 24, 2022
Simple WIP GPGPU framework for Rust built on top of wgpu

gpgpu A simple GPU compute library based on wgpu. It is meant to be used alongside wgpu if desired. To start using gpgpu, just create a Framework inst

JerΓ³nimo SΓ‘nchez 97 Dec 26, 2022
Neural Networks in Rust, without backpropagation. WIP

Deep Thought As of right now, this crate is far from a usable state. This crate implements feedforward-neural Networks in rust. Unlike the vast majori

null 5 Apr 10, 2022
Rust binding to LuisaCompute (WIP)

luisa-compute-rs Rust binding to LuisaCompute (WIP) Inside this crate: An almost safe binding to LuisaCompute An EDSL for writing kernels A new backen

Luisa Group 14 Jan 5, 2023
[WIP] An experimental Java-like language and it's virtual machine, for learning Java and JVM.

Sky VM An experimental Java-like language and it's virtual machine, for learning Java and JVM. Dependencies Rust (rust-lang/rust) 2021 Edition, dual-l

Kk Shinkai 2 Jan 3, 2022
Towards fully autonomous driving (WIP)

?? openpilot openpilot is a comprehensive Rust crate designed to assist in building fully autonomous vehicles. The primary focus of this crate is to p

Mahmoud 5 Feb 23, 2024
Tangram is an automated machine learning framework designed for programmers.

Tangram Tangram is an automated machine learning framework designed for programmers. Run tangram train to train a model from a CSV file on the command

Tangram 1.4k Dec 30, 2022
An app designed to simulate real poker events to upskill players

Poker Trainer Version this application is run on: NPM: 8.17.0 Rust: 1.62.0 Available Scripts In the project directory, you can run: npm start Runs the

Tamahau Brown 2 Sep 26, 2022