feat(Vercel AI SDK): add a param in config called host (#2634)
Co-authored-by: Saket Aryan <94069182+whysosaket@users.noreply.github.com>
This commit is contained in:
co-authored by
Saket Aryan
parent
a6a3928091
commit
8e8f13a48e
@@ -990,6 +990,11 @@ mode: "wide"
|
|||||||
|
|
||||||
<Tab title="Vercel AI SDK">
|
<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">
|
<Update label="2025-08-05" description="v2.0.0">
|
||||||
**New Features:**
|
**New Features:**
|
||||||
- **Vercel AI SDK:** Migration to AI SDK V5.
|
- **Vercel AI SDK:** Migration to AI SDK V5.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mem0/vercel-ai-provider",
|
"name": "@mem0/vercel-ai-provider",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"description": "Vercel AI Provider for providing memory to LLMs",
|
"description": "Vercel AI Provider for providing memory to LLMs",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export interface Mem0ConfigSettings {
|
|||||||
threshold?: number;
|
threshold?: number;
|
||||||
rerank?: boolean;
|
rerank?: boolean;
|
||||||
enable_graph?: boolean;
|
enable_graph?: boolean;
|
||||||
|
host?: string;
|
||||||
output_format?: string;
|
output_format?: string;
|
||||||
filter_memories?: boolean;
|
filter_memories?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
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}),
|
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) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP error! status: ${response.status}`);
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user