Skip to main content

Module engine

Module engine 

Source
Expand description

High-level MemexEngine API for library consumers.

The MemexEngine provides a simple, ergonomic interface for storing and searching vector embeddings. It wraps the lower-level StorageManager and EmbeddingClient to provide a unified API.

§Example

use rust_memex::{MemexEngine, MemexConfig};
use serde_json::json;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Quick setup for an app
    let engine = MemexEngine::for_app("my-app", "documents").await?;

    // Store a document
    engine.store("doc-1", "Hello world!", json!({"source": "test"})).await?;

    // Search for similar documents
    let results = engine.search("greeting", 5).await?;

    // Get by ID
    if let Some(doc) = engine.get("doc-1").await? {
        println!("Found: {}", doc.text);
    }

    // Delete
    engine.delete("doc-1").await?;

    Ok(())
}

Re-exports§

pub use crate::rag::SearchResult as Document;

Structs§

BatchResult
Result of a batch operation
DiveResult
Result of a dive operation for a single layer
LayerStats
Statistics for a single layer in dive results
MemexConfig
Configuration for MemexEngine.
MemexEngine
High-level API for vector memory operations.
MetaFilter
Metadata filter for search and deletion operations.
StoreItem
Item for batch storage operations.