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

# Getter Functions

## is\_trained

Returns `True` only when training is **complete**, enabling efficient approximate nearest neighbor search. An untrained index defaults to exhaustive search.

```python theme={null}
def is_trained(self) -> bool
```

### Returns

`bool`: `True` only when the index is fully trained; otherwise, `False`.

<Note>`is_trained()` returns `False` while a (re)train rebuild is in progress. During that window, queries transparently fall back to the untrained (exhaustive) search path. To distinguish "untrained" from "currently (re)training", use [`is_training()`](#is_training) or [`training_state()`](#training_state).</Note>

### Example Usage

```python theme={null}
# Check if index is trained
if index.is_trained():
    print("The index is ready for efficient querying.")
else:
    print("The index is not trained; consider calling train().")
```

***

## is\_training

Returns `True` while a (re)train rebuild is in progress. While this is `True`, [`is_trained()`](#is_trained) returns `False` and queries fall back to exhaustive search.

```python theme={null}
def is_training(self) -> bool
```

### Returns

`bool`: `True` if a training rebuild is currently running; otherwise, `False`.

### Example Usage

```python theme={null}
if index.is_training():
    print("A training rebuild is in progress; queries use exhaustive search for now.")
```

***

## training\_state

Returns the current training state of the index as a string.

```python theme={null}
def training_state(self) -> str
```

### Returns

`str`: One of `"untrained"`, `"training"`, or `"trained"`.

### Example Usage

```python theme={null}
state = index.training_state()
print(f"Training state: {state}")  # "untrained" | "training" | "trained"
```

***

## index\_name

Retrieves the name of the current index.

```python theme={null}
def index_name(self) -> str
```

### Returns

`str`: Name of the currently loaded or created index.

### Example Usage

```python theme={null}
# Retrieve the index name
print("Current index name:", index.index_name())
```

***

## index\_type

Returns the type of the current index. CyborgDB indexes are DiskIVF indexes, so this returns `"disk_ivf"`.

```python theme={null}
def index_type(self) -> str
```

### Returns

| Return Type | Description                               |
| ----------- | ----------------------------------------- |
| `str`       | Type of the current index (`"disk_ivf"`). |

### Example Usage

```python theme={null}
# Retrieve the type of index
print("Index type:", index.index_type())
```

***

## index\_config

Retrieves the configuration details of the current index.

```python theme={null}
def index_config(self) -> dict
```

### Returns

`dict`: A dictionary containing the configuration of the index with the following keys:

* `dimension`: The dimensionality of the vectors
* `metric`: The distance metric used (e.g., `'euclidean'`, `'cosine'`)
* `index_type`: The type of the index (`'disk_ivf'`)
* `n_lists`: The number of inverted lists in the index

### Example Usage

```python theme={null}
# Retrieve index config
config = index.index_config()
print(f"Dimension: {config['dimension']}")
print(f"Metric: {config['metric']}")
print(f"Index type: {config['index_type']}")
```

***

## n\_lists

Returns the number of inverted lists in the index. This property is set during training and initially defaults to 1.

```python theme={null}
@property
def n_lists(self) -> int
```

### Returns

`int`: The number of inverted lists in the index.

### Example Usage

```python theme={null}
# Access the n_lists property
num_lists = index.n_lists
print(f"Index has {num_lists} inverted lists")
```

***

## dimension

Returns the dimensionality of the vectors in the index.

```python theme={null}
@property
def dimension(self) -> int
```

### Returns

`int`: The dimensionality of the vectors.

### Example Usage

```python theme={null}
# Access the dimension property
vector_dim = index.dimension
print(f"Vector dimension: {vector_dim}")
```

***

## metric

Returns the distance metric used by the index.

```python theme={null}
@property
def metric(self) -> str
```

### Returns

`str`: The distance metric used (e.g., `"euclidean"`, `"cosine"`, `"squared_euclidean"`).

### Example Usage

```python theme={null}
# Access the metric property
dist_metric = index.metric
print(f"Distance metric: {dist_metric}")
```

***

## get\_num\_vectors

Returns the number of vectors currently stored in the index.

```python theme={null}
def get_num_vectors(self,
                    *,
                    index_key: bytes = None,
                    user_id: bytes = None) -> int
```

### Returns

`int`: The number of vectors in the index.

<Note>The simple call reuses the key supplied at `create_index()` / `load_index()`. Pass `index_key=` (and `user_id=` for an [RBAC user](./encrypted-index/manage-users)) to override the per-operation key in stateless/service deployments.</Note>

### Example Usage

```python theme={null}
# Get the number of vectors in the index
num_vectors = index.get_num_vectors()
print(f"The index contains {num_vectors} vectors.")
```

***

## list\_ids

Lists all item IDs currently stored in the index.

```python theme={null}
def list_ids(self,
             *,
             index_key: bytes = None,
             user_id: bytes = None) -> List[str]
```

### Returns

`List[str]`: A list containing all item IDs in the index.

<Note>The simple call reuses the key supplied at `create_index()` / `load_index()`. Pass `index_key=` (and `user_id=` for an [RBAC user](./encrypted-index/manage-users)) to override the per-operation key in stateless/service deployments.</Note>

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    * Throws if the index was not created or loaded yet.
    * Throws if an error occurs during retrieval.
  </Accordion>
</AccordionGroup>

### Example Usage

```python theme={null}
# List all IDs in the index
all_ids = index.list_ids()
print(f"Total items in index: {len(all_ids)}")

# Print first 10 IDs
for id in all_ids[:10]:
    print(f"ID: {id}")
```
