API_Reference
Core API
Complete reference for the Memori-JS client.
Class: Memori
The main entry point for the library.
Constructor
typescript
1constructor(config?: MemoriConfig)23interface MemoriConfig {4 storage?: "sqlite-local" | "postgres"; // Default: sqlite-local5 dbPath?: string; // Default: ./memori.db6 googleApiKey?: string; // Required for embedding generation7}Initializes the memory layer. If using SQLite, it will automatically create the database file if it doesn't exist.
memori.llm.register()
Patch an LLM client with memory capabilities.
Signature
typescript
1register(client: any, provider?: "openai" | "google" | "anthropic")Automatically detects the client type if provider is omitted. Supports standard SDKs for OpenAI, Google GenAI, and Anthropic.
memori.search()
Manually retrieve memories.
Signature
typescript
1async search(query: string, limit: number = 5): Promise<Memory[]>Performs a semantic search against the vector store. Used internally by the auto-augmentation middleware, but exposed for manual use.