Added Mastra Example (#2473)

This commit is contained in:
Saket Aryan
2025-03-31 00:26:00 +05:30
committed by GitHub
parent fe7b336922
commit e3f460fba4
3 changed files with 141 additions and 1 deletions

View File

@@ -10,7 +10,6 @@ The [**Mem0 AI SDK Provider**](https://www.npmjs.com/package/@mem0/vercel-ai-pro
## Overview
In this guide, we'll create a Travel Agent AI that:
1. 🧠 Offers persistent memory storage for conversational AI
2. 🔄 Enables smooth integration with the Vercel AI SDK
3. 🚀 Ensures compatibility with multiple LLM providers
@@ -191,6 +190,20 @@ npm install @mem0/vercel-ai-provider
console.log(result);
```
### 5. Get sources from memory
```typescript
const { text, sources } = await generateText({
model: mem0("gpt-4-turbo"),
prompt: "Suggest me a good car to buy!",
});
console.log(sources);
```
The same can be done for `streamText` as well.
## Key Features
- `createMem0()`: Initializes a new Mem0 provider instance.