import { Memory } from "mem0ai/oss"; const memory = new Memory({ version: "v1.1", embedder: { provider: "openai", config: { baseURL: "https://api.siliconflow.cn/v1/", apiKey: "sk-tnynjffzcdudlflrydljyxttorrtstpviyuodnyuyyalzfan", model: "BAAI/bge-m3" } }, llm: { provider: "openai", config: { baseURL: "https://api.siliconflow.cn/v1/", apiKey: "sk-tnynjffzcdudlflrydljyxttorrtstpviyuodnyuyyalzfan", model: "Qwen/Qwen2.5-7B-Instruct" } }, vectorStore: { provider: "memory", config: { collectionName: "memories", dimension: 1024 } }, historyDbPath: "./memory.db" }) const messages = [ { role: "user", content: "I'm planning to watch a movie tonight. Any recommendations?" }, { role: "assistant", content: "How about thriller movies? They can be quite engaging." }, { role: "user", content: "I'm not a big fan of thriller movies but I love sci-fi movies." }, { role: "assistant", content: "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future." } ]; try { const insertContent = await memory.add(messages, {"userId": "huyang", metadata: { category: "movie_recommendations" }}) if (insertContent) { console.log( "Insert Ok...", "\r\n", insertContent.results ) } else { console.log( "Insert Error" ) } }catch (e) { console.log(e) }