Skip to main content

Memory management library to enhance AI agents with smarter, personalized, context-aware responses

Project description

Logo Tovana

Memory Driven Reasoning for Smarter AI Agents

Tovana is a library that introduces a new approach to improving LLM reasoning through actionable insights (beliefs) derived from continous interactions and long term memory. Supercharge your AI agents with personalized, context-aware responses.

PyPI version License: Apache 2

Why Tovana?

Current AI memory systems face significant drawbacks that limit their ability to mimic human-like intelligence. These include their static nature (vector dbs / semantic search), lack of contextual understanding, inability to learn from experience or form beliefs, poor handling of contradictions, limited associative capabilities, and absence of emotional intelligence. Additionally, AI agents struggle with abstraction, lack meta-cognitive abilities, and don't have mechanisms for selectively retaining or forgetting information. These shortcomings collectively restrict AI agents' adaptability, decision-making, and ability to navigate complex, real-world scenarios effectively.

The proposed AI agent memory system is designed to augment human memory and enhance AI agents' capabilities. Its purpose is to create more personalized, adaptive, and context-aware AI interactions by simulating human-like memory processes. This system aims to bridge the gap between static knowledge bases and dynamic, experience-based learning, allowing AI agents to evolve their understanding and behavior over time.

The system is a comprehensive memory and belief management framework for AI agents. It includes components for processing events, storing short-term and long-term memories, managing beliefs, creating associations, and informing decision-making processes. The core concept revolves around converting experiences (events) into memories, which in turn shape beliefs. These beliefs then influence the agent's reasoning, responses, and actions.

🌟 Features

  • 🧠 Supercharge AI with Human like Memory: Transform interactions into lasting memories and beliefs
  • 🔍 Smart Information Extraction: Automatically capture and store relevant user details
  • 💡 Belief Generation: Create actionable insights to guide personalized AI responses
  • 🤖 LLM Friendly Context Generation: Easily integrate memory and beliefs into your AI's decision-making
  • 🔌 Simple Integration: Plug into your AI applications with our straightforward API
  • 🎭 Conflict Resolution: Smartly handle contradictions in user information
  • 🌐 Adaptable Architecture: Designed to work with various LLM providers and models

🏗️ Architecture

Screenshot 2024-08-21 at 9 04 07

🚀 Quick Start

  1. Install Tovana:
pip install tovana
  1. Use it in your project:
from tovana import MemoryManager

business_description = "an AI therapist"

# Initialize with your preferred LLM provider and API key (Refer to the documentation for specific models)
memory_manager = MemoryManager(api_key="your-llm-provider-api-key-here", provider="anthropic",
                               business_description=business_description, include_beliefs=True)

# Update user memory
memory_manager.update_user_memory("user123", "I just moved from New York to Paris for work.")

# Get user memory
user_memory = memory_manager.get_user_memory("user123")
print(user_memory)  # Output: {'location': 'Paris', 'previous_location': 'New York'}

# Get memory context for LLM
context = memory_manager.get_memory_context("user123")
print(context)  # Output: 'User Memory:\n location: Paris,\n previous_location: New York'

# Get beliefs
beliefs = memory_manager.get_beliefs("user123")
print(
  beliefs)  # Output: {"beliefs": "- Suggest spending time with Charlie and Luna when user is feeling down\n- Suggest family activities with Lisa and Mai for emotional well-being\n- Recommend playing basketball for physical exercise and stress relief"}

🧠 Belief Generation: The Secret Sauce

Tovana introduces a new approach to LLM reasoning: actionable beliefs generated from user memory. These beliefs provide personalized insights that can significantly enhance your agent's planning, reasoning and responses.

Examples

Input:

  • business_description: "a commerce site"
  • memory: {'pets': ['dog named charlie', 'horse named luna']}

Output:

{"beliefs": ",- suggest pet products for dogs and horses"}

Input:

  • business_description: "an AI therapist"
  • memory: {'pets': ['dog named charlie', 'horse named luna', 'sleep_time: 10pm']}

Output:

{"beliefs": ",- Suggest mediation at 9:30pm\n- Suggest spending time with Charlie and Luna for emotional well-being"}

🛠️ API Reference

AIMemoryManager

  • get_memory(user_id: str) -> JSON: Fetch user memory
  • update_memory(user_id: str, message: str) -> JSON: Update memory with relevant information if found in message
  • get_memory_context(user_id: str, message: Optiona[str]) -> str: Get formatted memory context, general or message specific
  • get_beliefs(user_id: str) -> str: Get actionable beliefs context

🤝 Contributing

We welcome contributions! Found a bug or have a feature idea? Open an issue or submit a pull request. Let's make Tovana even better together! 💪

📄 License

Tovana is Apache-2.0 licensed. See the LICENSE file for details.


Ready to empower your AI agents with memory-driven reasoning? Get started with Tovana! 🚀 If you find it useful, don't forget to star the repo! ⭐

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

tovana-0.0.2.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

tovana-0.0.2-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file tovana-0.0.2.tar.gz.

File metadata

  • Download URL: tovana-0.0.2.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for tovana-0.0.2.tar.gz
Algorithm Hash digest
SHA256 80eac25ad944d8a52b82224ad76e26cba96525028ac89473bc09d919f03d6dfd
MD5 131c984bd7987beb7b432af3a9049061
BLAKE2b-256 825a0b30195aa520185403197d0a22885cc029973e567eac797222037f204859

See more details on using hashes here.

File details

Details for the file tovana-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tovana-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for tovana-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4d5ec8af6a977e0fa1a40bc7be992a33d7f611403e881bef80a655404b8891a8
MD5 bac37939b1ef3a77ebb7257a390f4f3c
BLAKE2b-256 8e7c19919a9c9023edeba7af7e41ee4d9590d4e43a02ac8fb5d019b2c8b57c43

See more details on using hashes here.

Supported by

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