import { type BgentRuntime } from "./runtime"; import { type Memory, type UUID } from "./types"; export declare const embeddingDimension = 1536; export declare const embeddingZeroVector: any[]; /** * Manage memories in the database. */ export declare class MemoryManager { /** * The BgentRuntime instance associated with this manager. */ runtime: BgentRuntime; /** * The name of the database table this manager operates on. */ tableName: string; /** * Constructs a new MemoryManager instance. * @param opts Options for the manager. * @param opts.tableName The name of the table this manager will operate on. * @param opts.runtime The BgentRuntime instance associated with this manager. */ constructor({ tableName, runtime, }: { tableName: string; runtime: BgentRuntime; }); /** * Adds an embedding vector to a memory object. If the memory already has an embedding, it is returned as is. * @param memory The memory object to add an embedding to. * @returns A Promise resolving to the memory object, potentially updated with an embedding vector. */ addEmbeddingToMemory(memory: Memory): Promise; /** * Retrieves a list of memories by user IDs, with optional deduplication. * @param opts Options including user IDs, count, and uniqueness. * @param opts.room_id The room ID to retrieve memories for. * @param opts.count The number of memories to retrieve. * @param opts.unique Whether to retrieve unique memories only. * @returns A Promise resolving to an array of Memory objects. */ getMemories({ room_id, count, unique, }: { room_id: UUID; count?: number; unique?: boolean; }): Promise; getCachedEmbeddings(content: string): Promise<{ embedding: number[]; levenshtein_score: number; }[]>; /** * Searches for memories similar to a given embedding vector. * @param embedding The embedding vector to search with. * @param opts Options including match threshold, count, user IDs, and uniqueness. * @param opts.match_threshold The similarity threshold for matching memories. * @param opts.count The maximum number of memories to retrieve. * @param opts.room_id The room ID to retrieve memories for. * @param opts.unique Whether to retrieve unique memories only. * @returns A Promise resolving to an array of Memory objects that match the embedding. */ searchMemoriesByEmbedding(embedding: number[], opts: { match_threshold?: number; count?: number; room_id: UUID; unique?: boolean; }): Promise; /** * Creates a new memory in the database, with an option to check for similarity before insertion. * @param memory The memory object to create. * @param unique Whether to check for similarity before insertion. * @returns A Promise that resolves when the operation completes. */ createMemory(memory: Memory, unique?: boolean): Promise; /** * Removes a memory from the database by its ID. * @param memoryId The ID of the memory to remove. * @returns A Promise that resolves when the operation completes. */ removeMemory(memoryId: UUID): Promise; /** * Removes all memories associated with a set of user IDs. * @param room_id The room ID to remove memories for. * @returns A Promise that resolves when the operation completes. */ removeAllMemories(room_id: UUID): Promise; /** * Counts the number of memories associated with a set of user IDs, with an option for uniqueness. * @param room_id The room ID to count memories for. * @param unique Whether to count unique memories only. * @returns A Promise resolving to the count of memories. */ countMemories(room_id: UUID, unique?: boolean): Promise; }