Memoripy is a Python library designed to manage and retrieve context-aware memory interactions using both short-term and long-term storage. It supports AI-driven applications requiring memory management, with compatibility for OpenAI and Ollama APIs. Features include contextual memory retrieval, memory decay and reinforcement, hierarchical clustering, and graph-based associations.
This example script shows the primary functionality of Memoripy, including initialization, storing interactions, retrieving relevant memories, and generating responses.
MemoryManager: Manages memory interactions, retrieves relevant information, and generates responses based on past interactions.
MemoryStore: Stores and organizes interactions in short-term and long-term memory, with support for clustering and retrieval based on relevance.
Retrieve Relevant Interactions: Search past interactions based on a query using cosine similarity, decay factors, and spreading activation.