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:
Archie Sengupta
2025-08-17 16:21:06 +05:30
committed by GitHub
co-authored by Saket Aryan
parent a6a3928091
commit 8e8f13a48e
4 changed files with 11 additions and 3 deletions
+1
View File
@@ -26,6 +26,7 @@ export interface Mem0ConfigSettings {
threshold?: number;
rerank?: boolean;
enable_graph?: boolean;
host?: string;
output_format?: string;
filter_memories?: boolean;
}
+4 -2
View File
@@ -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}`);
}