Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

feat(Vercel AI SDK): add a param in config called `host` (#2634)

Archie Sengupta8e8f13a48e1e
diff --git a/docs/changelog.mdx b/docs/changelog.mdx
index 2bf37067c..28c3d066d 100644
--- a/docs/changelog.mdx
+++ b/docs/changelog.mdx
@@ -990,6 +990,11 @@ mode: "wide"
<Tab title="Vercel AI SDK">
+<Update label="2025-08-05" description="v2.0.1">
+**New Features:**
+- **Vercel AI SDK:** Added a new param `host` to the config.
+</Update>
+
<Update label="2025-08-05" description="v2.0.0">
**New Features:**
- **Vercel AI SDK:** Migration to AI SDK V5.
diff --git a/vercel-ai-sdk/package.json b/vercel-ai-sdk/package.json
index 9496eba02..c457489ca 100644
--- a/vercel-ai-sdk/package.json
+++ b/vercel-ai-sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@mem0/vercel-ai-provider",
- "version": "2.0.0",
+ "version": "2.0.1",
"description": "Vercel AI Provider for providing memory to LLMs",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
diff --git a/vercel-ai-sdk/src/mem0-types.ts b/vercel-ai-sdk/src/mem0-types.ts
index 64351ce4b..70c4d4d9b 100644
--- a/vercel-ai-sdk/src/mem0-types.ts
+++ b/vercel-ai-sdk/src/mem0-types.ts
@@ -26,6 +26,7 @@ export interface Mem0ConfigSettings {
threshold?: number;
rerank?: boolean;
enable_graph?: boolean;
+ host?: string;
output_format?: string;
filter_memories?: boolean;
}
diff --git a/vercel-ai-sdk/src/mem0-utils.ts b/vercel-ai-sdk/src/mem0-utils.ts
index ba9866e89..6484882dc 100644
--- a/vercel-ai-sdk/src/mem0-utils.ts
+++ b/vercel-ai-sdk/src/mem0-utils.ts
@@ -115,7 +115,8 @@ const searchInternalMemories = async (query: string, config?: Mem0ConfigSettings
}),
};
- const response = await fetch('https://api.mem0.ai/v2/memories/search/', options);
+ const baseUrl = config?.host || 'https://api.mem0.ai';
+ const response = await fetch(`${baseUrl}/v2/memories/search/`, options);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
@@ -160,7 +161,8 @@ const updateMemories = async (messages: Array<Message>, config?: Mem0ConfigSetti
body: JSON.stringify({messages, ...config}),
};
- const response = await fetch('https://api.mem0.ai/v1/memories/', options);
+ const baseUrl = config?.host || 'https://api.mem0.ai';
+ const response = await fetch(`${baseUrl}/v1/memories/`, options);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}