Getting_Started

Installation & Setup

Get up and running with Memori-JS in under a minute. No Docker required.

1. Install Package

Use your preferred package manager to install the core library.

$npm install memori-js

2. Set up Environment

Configure your API keys in your .env file.

bash
1# .env
2OPENAI_API_KEY=sk-...
3GOOGLE_API_KEY=AIza...
4# Optional: Postgres URL if using cloud storage
5DATABASE_URL=postgresql://...

3. Create your Agent

Initialize Memori and run your first memory-augmented completion.

typescript
1import { Memori } from "memori-js";
2import OpenAI from "openai";
3
4async function main() {
5 // Initialize Memori (defaults to local SQLite)
6 const memori = new Memori();
7
8 // Initialize your LLM client
9 const client = new OpenAI();
10
11 // Register the client to enable memory injection
12 memori.llm.register(client);
13
14 // Calls are now automatically enhanced with context!
15 const response = await client.chat.completions.create({
16 model: "gpt-4",
17 messages: [
18 { role: "system", content: "You are a helpful assistant." },
19 { role: "user", content: "Remember that I like coding in TypeScript." }
20 ]
21 });
22
23 console.log(response.choices[0].message.content);
24}
25
26main();