Skip to content

Configuration

Three Ways to Configure

typescript
// 1. Auto-detect (simplest — reads OPENAI_API_KEY from env)
const mnemo = await createMnemo({ dbPath: './db' });

// 2. Preset (one word — openai, ollama, voyage, jina)
const mnemo = await createMnemo({ preset: 'ollama', dbPath: './db' });

// 3. Full config (complete control)
const mnemo = await createMnemo({ embedding: { ... }, dbPath: './db' });

Presets

PresetProviderModelDimensionsEnv VarCost
openaiOpenAItext-embedding-3-small1536OPENAI_API_KEY~$0.02/1K
ollamaOllama (local)bge-m31024none$0
voyageVoyage AIvoyage-3-large1024VOYAGE_API_KEY~$0.06/1K
jinaJina AIjina-embeddings-v31024JINA_API_KEY~$0.02/1K

Full Config Reference

typescript
const mnemo = await createMnemo({
  // Option A: Use a preset
  preset: 'openai',  // or 'ollama', 'voyage', 'jina'

  // Option B: Manual embedding config (overrides preset)
  embedding: {
    provider: 'openai-compatible',
    apiKey: 'sk-...',                    // or 'ollama' for local
    baseURL: 'https://api.openai.com/v1', // optional
    model: 'text-embedding-3-small',      // optional, default
    dimensions: 1536,                     // optional, default: 1024
    taskQuery: 'search_query',            // optional, provider-specific
    taskPassage: 'search_document',       // optional, provider-specific
  },

  // Required: Database path
  dbPath: './my-memory-db',

  // Optional: Storage backend
  storageBackend: 'lancedb',  // 'lancedb' | 'qdrant' | 'chroma' | 'pgvector'
  storageConfig: {},           // backend-specific options

  // Optional: Weibull decay
  decay: {
    recencyHalfLifeDays: 30,   // half-life in days
    recencyWeight: 0.5,        // weight of recency score
    frequencyWeight: 0.3,      // weight of access frequency
    intrinsicWeight: 0.2,      // weight of importance score
  },

  // Optional: Memory tiers
  tier: {
    coreAccessThreshold: 5,          // accesses to promote to Core
    coreImportanceThreshold: 0.8,    // importance to promote to Core
    peripheralAgeDays: 90,           // days before demotion to Peripheral
  },

  // Optional: LLM for smart extraction
  llm: {
    model: 'gpt-4.1-mini',
    baseURL: 'https://api.openai.com/v1',
    apiKey: 'sk-...',
  },

  // Optional: Retrieval pipeline
  retrieval: {
    candidatePoolSize: 20,
    rerank: 'none',            // 'cross-encoder' | 'lightweight' | 'none'
    rerankApiKey: '...',
    rerankModel: '...',
    rerankEndpoint: '...',
    rerankProvider: '...',     // 'jina' | 'siliconflow' | 'voyage' | 'ollama'
  },
});

Environment Variables

VariableDescription
OPENAI_API_KEYDefault API key for embedding and LLM
MNEMO_DB_PATHOverride default database path
MNEMO_CONFIGPath to JSON config file
MNEMO_PRO_KEYPro license key
MNEMO_DEBUGEnable debug logging

Embedding Providers

ProviderbaseURLModel Example
OpenAIhttps://api.openai.com/v1 (default)text-embedding-3-small
Ollamahttp://localhost:11434/v1bge-m3
Voyagehttps://api.voyageai.com/v1voyage-3-large
Jinahttps://api.jina.ai/v1jina-embeddings-v3
Any OpenAI-compatibleYour endpointYour model

Released under the MIT License.