AI SDK Updates (#2470)
This commit is contained in:
@@ -56,12 +56,23 @@ mode: "wide"
|
||||
|
||||
<Tab title="TypeScript">
|
||||
|
||||
<Update label="2025-03-29" description="AI SDK v1.0.0">
|
||||
**New Features:**
|
||||
- **Vercel AI SDK Update:** Support threshold and rerank
|
||||
|
||||
**Improvements:**
|
||||
- **Made add calls async to avoid blocking**
|
||||
- **Bump `mem0ai` to use `2.1.12`**
|
||||
|
||||
</Update>
|
||||
|
||||
<Update label="2025-03-26" description="v2.1.12">
|
||||
**New Features:**
|
||||
- **Vercel AI SDK Update:** Support for tools call
|
||||
- **Mem0 OSS:** Support infer param
|
||||
|
||||
**Improvements:**
|
||||
- **Updated Supabase TS Docs**
|
||||
- **Made package size smaller**
|
||||
|
||||
</Update>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mem0/vercel-ai-provider",
|
||||
"version": "0.0.14",
|
||||
"version": "1.0.0",
|
||||
"description": "Vercel AI Provider for providing memory to LLMs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -34,7 +34,7 @@
|
||||
"@ai-sdk/provider-utils": "2.1.10",
|
||||
"ai": "4.1.46",
|
||||
"dotenv": "^16.4.5",
|
||||
"mem0ai": "^1.0.29",
|
||||
"mem0ai": "^2.1.12",
|
||||
"partial-json": "0.1.7",
|
||||
"zod": "^3.0.0"
|
||||
},
|
||||
@@ -66,5 +66,12 @@
|
||||
"directories": {
|
||||
"example": "example",
|
||||
"test": "tests"
|
||||
},
|
||||
"packageManager": "pnpm@10.5.2+sha512.da9dc28cd3ff40d0592188235ab25d3202add8a207afbedc682220e4a0029ffbff4562102b9e6e46b4e3f9e8bd53e6d05de48544b0c57d4b0179e22c76d1199b",
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"esbuild",
|
||||
"sqlite3"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
5697
vercel-ai-sdk/pnpm-lock.yaml
generated
Normal file
5697
vercel-ai-sdk/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -31,9 +31,14 @@ export class Mem0GenericLanguageModel implements LanguageModelV1 {
|
||||
provider: string;
|
||||
|
||||
private async processMemories(messagesPrompts: LanguageModelV1Message[], mem0Config: Mem0ConfigSettings) {
|
||||
const memories = await getMemories(messagesPrompts, mem0Config);
|
||||
// Add New Memories
|
||||
await addMemories(messagesPrompts, mem0Config);
|
||||
addMemories(messagesPrompts, mem0Config).then((res) => {
|
||||
return res;
|
||||
});
|
||||
|
||||
// Get Memories
|
||||
const memories = await getMemories(messagesPrompts, mem0Config);
|
||||
|
||||
const mySystemPrompt = "These are the memories I have stored. Give more weightage to the question by users and try to answer that first. You have to modify your answer based on the memories I have provided. If the memories are irrelevant you can ignore them. Also don't reply to this section of the prompt, or the memories, they are only for your reference. The System prompt starts after text System Message: \n\n";
|
||||
|
||||
let memoriesText = "";
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface Mem0ConfigSettings {
|
||||
page_size?: number;
|
||||
mem0ApiKey?: string;
|
||||
top_k?: number;
|
||||
threshold?: number;
|
||||
rerank?: boolean;
|
||||
}
|
||||
|
||||
export interface Mem0ChatConfig extends Mem0ConfigSettings, Mem0ProviderSettings {}
|
||||
|
||||
@@ -71,7 +71,7 @@ const searchInternalMemories = async (query: string, config?: Mem0ConfigSettings
|
||||
environmentVariableName: "MEM0_API_KEY",
|
||||
description: "Mem0",
|
||||
})}`, 'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({query, filters, top_k: config&&config.top_k || top_k, version: "v2", ...org_project_filters}),
|
||||
body: JSON.stringify({query, filters, ...config, top_k: config&&config.top_k || top_k, version: "v2", ...org_project_filters}),
|
||||
};
|
||||
const response = await fetch('https://api.mem0.ai/v2/memories/search/', options);
|
||||
const data = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user