Module client

Module client 

Source
Expand description

§Client Module

This module provides the main client interface for VectorLite, including collection management, vector operations, and search functionality.

The VectorLiteClient is the primary entry point for interacting with the vector database. It manages collections of vectors and provides thread-safe operations for adding, searching, and deleting vectors.

§Examples

use vectorlite::{VectorLiteClient, EmbeddingGenerator, IndexType, SimilarityMetric};

// Create a client with an embedding function
let mut client = VectorLiteClient::new(Box::new(EmbeddingGenerator::new()?));

// Create a collection
client.create_collection("documents", IndexType::HNSW)?;

// Add text (auto-generates embedding)
let id = client.add_text_to_collection("documents", "Hello world", None)?;

// Search for similar text
let results = client.search_text_in_collection(
    "documents", 
    "hello", 
    5, 
    SimilarityMetric::Cosine
)?;

Structs§

Collection
Collection structure containing the vector index and metadata
CollectionInfo
Information about a collection
Settings
Configuration settings for VectorLite
VectorLiteClient
Main client for interacting with VectorLite

Enums§

IndexType
Index types available for vector collections