From c42248ff350294de5d11f7cba03a819683c5247a Mon Sep 17 00:00:00 2001 From: nexxeln <95541290+nexxeln@users.noreply.github.com> Date: Sun, 14 Dec 2025 01:19:52 +0000 Subject: add the addMemory option docs (#616) --- apps/docs/ai-sdk/overview.mdx | 15 ++++++++++++++- apps/docs/ai-sdk/user-profiles.mdx | 10 ++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'apps') diff --git a/apps/docs/ai-sdk/overview.mdx b/apps/docs/ai-sdk/overview.mdx index f084aba9..667ae5c7 100644 --- a/apps/docs/ai-sdk/overview.mdx +++ b/apps/docs/ai-sdk/overview.mdx @@ -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, @@ -35,6 +35,19 @@ const result = await generateText({ // The model automatically has the user's profile context! ``` + + **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" + }) + ``` + + +```typescript +``` + ## Memory Tools Add memory capabilities to AI agents with search, add, and fetch operations. diff --git a/apps/docs/ai-sdk/user-profiles.mdx b/apps/docs/ai-sdk/user-profiles.mdx index ce8f5398..68ba819a 100644 --- a/apps/docs/ai-sdk/user-profiles.mdx +++ b/apps/docs/ai-sdk/user-profiles.mdx @@ -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. + + **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" + }) + ``` + + ## Memory Search Modes Configure how the middleware retrieves and uses memory: -- cgit v1.2.3