Episodic Memory Manager (services/episodic_memory_manager.py)

MIRIX · ai, AI / Agents, episodic, memory, bm25, embeddings, sql

Manages episodic memory items, providing creation, search (BM25), and embedding updates. Ideal for storing and retrieving time‑ordered event snippets tied to an agent.

# Source: https://github.com/mperkins0155/MIRIX | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
import datetime as dt
import json
import re
import string
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional

from rank_bm25 import BM25Okapi
from rapidfuzz import fuzz
from sqlalchemy import delete, func, select, text, update

from mirix.constants import BUILD_EMBEDDINGS_FOR_MEMORY
from mirix.embeddings import embedding_model
from mirix.log import get_logger
from mirix.orm.episodic_memory import EpisodicEvent
from mirix.orm.errors import NoResultFound
from mirix.schemas.agent import AgentState
from mirix.schemas.client import Client as PydanticClient
fr

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key