API Reference

Complete API reference for Feather. All methods and their parameters are documented here.

DB Class

The main database class for creating and managing vector databases.

DB.open(filename, dim)

Open or create a Feather database.

db = DB.open("vectors.feather", dim=384)

Parameters:

  • filename - Path to the `.feather` file
  • dim - Dimension of vectors (must be consistent)

db.add(id, vector)

Add a vector to the database.

db.add(1, vector)  # vector is numpy array

Parameters:

  • id - Unique identifier (int or str)
  • vector - Vector array (numpy array, float32)

db.search(query, k=10)

Search for similar vectors.

results = db.search(query_vector, k=5)

Parameters:

  • query - Query vector (numpy array)
  • k - Number of results to return (default: 10)

Returns:

List of (id, distance) tuples

db.save()

Save the database to disk.

db.save()

db.build_index(M=16, ef_construction=200)

Build or rebuild the HNSW index with custom parameters.

db.build_index(M=32, ef_construction=400)

Parameters:

  • M - Number of bi-directional links (default: 16)
  • ef_construction - Size of candidate list (default: 200)

Advanced Methods

db.delete(id)

Delete a vector by ID.

db.delete(1)

db.get(id)

Retrieve a vector by ID.

vector = db.get(1)

db.count()

Get the number of vectors in the database.

count = db.count()