feat: add Google Vertex AI Vector Search support to vector store factory (#5791)

Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
Co-authored-by: divyansh-1009 <divyansh-1009@users.noreply.github.com>
This commit is contained in:
Div
2026-07-06 22:54:24 +05:30
committed by GitHub
parent 7fb3feb5cd
commit 2bc2f763d9
8 changed files with 813 additions and 3 deletions
+49 -3
View File
@@ -8,8 +8,8 @@ description: "Use Google Cloud Vertex AI Vector Search as a managed vector store
To use Google Cloud Vertex AI Vector Search with `mem0`, you need to configure the `vector_store` in your `mem0` config:
```python
<CodeGroup>
```python Python
import os
from mem0 import Memory
@@ -20,7 +20,7 @@ config = {
"provider": "vertex_ai_vector_search",
"config": {
"endpoint_id": "YOUR_ENDPOINT_ID", # Required: Vector Search endpoint ID
"index_id": "YOUR_INDEX_ID", # Required: Vector Search index ID
"index_id": "YOUR_INDEX_ID", # Required: Vector Search index ID
"deployment_index_id": "YOUR_DEPLOYMENT_INDEX_ID", # Required: Deployment-specific ID
"project_id": "YOUR_PROJECT_ID", # Required: Google Cloud project ID
"project_number": "YOUR_PROJECT_NUMBER", # Required: Google Cloud project number
@@ -34,9 +34,40 @@ m = Memory.from_config(config)
m.add("Your text here", user_id="user", metadata={"category": "example"})
```
```typescript TypeScript
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" },
});
```
</CodeGroup>
### Required Parameters
<Tabs>
<Tab title="Python">
| Parameter | Description | Required |
|-----------|-------------|----------|
| `endpoint_id` | Vector Search endpoint ID | Yes |
@@ -48,3 +79,18 @@ m.add("Your text here", user_id="user", metadata={"category": "example"})
| `region` | Google Cloud region | Yes |
| `credentials_path` | Path to service account credentials | No (defaults to GOOGLE_APPLICATION_CREDENTIALS) |
| `service_account_json` | Service account credentials as a dictionary (alternative to `credentials_path`) | `None` |
</Tab>
<Tab title="TypeScript">
| Parameter | Description | Required |
|-----------|-------------|----------|
| `endpointId` | Vector Search endpoint ID | Yes |
| `indexId` | Vector Search index ID | Yes |
| `deploymentIndexId` | Deployment-specific index ID | Yes |
| `projectId` | Google Cloud project ID | Yes |
| `projectNumber` | Google Cloud project number | Yes |
| `vectorSearchApiEndpoint` | Vector search API endpoint | Yes (for get operations) |
| `region` | Google Cloud region | Yes |
| `credentialsPath` | Path to service account credentials | No (defaults to GOOGLE_APPLICATION_CREDENTIALS) |
| `serviceAccountJson` | Service account credentials as an object (alternative to `credentialsPath`) | No |
</Tab>
</Tabs>