Memista
Memista is a high-performance vector search library that combines SQLite for metadata storage with USearch for efficient vector similarity search. It provides both a library interface for embedding in Rust applications and a standalone HTTP server.
Features
- Fast Vector Similarity Search: Utilizes USearch for high-performance similarity search
- Persistent Storage: Stores text chunks and metadata in SQLite for durability
- Multi-Database Support: Supports multiple isolated databases through
database_idpartitioning - Comprehensive API Documentation: Auto-generated OpenAPI documentation with Swagger, Redoc, and RapiDoc interfaces
- Environment-Based Configuration: Easily configurable through environment variables
- Asynchronous I/O: Built with async I/O for high performance and concurrency
- Memory Efficient: Uses optimized data structures for efficient memory usage
Installation
As a Library
Add this to your Cargo.toml:
[]
= "0.1"
As a CLI Application
To install and run Memista as a standalone server:
# Clone the repository
# Build and run the application
# Or build and install it
The server will start on http://127.0.0.1:8083 by default.
You can also install it directly from crates.io:
Library Usage
Basic Example
use ;
use ;
use Arc;
async
Starting the HTTP Server
use ;
use ;
use HttpServer;
use Arc;
async
Examples
The repository includes several examples demonstrating different ways to use Memista:
- Basic Usage: Shows how to start a Memista HTTP server (
examples/basic_usage.rs) - Library Usage: Demonstrates direct library usage without starting the HTTP server (
examples/library_usage.rs) - Advanced Usage: Shows a more realistic use case with text processing (
examples/advanced_usage.rs) - HTTP Client: Demonstrates how to interact with a running Memista server using Rust's HTTP client (
examples/http_client.rs)
To run any example:
See the examples/README.md for more details on each example.
HTTP API
Memista provides a RESTful HTTP API for vector search operations:
POST /v1/insert
Insert text chunks with their embeddings into a specified database.
POST /v1/search
Search for similar chunks using vector embeddings.
DELETE /v1/drop
Drop a specific database and its associated vector index.
Configuration
The service can be configured using environment variables:
| Variable | Description | Default |
|---|---|---|
DATABASE_PATH |
Path to SQLite database file | memista.db |
SERVER_HOST |
Host address to bind to | 127.0.0.1 |
SERVER_PORT |
Port to listen on | 8083 |
LOG_LEVEL |
Logging level (debug, info, warn, error) | info |
Documentation
Performance Considerations
- Embedding Dimensionality: Currently hardcoded to 2 dimensions. For production use, this should be configurable.
- Index Persistence: USearch indexes are persisted to disk for durability.
- Connection Pooling: Uses connection pooling for efficient database access.
- Async I/O: Fully async implementation for high concurrency.
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.