Skip to content

createMnemo() ​

Create a Mnemo memory instance.

Signature ​

typescript
function createMnemo(config: MnemoConfig): Promise<MnemoInstance>

Examples ​

typescript
import { createMnemo } from '@mnemoai/core';

// Auto-detect (uses OPENAI_API_KEY from env)
const mnemo = await createMnemo({ dbPath: './my-memory-db' });

// Preset
const mnemo = await createMnemo({ preset: 'ollama', dbPath: './db' });

// Full config
const mnemo = await createMnemo({
  embedding: {
    provider: 'openai-compatible',
    apiKey: process.env.OPENAI_API_KEY,
    model: 'text-embedding-3-small',
    dimensions: 1536,
  },
  dbPath: './my-memory-db',
});

Parameters ​

config.preset (optional) ​

Use a preset instead of manual embedding config. Available: "openai", "ollama", "voyage", "jina".

Or omit both preset and embedding for auto-detection (checks OPENAI_API_KEY → VOYAGE_API_KEY → JINA_API_KEY → error).

config.embedding (optional, overrides preset) ​

FieldTypeDefaultDescription
provider"openai-compatible"—Provider type
apiKeystring—API key (use "ollama" for local)
baseURLstring?OpenAI URLAPI endpoint
modelstring?"text-embedding-3-small"Model name
dimensionsnumber?1024Vector dimensions

config.dbPath (required) ​

Path to the local database directory. Will be created if it doesn't exist.

config.storageBackend (optional) ​

typescript
type StorageBackend = "lancedb" | "qdrant" | "chroma" | "pgvector"

Default: "lancedb" (embedded, zero-config).

config.decay (optional) ​

See Weibull Decay for details.

config.retrieval (optional) ​

See Retrieval Pipeline for details.

Errors ​

ErrorCause
mnemo: config is requiredNo config passed
mnemo: config.embedding is requiredMissing embedding config
mnemo: config.embedding.apiKey is requiredMissing API key
mnemo: config.dbPath is requiredMissing database path

Released under the MIT License.