Step Logging Service (services/step_manager.py)

MIRIX · analytics, step, logging, llm, async, database

Async service that records LLM step metadata to the database and retrieves step records for analytics.

# 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.
from mirix.orm.step import Step as StepModel
from mirix.schemas.client import Client as PydanticClient
from mirix.schemas.openai.chat_completion_response import UsageStatistics
from mirix.schemas.step import Step as PydanticStep
from mirix.utils import enforce_types


class StepManager:
    def __init__(self):
        from mirix.server.server import db_context

        self.session_maker = db_context

    @enforce_types
    async def log_step(
        self,
        actor: PydanticClient,
        provider_name: str,
        model: str,
        context_window_limit: int,
        usage: Usa

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

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

Get a free API key