Added Missing Param in AI SDK and Updated Demo Application (#2667)

This commit is contained in:
Saket Aryan
2025-05-12 04:22:23 +05:30
committed by GitHub
parent caeae60dda
commit 10acf78618
8 changed files with 14 additions and 28 deletions

View File

@@ -487,6 +487,11 @@ mode: "wide"
<Tab title="Vercel AI SDK">
<Update label="2025-05-10" description="v1.0.4">
**New Features:**
- **Vercel AI SDK:** Added support for new param `output_format`.
</Update>
<Update label="2025-05-08" description="v1.0.3">
**Improvements:**
- **Vercel AI SDK:** Added support for graceful failure in cases services are down.

View File

@@ -16,7 +16,7 @@ You can create a personalized AI Companion using Mem0. This guide will walk you
src="https://github.com/user-attachments/assets/cebc4f8e-bdb9-4837-868d-13c5ab7bb433"
></video>
You can try the [Mem0 Demo](https://mem0.dev/demo) live here.
You can try the [Mem0 Demo](https://mem0-4vmi.vercel.app) live here.
## Overview

View File

@@ -70,7 +70,7 @@ const retrieveMemories = (memories: any) => {
export async function POST(req: Request) {
const { messages, system, tools, userId } = await req.json();
const memories = await getMemories(messages, { user_id: userId, rerank: true, threshold: 0.1 });
const memories = await getMemories(messages, { user_id: userId, rerank: true, threshold: 0.1, output_format: "v1.0" });
const mem0Instructions = retrieveMemories(memories);
const result = streamText({

View File

@@ -45,7 +45,7 @@ const useUserId = () => {
export const Assistant = () => {
const { userId, resetUserId } = useUserId();
const runtime = useChatRuntime({
api: "https://demo.mem0.ai/api/chat",
api: "/api/chat",
body: { userId },
});
@@ -91,8 +91,8 @@ export const Assistant = () => {
</button>
<GithubButton url="https://github.com/mem0ai/mem0/tree/main/examples" />
<Link href={"https://app.mem0.ai/"} target="_blank" className="py-2 ml-2 px-4 font-semibold dark:bg-zinc-100 dark:hover:bg-zinc-200 bg-zinc-800 text-white rounded-full hover:bg-zinc-900 dark:text-[#475569]">
Save Memories
<Link href={"https://app.mem0.ai/"} target="_blank" className="py-1 ml-2 px-4 font-semibold dark:bg-zinc-100 dark:hover:bg-zinc-200 bg-zinc-800 text-white rounded-full hover:bg-zinc-900 dark:text-[#475569]">
Playground
</Link>
</div>
</header>

View File

@@ -2,24 +2,6 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
assetPrefix: "https://demo.mem0.ai",
images: {
path: "https://demo.mem0.ai",
},
async headers() {
return [
{
// matching all API routes
source: "/api/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" },
{ key: "Access-Control-Allow-Methods", value: "GET,DELETE,PATCH,POST,PUT" },
{ key: "Access-Control-Allow-Headers", value: "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" },
]
}
]
}
};
export default nextConfig;

View File

@@ -13,7 +13,7 @@
"@assistant-ui/react": "^0.8.2",
"@assistant-ui/react-ai-sdk": "^0.8.0",
"@assistant-ui/react-markdown": "^0.8.0",
"@mem0/vercel-ai-provider": "^1.0.0",
"@mem0/vercel-ai-provider": "^1.0.4",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-popover": "^1.1.6",

View File

@@ -1,6 +1,6 @@
{
"name": "@mem0/vercel-ai-provider",
"version": "1.0.3",
"version": "1.0.4",
"description": "Vercel AI Provider for providing memory to LLMs",
"main": "./dist/index.js",
"module": "./dist/index.mjs",

View File

@@ -2,9 +2,7 @@ import { Mem0ProviderSettings } from "./mem0-provider";
import { OpenAIChatSettings } from "@ai-sdk/openai/internal";
import { AnthropicMessagesSettings } from "@ai-sdk/anthropic/internal";
import {
LanguageModelV1,
LanguageModelV1CallOptions,
LanguageModelV1Message,
LanguageModelV1
} from "@ai-sdk/provider";
export type Mem0ChatModelId =
@@ -29,6 +27,7 @@ export interface Mem0ConfigSettings {
threshold?: number;
rerank?: boolean;
enable_graph?: boolean;
output_format?: string;
}
export interface Mem0ChatConfig extends Mem0ConfigSettings, Mem0ProviderSettings {}