Skip to main content

The memory layer for AI agents

Project description

🧠 Memorix AI

PyPI version Python versions License CI Codecov

A flexible memory management system for AI applications with plug-in support for various vector stores and embedding models.

✨ Features

  • 🗄️ Flexible Vector Stores: FAISS, Qdrant, and custom implementations
  • 🤖 Multiple Embedding Models: OpenAI, Google Gemini, Sentence Transformers
  • 📊 Metadata Management: Optional metadata storage with multiple backends
  • ⚙️ YAML Configuration: Easy configuration management
  • 🚀 Simple API: Clean and intuitive interface
  • 🧪 Comprehensive Testing: Full test coverage and CI/CD
  • 📚 Rich Documentation: API docs, examples, and guides

🚀 Quick Start

Installation

pip install memorix-ai

Basic Usage

from memorix import MemoryAPI, Config

# Initialize with configuration
config = Config('memorix.yaml')
memory = MemoryAPI(config)

# Store a memory
memory_id = memory.store(
    "Python is a high-level programming language.",
    metadata={"topic": "programming", "language": "python"}
)

# Retrieve relevant memories
results = memory.retrieve("programming languages", top_k=5)
for result in results:
    print(f"Content: {result['content']}")
    print(f"Similarity: {result['similarity']:.3f}")
    print(f"Metadata: {result['metadata']}")

⚙️ Configuration

Create a memorix.yaml file:

vector_store:
  type: faiss
  index_path: ./memorix_index
  dimension: 1536

embedder:
  type: openai
  model: text-embedding-ada-002
  api_key: ${OPENAI_API_KEY}

metadata_store:
  type: sqlite
  database_path: ./memorix_metadata.db

settings:
  max_memories: 10000
  similarity_threshold: 0.7

🔌 Supported Components

Vector Stores

  • FAISS: Fast similarity search with CPU/GPU support
  • Qdrant: Vector database with advanced features
  • Custom: Implement your own vector store

Embedding Models

  • OpenAI: text-embedding-ada-002, text-embedding-3-small, etc.
  • Google Gemini: models/embedding-001
  • Sentence Transformers: all-MiniLM-L6-v2, all-mpnet-base-v2, etc.

Metadata Stores

  • SQLite: Persistent storage with SQL database
  • In-Memory: Fast temporary storage
  • JSON File: Simple file-based storage

📖 API Reference

MemoryAPI

Method Description
store(content, metadata=None) Store content with optional metadata
retrieve(query, top_k=5) Retrieve relevant memories based on query
update(memory_id, content, metadata=None) Update an existing memory
delete(memory_id) Delete a memory by ID
list_memories(limit=100) List all memories with basic info

🎯 Examples

Core Examples

See the examples/ directory for basic usage examples:

  • basic_usage.py: Minimal usage example

🚀 Comprehensive Examples & Demos

For comprehensive examples, interactive demos, and real-world applications, check out our dedicated examples repository:

📚 Memorix Examples Repository

Featured Demos:

Interactive Applications:

Ready-to-Use Templates:

Quick Start:

# Clone the examples repository
git clone https://github.com/memorix-ai/memorix-examples.git
cd memorix-examples

# Install dependencies
pip install -r requirements.txt

# Run a demo
python demos/01_basic_usage.py

🛠️ Development

Setup

# Clone the repository
git clone https://github.com/memorix-ai/memorix-sdk.git
cd memorix-sdk

# Install in development mode
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Common Commands

# Run tests
make test

# Run tests with coverage
make test-cov

# Format code
make format

# Run linting
make lint

# Build package
make build

# See all available commands
make help

Running Tests

python -m pytest tests/

Running Examples

python examples/basic_usage.py

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🗺️ Roadmap

  • Add more vector store backends (Pinecone, Weaviate, etc.)
  • Add more embedding models (Cohere, Hugging Face, etc.)
  • Add memory compression and summarization
  • Add batch operations
  • Add memory versioning
  • Add memory expiration
  • Add memory categories and tags
  • Add memory search filters
  • Add memory export/import
  • Add memory analytics and insights

📚 Documentation

📞 Support


Made with ❤️ by the Memorix Team

GitHub stars GitHub forks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memorix_ai-0.1.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memorix_ai-0.1.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file memorix_ai-0.1.1.tar.gz.

File metadata

  • Download URL: memorix_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for memorix_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d3ed7f5cf43786a0aa3a9ecf41da138adbf5fc741541983f57bddd8aad6cc30f
MD5 9abe4b509e48a1bb30223bc3c6769d13
BLAKE2b-256 baf29b6a64bbef00d853803a479b1af653c05c0861d5b328aa7fcae102340b62

See more details on using hashes here.

File details

Details for the file memorix_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: memorix_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for memorix_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 247e02fbf853996c9a51795740f7030ec3ca2bf0c28f6aa5baec0e380ecdac89
MD5 3bbd14673fa4f7b1023a9f524f7bc02b
BLAKE2b-256 b1fcb56b0a9434a9c11e7439ae4d049be3c9c5a52fdd37fa9420e8e8c3e4a0ce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page