Documentation // V1.2.0

Introduction

Memori-JS is an active memory layer for your AI agents. It bridges the gap between transient context windows and persistent storage.

Philosophy

Memory should be invisible. You shouldn't manage vector stores manually. Memori abstracts the complexity of RAG into a simple middleware.

Quick Start

Install the package via your preferred package manager.

$npm install memori-js

Basic Usage

Initialize Memori and register your LLM client. It works by intercepting calls to inject relevant context.

typescript
1import { Memori } from "memori-js";
2import OpenAI from "openai";
3
4// 1. Initialize Memori
5const memori = new Memori({
6 googleApiKey: process.env.GOOGLE_API_KEY, // Used for embeddings
7});
8
9// 2. Register your client
10const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
11memori.llm.register(client);
12
13// 3. Chat as normal - memory is handled automatically
14const response = await client.chat.completions.create({
15 model: "gpt-4",
16 messages: [{ role: "user", content: "My name is Alice." }],
17});