import { Memory } from "mem0ai/oss";
// Authenticate with GOOGLE_APPLICATION_CREDENTIALS in your environment,
// or pass credentialsPath / serviceAccountJson in the config below.
const config = {
vectorStore: {
provider: "vertex_ai_vector_search",
config: {
endpointId: "YOUR_ENDPOINT_ID", // Required: Vector Search endpoint ID
indexId: "YOUR_INDEX_ID", // Required: Vector Search index ID
deploymentIndexId: "YOUR_DEPLOYMENT_INDEX_ID", // Required: Deployment-specific ID
projectId: "YOUR_PROJECT_ID", // Required: Google Cloud project ID
projectNumber: "YOUR_PROJECT_NUMBER", // Required: Google Cloud project number
region: "YOUR_REGION", // Required: Google Cloud region
credentialsPath: "path/to/credentials.json", // Optional: defaults to GOOGLE_APPLICATION_CREDENTIALS
vectorSearchApiEndpoint: "YOUR_API_ENDPOINT", // Required for search/get operations
},
},
};
const memory = new Memory(config);
await memory.add("Your text here", {
userId: "user",
metadata: { category: "example" },
});