Getting Started
Welcome to Feather! This guide will help you get up and running with Feather in just a few minutes.
What is Feather?
Feather is a lightweight, edge-native vector database that allows you to store, index, and search high-dimensional vectors efficiently. Think of it as SQLite for vectors - a single-file database that runs anywhere.
Key features:
- Single-file storage (`.feather` format)
- HNSW indexing for fast similarity search
- Works offline - no server required
- Runs on edge devices, browsers, and mobile
- WASM support for browser deployment
Quick Installation
pip
pip install feather-py
# Requires Python 3.10+Your First Vector Database
Let's create a simple vector database and add some vectors:
Python
from feather import DB
import numpy as np
# Create a new database with 128-dimensional vectors
db = DB.open("my_vectors.feather", dim=128)
# Generate some random vectors
for i in range(100):
vector = np.random.rand(128).astype(np.float32)
db.add(i, vector)
# Save to disk
db.save()
print("Database created with 100 vectors!")Search Your Vectors
Now let's search for similar vectors:
Python
# Load the database
db = DB.open("my_vectors.feather", dim=128)
# Create a query vector
query = np.random.rand(128).astype(np.float32)
# Search for top 5 similar vectors
results = db.search(query, k=5)
print(f"Found {len(results)} similar vectors")
for id, distance in results:
print(f"Vector ID: {id}, Distance: {distance}")