> ## 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` if the index has been trained, enabling efficient approximate nearest neighbor search. An untrained index will default to exhaustive search.

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

### Returns

`bool`: `True` if the index has been trained; otherwise, `False`.

### 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().")
```

***

## 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 (e.g., `ivf`, `ivfpq`, `ivfflat`, `ivfsq`).

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

### Returns

| Return Type | Description                |
| ----------- | -------------------------- |
| `str`       | Type of the current index. |

### 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 (e.g., 'ivf', 'ivfpq', 'ivfflat', 'ivfsq')
* `n_lists`: The number of inverted lists in the index
* `pq_dim`: The PQ dimension (if applicable)
* `pq_bits`: The PQ bits (if applicable)
* `sq_bits`: The SQ bits (if applicable)

### 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) -> int
```

### Returns

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

### 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) -> List[str]
```

### Returns

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

### 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}")
```
