Skip to content

omniedgeio/EdgeVectorDB

Repository files navigation

EdgeVectorDB: An AI-Native Database MVP (Edge-Optimized)

EdgeVectorDB is an AI-native database MVP built in Rust, optimized for edge computing use cases. It leverages SQLite as its base and provides capabilities for local vector search, low-latency inference data caching, and offline semantic retrieval.

Features

  • Language: Rust
  • Base: SQLite (via rusqlite)
  • Vector Storage: Supports vector data column type with distance metrics (cosine, Euclidean, dot-product).
  • Hybrid Query Engine: Designed for hybrid SQL + semantic queries.
  • API: gRPC and REST API for basic operations (insert, search, delete).
  • Edge Optimizations:
    • Offline embedding with ONNX inference.
    • SQLite WAL + async batching for edge write durability.
    • Optimized binary size with strip, lto, musl compile.
    • Static binaries for ARM64, x86_64.
    • Flat file export/import (.edgevec format).
  • CLI Tool: Command-line interface for interacting with the database.

Project Structure

  • core/: Contains the core logic for storage, vector indexing, embedding, and query parsing.
  • api/: Implements the gRPC and HTTP API layers.
  • bindings/: (Future) Optional Python bindings.
  • cli/: Provides a local CLI tool for interacting with EdgeVectorDB.

Getting Started

Prerequisites

  • Rust (latest stable version)
  • build-essential (for SQLite compilation)
  • protobuf-compiler (for gRPC)
  • cmake and clang (for ONNX runtime)
  • libssl-dev (for ONNX runtime)
  • gcc-aarch64-linux-gnu and g++-aarch64-linux-gnu (for ARM64 cross-compilation)

Build

To build the project, navigate to the EdgeVectorDB directory and run:

cargo build --release

This will build the api and cli binaries in target/release/.

Running the API Server

To run the gRPC and REST API server:

./target/release/api

The gRPC server will listen on [::1]:50051 and the REST server on 127.0.0.1:3000.

Using the CLI Tool

Insert Data:

./target/release/cli insert --file <path_to_data_file> --db <database_file>

Example data file (sample_data.txt):

1.0,2.0,3.0
4.0,5.0,6.0
7.0,8.0,9.0

Query Data:

./target/release/cli query "<comma_separated_vector>" --k <num_results> --db <database_file>

Export Data:

./target/release/cli export --output <output_file.edgevec> --db <database_file>

Import Data:

./target/release/cli import --input <input_file.edgevec> --db <database_file>

Demo

A simple demo script demo.sh is provided to showcase the CLI tool's functionality:

./demo.sh

This script will:

  1. Build the CLI tool.
  2. Insert sample data from sample_data.txt into demo.db.
  3. Query for similar vectors.
  4. Export the database to demo.edgevec.

Docker

A Dockerfile is provided for building multi-architecture Docker images:

docker build -t edgevectordb .

Local Benchmarks

(To be added)

About

An AI-Native Database built by AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published