Skip to main content

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.

Metadata

Release files for pixelmemory 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pixelmemory 0.1.0
File Size Uploaded
pixelmemory-0.1.0.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pixelmemory 0.1.0
File Interpreter ABI Platform
pixelmemory-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / pixelmemory-0.1.0.tar.gz

Download URL pixelmemory-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
39b4a677305578b4bcf6301a9da4098b6e44171ac56dd8c9d00b971e44a3b9ee
BLAKE2b-256 checksum
How to use checksums
1e6b7468ea4233af9d6349a94b457945bb8f7014fb86fba49f73c522f4c8775a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.16 Darwin/24.3.0

Release files / pixelmemory-0.1.0-py3-none-any.whl

Download URL pixelmemory-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12cba049f09f2aaef21508b54bcce592706c93e9c9a5cbb144d75c80eee5510b
BLAKE2b-256 checksum
How to use checksums
21fc367d62831580ace9161bf22538eb69d996d4537f984bfa4b1ecd8f3d5008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.16 Darwin/24.3.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page