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.0.tar.gz (18.6 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.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memorix_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 18.6 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.0.tar.gz
Algorithm Hash digest
SHA256 aa95fef85a5c2e6e5a7b3d8cce0fc1a1c03e1186fad9fe18856d5792c6503bf2
MD5 c3fbb3981c0b217b8d76323638b76ee2
BLAKE2b-256 ea628abf89071e9affd73b103ee17df9606535bbd10d9a1c3529ce70499bf34d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: memorix_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ce3b5bb0e6c1dcc7d032ab76cbcc9cbc6d91caa639e7be353e69ed8e64f23b3
MD5 b5a01e082296690b34177da197805798
BLAKE2b-256 1ca016084d6530340d0c7e5632cd135b3328ef1c63746ec558ce67c482b5a682

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