# config

Python API: `luxonis_ml.utils.config`

## Classes

| Name | Description |
| --- | --- |
|
[`LuxonisConfig`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/utils/config.md)
| Class for storing configuration. |

### class `LuxonisConfig`

```python
class LuxonisConfig(BaseModelExtraForbid)
```

Class for storing configuration.

Methods

| Name | Description |
| --- | --- |
|
[`get`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/utils/config.md)
| Return a value from the config based on the given key. |
|
[`get_config`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/utils/config.md)
| Load config from a yaml file or a dictionary. |
|
[`get_json_schema`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/utils/config.md)
| Return the JSON schema of the config. |
|
[`save_data`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/utils/config.md)
| Save the config to a YAML file. |

#### method `get`

```python
def get(key_merged: str, default: Any = None) -> Any
```

Return a value from the config based on the given key.

If the key doesn't exist, the default value is returned.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `key_merged` | `str` | Key as a string with levels separated by dots. | required |
| `default` | `Any` | Default value to return if the key doesn't exist. | `None` |

Returns

| Type | Description |
| --- | --- |
| `Any` | Value of the key, or the default value. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If a list is accessed with a non-integer key. |

#### class method `get_config`

```python
def get_config(
    cfg: PathType | Params | None = None,
    overrides: Params | dict[str, Any] | list[str] | tuple[str, ...] | None = None,
) -> Self
```

Load config from a yaml file or a dictionary.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `cfg` | `PathType | Params | None` | Path to a config file or a dictionary. | `None` |
| `overrides` | `Params | dict[str, Any] | list[str] | tuple[str, ...] | None` | CLI overrides. Can be a dictionary mapping
"dotted" keys to unparsed string or Python values, or a list or a tuple of alternating key-value pairs. | `None` |

Returns

| Type | Description |
| --- | --- |
| `Self` | Instance of the config class. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If neither `cfg` nor `overrides` is provided, or if `overrides` is a list or a tuple with an odd number of items.
|

#### method `get_json_schema`

```python
def get_json_schema() -> Params
```

Return the JSON schema of the config.

> **Deprecated**
> Deprecated since version 0.9.0:Use `model_json_schema(mode='validation')` instead.

Returns

| Type | Description |
| --- | --- |
| `Params` | Dictionary with the JSON schema. |

#### method `save_data`

```python
def save_data(path: PathType)
```

Save the config to a YAML file.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `path` | `PathType` | Path to the file where the config should be saved. | required |

## Module Attributes

| Name | Description |
| --- | --- |
|
[`T`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/utils/config.md)
| |

### type variable `T`

```python
T = TypeVar('T', bound='LuxonisConfig')
```
