From 1be0d70d02a61ae17d03898f9ad2cf7b2f721926 Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Mon, 24 Feb 2025 10:23:28 +0530 Subject: [PATCH] Doc: api_key changes (#2251) --- docs/docs.json | 2 +- docs/features/async-client.mdx | 8 ++++++-- docs/features/multimodal-support.mdx | 6 ++++-- docs/features/{webhook.mdx => webhooks.mdx} | 7 +++++-- docs/integrations/langchain-tools.mdx | 4 +++- docs/open-source/quickstart.mdx | 6 +++++- 6 files changed, 24 insertions(+), 9 deletions(-) rename docs/features/{webhook.mdx => webhooks.mdx} (97%) diff --git a/docs/docs.json b/docs/docs.json index 51767a49..d4d92435 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -54,7 +54,7 @@ "features/direct-import", "features/async-client", "features/memory-export", - "features/webhook" + "features/webhooks" ] } ] diff --git a/docs/features/async-client.mdx b/docs/features/async-client.mdx index 18de6ed7..c520ba88 100644 --- a/docs/features/async-client.mdx +++ b/docs/features/async-client.mdx @@ -14,13 +14,17 @@ To use the async client, you first need to initialize it: ```python Python +import os from mem0 import AsyncMemoryClient -client = AsyncMemoryClient(api_key="your-api-key") + +os.environ["MEM0_API_KEY"] = "your-api-key" + +client = AsyncMemoryClient() ``` ```javascript JavaScript const { MemoryClient } = require('mem0ai'); -const client = new MemoryClient('your-api-key'); +const client = new MemoryClient({ apiKey: 'your-api-key'}); ``` diff --git a/docs/features/multimodal-support.mdx b/docs/features/multimodal-support.mdx index 7bf913de..a93a7591 100644 --- a/docs/features/multimodal-support.mdx +++ b/docs/features/multimodal-support.mdx @@ -13,10 +13,12 @@ When a user submits an image, Mem0 processes it to extract textual information a ```python Code +import os from mem0 import MemoryClient -# Initialize the MemoryClient with your API key -client = MemoryClient(api_key="your_api_key_here") +os.environ["MEM0_API_KEY"] = "your-api-key" + +client = MemoryClient() messages = [ { diff --git a/docs/features/webhook.mdx b/docs/features/webhooks.mdx similarity index 97% rename from docs/features/webhook.mdx rename to docs/features/webhooks.mdx index abadc946..8994d490 100644 --- a/docs/features/webhook.mdx +++ b/docs/features/webhooks.mdx @@ -17,9 +17,12 @@ Create a webhook for your project; it will receive events only from that project ```python Python +import os from mem0 import MemoryClient -client = MemoryClient(api_key="your-api-key") +os.environ["MEM0_API_KEY"] = "your-api-key" + +client = MemoryClient() # Create webhook in a specific project webhook = client.create_webhook( @@ -33,7 +36,7 @@ print(webhook) ```javascript JavaScript const { MemoryClient } = require('mem0ai'); -const client = new MemoryClient('your-api-key'); +const client = new MemoryClient({ apiKey: 'your-api-key'}); // Create webhook in a specific project const webhook = await client.createWebhook({ diff --git a/docs/integrations/langchain-tools.mdx b/docs/integrations/langchain-tools.mdx index e1194549..9edfa31c 100644 --- a/docs/integrations/langchain-tools.mdx +++ b/docs/integrations/langchain-tools.mdx @@ -25,9 +25,11 @@ from langchain_core.tools import StructuredTool from mem0 import MemoryClient from pydantic import BaseModel, Field from typing import List, Dict, Any, Optional +import os + +os.environ["MEM0_API_KEY"] = "your-api-key" client = MemoryClient( - api_key=your_api_key, org_id=your_org_id, project_id=your_project_id ) diff --git a/docs/open-source/quickstart.mdx b/docs/open-source/quickstart.mdx index 26df8173..50d71aca 100644 --- a/docs/open-source/quickstart.mdx +++ b/docs/open-source/quickstart.mdx @@ -426,8 +426,12 @@ Get started with using Mem0 APIs in your applications. For more details, refer t Here is an example of how to use Mem0 APIs: ```python +import os from mem0 import MemoryClient -client = MemoryClient(api_key="your-api-key") # get api_key from https://app.mem0.ai/ + +os.environ["MEM0_API_KEY"] = "your-api-key" + +client = MemoryClient() # get api_key from https://app.mem0.ai/ # Store messages messages = [