Doc: api_key changes (#2251)

This commit is contained in:
Dev Khant
2025-02-24 10:23:28 +05:30
committed by GitHub
parent edb53209ef
commit 1be0d70d02
6 changed files with 24 additions and 9 deletions

View File

@@ -54,7 +54,7 @@
"features/direct-import", "features/direct-import",
"features/async-client", "features/async-client",
"features/memory-export", "features/memory-export",
"features/webhook" "features/webhooks"
] ]
} }
] ]

View File

@@ -14,13 +14,17 @@ To use the async client, you first need to initialize it:
<CodeGroup> <CodeGroup>
```python Python ```python Python
import os
from mem0 import AsyncMemoryClient from mem0 import AsyncMemoryClient
client = AsyncMemoryClient(api_key="your-api-key")
os.environ["MEM0_API_KEY"] = "your-api-key"
client = AsyncMemoryClient()
``` ```
```javascript JavaScript ```javascript JavaScript
const { MemoryClient } = require('mem0ai'); const { MemoryClient } = require('mem0ai');
const client = new MemoryClient('your-api-key'); const client = new MemoryClient({ apiKey: 'your-api-key'});
``` ```
</CodeGroup> </CodeGroup>

View File

@@ -13,10 +13,12 @@ When a user submits an image, Mem0 processes it to extract textual information a
<CodeGroup> <CodeGroup>
```python Code ```python Code
import os
from mem0 import MemoryClient from mem0 import MemoryClient
# Initialize the MemoryClient with your API key os.environ["MEM0_API_KEY"] = "your-api-key"
client = MemoryClient(api_key="your_api_key_here")
client = MemoryClient()
messages = [ messages = [
{ {

View File

@@ -17,9 +17,12 @@ Create a webhook for your project; it will receive events only from that project
<CodeGroup> <CodeGroup>
```python Python ```python Python
import os
from mem0 import MemoryClient 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 # Create webhook in a specific project
webhook = client.create_webhook( webhook = client.create_webhook(
@@ -33,7 +36,7 @@ print(webhook)
```javascript JavaScript ```javascript JavaScript
const { MemoryClient } = require('mem0ai'); 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 // Create webhook in a specific project
const webhook = await client.createWebhook({ const webhook = await client.createWebhook({

View File

@@ -25,9 +25,11 @@ from langchain_core.tools import StructuredTool
from mem0 import MemoryClient from mem0 import MemoryClient
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from typing import List, Dict, Any, Optional from typing import List, Dict, Any, Optional
import os
os.environ["MEM0_API_KEY"] = "your-api-key"
client = MemoryClient( client = MemoryClient(
api_key=your_api_key,
org_id=your_org_id, org_id=your_org_id,
project_id=your_project_id project_id=your_project_id
) )

View File

@@ -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: Here is an example of how to use Mem0 APIs:
```python ```python
import os
from mem0 import MemoryClient 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 # Store messages
messages = [ messages = [