Skip to main content

Multimodal Memory for AI Agents and MCP.

Project description

Pixelmemory

A memory management layer for AI agents and LLMs, built on the powerful pixeltable database.

Introduction

Pixelmemory provides semantic memory capabilities for AI applications, enabling long-term memory for conversational agents, RAG systems, and AI assistants. Built on pixeltable's vector database capabilities, it offers efficient storage and retrieval of conversation history and contextual information.

Installation

pip install pixelmemory

Key Features

  • Semantic Memory Retrieval: Find relevant past conversations using vector similarity search
  • Multi-User Support: Maintain separate memory spaces for different users
  • Metadata Storage: Store and retrieve structured data alongside memories
  • Pixeltable Integration: Leverages pixeltable's powerful vector database capabilities

Use Cases

  • AI Memory Systems: Add long-term memory to conversational AI agents
  • Personalized AI Assistants: Remember user preferences and past interactions
  • Knowledge Management: Store and retrieve information from past conversations
  • Agent Memory: Provide context for autonomous AI agents

Quickstart Guide

Installation

pip install pixelmemory

Basic Usage with Anthropic Claude

from anthropic import Anthropic
from pixelmemory import Memory

# Initialize Anthropic client and Memory
anthropic_client = Anthropic()
memory = Memory()

# Example: Chat with memories
def chat_with_memories(message: str, user_id: str = "default_user") -> str:
    # Retrieve relevant memories
    relevant_memories = memory.search(query=message, user_id=user_id, limit=3)
    memories_str = "\n".join(f"- {entry['memory']}" for entry in relevant_memories["results"])

    # Generate Assistant response
    system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}"
    
    # Create Anthropic message format
    response = anthropic_client.messages.create(
        model="claude-3-haiku-20240307",
        max_tokens=1000,
        system=system_prompt,
        messages=[{"role": "user", "content": message}]
    )
    assistant_response = response.content[0].text

    # Create new memories from the conversation
    memory_messages = [
        {"role": "user", "content": message},
        {"role": "assistant", "content": assistant_response}
    ]
    memory.add(memory_messages, user_id=user_id)

    return assistant_response

# Example: Interactive chat
def main():
    print("Chat with AI (type 'exit' to quit)")
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() == 'exit':
            print("Goodbye!")
            break
        print(f"AI: {chat_with_memories(user_input)}")

if __name__ == "__main__":
    main()

How It Works

Pixelmemory uses pixeltable's vector database capabilities to store and retrieve memories:

  1. Memory Storage: Conversations are stored with vector embeddings for semantic search
  2. Memory Retrieval: When a new query comes in, similar past conversations are retrieved
  3. Context Integration: Retrieved memories are included in the prompt to the LLM
  4. Continuous Learning: New conversations are stored for future reference

Advanced Features

  • Custom Embedding Models: Use your preferred embedding model for specialized domains
  • Flexible Querying: Search by semantic similarity, time ranges, or custom filters
  • Metadata Management: Store and retrieve structured data alongside memories
  • Multi-User Architecture: Maintain separate memory spaces for different users

Integrating with AI Memory Systems

Pixelmemory can be used as a drop-in replacement for other memory systems in AI applications. It provides a simple API for storing and retrieving memories, making it easy to integrate with existing AI systems.

Keywords: AI memory, long-term memory, semantic memory, conversation memory, agent memory, AI assistant memory, memory retrieval, memory storage, vector database, pixeltable, AI memory systems, conversational memory

Requirements

  • Python 3.9+
  • pixeltable 0.3.8+

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

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

pixelmemory-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

pixelmemory-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pixelmemory-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.16 Darwin/24.3.0

File hashes

Hashes for pixelmemory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39b4a677305578b4bcf6301a9da4098b6e44171ac56dd8c9d00b971e44a3b9ee
MD5 5cc1f64ea06cf6449d4e2cb1b0d305da
BLAKE2b-256 1e6b7468ea4233af9d6349a94b457945bb8f7014fb86fba49f73c522f4c8775a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pixelmemory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.16 Darwin/24.3.0

File hashes

Hashes for pixelmemory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12cba049f09f2aaef21508b54bcce592706c93e9c9a5cbb144d75c80eee5510b
MD5 7a3871e88ab31e29fa4d2fa2b9630e03
BLAKE2b-256 21fc367d62831580ace9161bf22538eb69d996d4537f984bfa4b1ecd8f3d5008

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