> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.storages.vectordb storages.oceanbase

<a id="camel.storages.vectordb_storages.oceanbase" />

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage" />

## OceanBaseStorage

```python theme={"system"}
class OceanBaseStorage(BaseVectorStorage):
```

An implementation of the `BaseVectorStorage` for interacting with
OceanBase Vector Database.

**Parameters:**

* **vector\_dim** (int): The dimension of storing vectors.
* **table\_name** (str): Name for the table in OceanBase.
* **uri** (str): Connection URI for OceanBase (host:port). (default: :obj:`"127.0.0.1:2881"`)
* **user** (str): Username for connecting to OceanBase. (default: :obj:`"root@test"`)
* **password** (str): Password for the user. (default: :obj:`""`) (default: `""`)
* **db\_name** (str): Database name in OceanBase. (default: :obj:`"test"`)
* **distance** (`Literal["l2", "cosine"], optional`): The distance metric for vector comparison. Options: "l2", "cosine". (default: :obj:`"l2"`)
* **delete\_table\_on\_del** (bool, optional): Flag to determine if the table should be deleted upon object destruction. (default: :obj:`False`) \*\*kwargs (Any): Additional keyword arguments for initializing `ObVecClient`.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    vector_dim: int,
    table_name: str,
    uri: str = '127.0.0.1:2881',
    user: str = 'root@test',
    password: str = '',
    db_name: str = 'test',
    distance: Literal['l2', 'cosine'] = 'l2',
    delete_table_on_del: bool = False,
    **kwargs: Any
):
```

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.__del__" />

### **del**

```python theme={"system"}
def __del__(self):
```

Deletes the table if :obj:`delete_table_on_del` is set to
:obj:`True`.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.add" />

### add

```python theme={"system"}
def add(
    self,
    records: List[VectorRecord],
    batch_size: int = 100,
    **kwargs: Any
):
```

Saves a list of vector records to the storage.

**Parameters:**

* **records** (List\[VectorRecord]): List of vector records to be saved.
* **batch\_size** (int): Number of records to insert each batch. Larger batches are more efficient but use more memory. (default: :obj:`100`) \*\*kwargs (Any): Additional keyword arguments.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.delete" />

### delete

```python theme={"system"}
def delete(self, ids: List[str], **kwargs: Any):
```

Deletes a list of vectors identified by their IDs from the storage.

**Parameters:**

* **ids** (List\[str]): List of unique identifiers for the vectors to be deleted. \*\*kwargs (Any): Additional keyword arguments.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.status" />

### status

```python theme={"system"}
def status(self):
```

**Returns:**

VectorDBStatus: The vector database status.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.query" />

### query

```python theme={"system"}
def query(self, query: VectorDBQuery, **kwargs: Any):
```

Searches for similar vectors in the storage based on the
provided query.

**Parameters:**

* **query** (VectorDBQuery): The query object containing the search vector and the number of top similar vectors to retrieve. \*\*kwargs (Any): Additional keyword arguments.

**Returns:**

List\[VectorDBQueryResult]: A list of vectors retrieved from the
storage based on similarity to the query vector.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage._convert_distance_to_similarity" />

### \_convert\_distance\_to\_similarity

```python theme={"system"}
def _convert_distance_to_similarity(self, distance: float):
```

Converts distance to similarity score based on distance metric.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.clear" />

### clear

```python theme={"system"}
def clear(self):
```

Remove all vectors from the storage.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.load" />

### load

```python theme={"system"}
def load(self):
```

Load the collection hosted on cloud service.

<a id="camel.storages.vectordb_storages.oceanbase.OceanBaseStorage.client" />

### client

```python theme={"system"}
def client(self):
```

Provides access to underlying OceanBase vector database client.
