Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion apps/docs/ai-sdk/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { withSupermemory } from "@supermemory/tools/ai-sdk"
import { openai } from "@ai-sdk/openai"

// Wrap your model with Supermemory - profiles are automatically injected
const modelWithMemory = withSupermemory(openai("gpt-4"), "user-123")
const modelWithMemory = withSupermemory(openai("gpt-5"), "user-123")

const result = await generateText({
model: modelWithMemory,
Expand All @@ -35,6 +35,19 @@ const result = await generateText({
// The model automatically has the user's profile context!
```

<Note>
**Memory saving is disabled by default.** The middleware only retrieves existing memories. To automatically save new memories from conversations, enable it explicitly:

```typescript
const modelWithMemory = withSupermemory(openai("gpt-5"), "user-123", {
addMemory: "always"
})
```
</Note>

```typescript
```

## Memory Tools

Add memory capabilities to AI agents with search, add, and fetch operations.
Expand Down
10 changes: 10 additions & 0 deletions apps/docs/ai-sdk/user-profiles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ The `withSupermemory` middleware:

All of this happens transparently - you write code as if using a normal model, but get personalized responses.

<Note>
**Memory saving is disabled by default.** The middleware only retrieves existing memories. To automatically save new memories from conversations, set `addMemory: "always"`:

```typescript
const model = withSupermemory(openai("gpt-5"), "user-123", {
addMemory: "always"
})
```
</Note>

## Memory Search Modes

Configure how the middleware retrieves and uses memory:
Expand Down
Loading