diff --git a/docs/overview.mdx b/docs/overview.mdx index 40de6cc1..65c8a73f 100644 --- a/docs/overview.mdx +++ b/docs/overview.mdx @@ -64,7 +64,7 @@ Mem0 offers two powerful ways to leverage our technology: our [managed platform] Integrate Mem0 in a few lines of code - + Mem0 in action diff --git a/docs/platform/quickstart.mdx b/docs/platform/quickstart.mdx index 45272e1e..f4a3c586 100644 --- a/docs/platform/quickstart.mdx +++ b/docs/platform/quickstart.mdx @@ -3,6 +3,10 @@ title: Guide description: 'Get started with Mem0 Platform in minutes' --- + + 🎉 Looking for TypeScript support? Mem0 has you covered! Check out an example [here](/platform/quickstart/#4-11-working-with-mem0-in-typescript). + + ## 1. Installation @@ -1761,6 +1765,52 @@ curl -X DELETE "https://api.mem0.ai/v1/memories/batch/" \ ``` +### 4.11 Working with Mem0 in TypeScript +Manage memories using TypeScript with Mem0. Mem0 has completet TypeScript support Below is an example demonstrating how to add and search memories. + + +```typescript TypeScript +import MemoryClient, { Message, SearchOptions, MemoryOptions } from 'mem0ai'; + +const apiKey = 'your-api-key-here'; +const client = new MemoryClient(apiKey); + +// Messages +const messages: Message[] = [ + { role: "user", content: "Hi, I'm Alex. I'm a vegetarian and I'm allergic to nuts." }, + { role: "assistant", content: "Hello Alex! I've noted that you're a vegetarian and have a nut allergy. I'll keep this in mind for any food-related recommendations or discussions." } +]; + +// ADD +const memoryOptions: MemoryOptions = { + user_id: "alex", + agent_id: "travel-assistant" +} + +client.add(messages, memoryOptions) + .then(result => console.log(result)) + .catch(error => console.error(error)); + +// SEARCH +const query: string = "What do you know about me?"; +const searchOptions: SearchOptions = { + user_id: "alex", + filters: { + OR: [ + { agent_id: "travel-assistant" }, + { user_id: "alex" } + ] + }, + threshold: 0.1, + api_version: 'v2' +} + +client.search(query, searchOptions) +.then(results => console.log(results)) +.catch(error => console.error(error)); +``` + + If you have any questions, please feel free to reach out to us using one of the following methods: \ No newline at end of file diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index e86a0a7c..d3690b94 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -19,6 +19,8 @@ Check out our [Playground](https://mem0.dev/pd-pg) to see Mem0 in action. Our fully managed platform provides a hassle-free way to integrate Mem0's capabilities into your AI agents and assistants. Sign up for Mem0 platform [here](https://mem0.dev/pd). +The Mem0 SDK supports both Python and JavaScript, with full [TypeScript](/platform/quickstart/#4-11-working-with-mem0-in-typescript) support as well. + Follow the steps below to get started with Mem0 Platform: 1. [Install Mem0](#1-install-mem0)