Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/components/vectordbs/dbs/clickzetta.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[ClickZetta](https://www.singdata.com/) is a cloud-native data lakehouse platform developed by Singdata Technology, supporting vector storage and search capabilities.

### Usage

```python Python
import os
from mem0 import Memory

config = {
"vector_store": {
"provider": "clickzetta",
"config": {
"collection_name": "mem0_memories",
"service": "your-service.clickzetta.com",
"instance": "your-instance",
"workspace": "your-workspace",
"schema": "public",
"username": "your-username",
"password": "your-password",
"vcluster": "default",
"protocol": "http",
}
}
}

m = Memory.from_config(config)
messages = [
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
{"role": "assistant", "content": "How about thriller movies? They can be quite engaging."},
{"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
{"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
m.add(messages, user_id="alice", metadata={"category": "movies"})
```

### Config

Let's see the available parameters for the `clickzetta` config:

| Parameter | Description | Default Value |
| --- | --- | --- |
| `collection_name` | The name of the collection/table to store the vectors | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `service` | ClickZetta service endpoint | Required |
| `instance` | ClickZetta instance name | Required |
| `workspace` | ClickZetta workspace name | Required |
| `schema` | Schema name for the table | Required |
| `username` | Username for authentication | Required |
| `password` | Password for authentication | Required |
| `vcluster` | Virtual cluster name | Required |
| `protocol` | Connection protocol (http/https) | `http` |
| `distance_metric` | Distance metric for similarity search (cosine, euclidean, dot_product) | `cosine` |

### Installation

To use ClickZetta as a vector store, you need to install the ClickZetta connector:

```bash
pip install clickzetta-connector-python
```

Or install with all vector store dependencies:

```bash
pip install mem0ai[vector_stores]
```
36 changes: 36 additions & 0 deletions mem0/configs/vector_stores/clickzetta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from typing import Any, Dict, Literal, Optional
import warnings

from pydantic import BaseModel, ConfigDict, Field, model_validator

# Suppress schema field name warning
warnings.filterwarnings("ignore", message=".*Field name.*schema.*shadows.*")


class ClickzettaConfig(BaseModel):
"""ClickZetta Vector Store Configuration."""

model_config = ConfigDict(populate_by_name=True, protected_namespaces=())

collection_name: str = Field("mem0", description="Collection/table name")
embedding_model_dims: Optional[int] = Field(1536, description="Embedding vector dimensions")
service: str = Field(..., description="ClickZetta service address")
instance: str = Field(..., description="Instance name")
workspace: str = Field(..., description="Workspace name")
schema: str = Field(..., description="Schema name")
username: str = Field(..., description="Username")
password: str = Field(..., description="Password")
vcluster: str = Field(..., description="Virtual cluster name")
protocol: str = Field("http", description="Connection protocol (http/https)")
distance_metric: Literal["cosine", "euclidean", "dot_product"] = Field(
"cosine", description="Distance metric"
)

@model_validator(mode="before")
@classmethod
def validate_required_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:
required_fields = ["service", "instance", "workspace", "schema", "username", "password", "vcluster"]
missing = [f for f in required_fields if not values.get(f)]
if missing:
raise ValueError(f"Missing required fields: {', '.join(missing)}")
return values
1 change: 1 addition & 0 deletions mem0/utils/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class VectorStoreFactory:
"baidu": "mem0.vector_stores.baidu.BaiduDB",
"cassandra": "mem0.vector_stores.cassandra.CassandraDB",
"neptune": "mem0.vector_stores.neptune_analytics.NeptuneAnalyticsVector",
"clickzetta": "mem0.vector_stores.clickzetta.ClickZetta",
}

@classmethod
Expand Down
Loading