UNPKG

@maximai/maxim-js

Version:

Maxim AI JS SDK. Visit https://getmaxim.ai for more info.

75 lines (74 loc) 2.51 kB
/** * Enumeration of all entity types supported by the Maxim logging system. * * These entities represent different types of components * that can be logged and tracked within the Maxim observability platform. * * @enum {string} * @readonly * @example * // Entity types are used internally by container classes * const session = new Session(config, writer); // Uses Entity.SESSION * const trace = new Trace(config, writer); // Uses Entity.TRACE */ export declare enum Entity { /** User or system session containing multiple traces */ SESSION = "session", /** Individual execution trace containing spans and operations */ TRACE = "trace", /** Hierarchical span within a trace for grouping operations */ SPAN = "span", /** LLM generation or completion operation */ GENERATION = "generation", /** User or system feedback on operations */ FEEDBACK = "feedback", /** Document or information retrieval operation */ RETRIEVAL = "retrieval", /** Function or tool call execution */ TOOL_CALL = "tool_call", /** Error or exception occurrence */ ERROR = "error", /** Storage entity */ STORAGE = "storage" } /** * Represents a log action within the Maxim system. * * CommitLog instances are used to record all changes to components, * they are used by the log writer to persist data to the backend. * * @class CommitLog */ export declare class CommitLog { protected entity: Entity; protected entityId: string; readonly action: string; readonly data: Record<string, any>; /** * Creates a new commit log entry. * * @param entity - The type of entity being logged * @param entityId - Unique identifier for the entity instance * @param action - The action being performed (e.g., 'create', 'update', 'end') * @param data - Data associated with the action */ constructor(entity: Entity, entityId: string, action: string, data: Record<string, any>); /** * Gets the unique identifier for the entity associated with this log entry. * * @returns The entity's unique ID */ get id(): string; /** * Gets the entity type for this log entry. * * @returns The entity type enum value */ get type(): Entity; /** * Serializes the commit log to a formatted string representation for logging. * * @returns A string representation of the log entry with entity, ID, action, and data */ serialize(): string; }