Skip to main content

Crate phago_vectors

Crate phago_vectors 

Source
Expand description

§Phago Vectors

Vector database adapters for Phago biological computing framework.

This crate provides a unified interface for storing and searching embeddings across different vector database backends.

§Supported Backends

BackendFeature FlagDescription
In-Memory(default)Simple brute-force search, good for testing
QdrantqdrantHigh-performance vector database
PineconepineconeManaged vector database service
WeaviateweaviateOpen-source vector search engine

§Quick Start

use phago_vectors::{VectorStore, InMemoryStore, VectorRecord};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let store = InMemoryStore::new(384); // 384-dimensional vectors

    // Store a vector
    let record = VectorRecord::new("doc1", vec![0.1; 384])
        .with_metadata("title", "Introduction to Cells");
    store.upsert(vec![record]).await?;

    // Search for similar vectors
    let results = store.search(&[0.1; 384], 5).await?;
    for result in results {
        println!("{}: {:.3}", result.id, result.score);
    }

    Ok(())
}

§Feature Flags

# Use Qdrant backend
phago-vectors = { version = "0.6", features = ["qdrant"] }

# Use all backends
phago-vectors = { version = "0.6", features = ["all"] }

Re-exports§

pub use memory::InMemoryStore;

Modules§

memory
In-memory vector store implementation.
util
Utility functions for vector operations.

Structs§

SearchResult
A search result from the vector store.
VectorRecord
A vector record to store in the database.
VectorStoreConfig
Configuration for creating a vector store.

Enums§

BackendConfig
Backend-specific configuration.
DistanceMetric
Distance metric for similarity search.
VectorError
Errors that can occur when working with vector stores.

Traits§

VectorStore
Abstract interface for vector storage and search.

Functions§

create_store
Create a vector store from configuration.

Type Aliases§

VectorResult
Result type for vector operations.