# hubai_utils

Python API: `modelconverter.utils.hubai_utils`

Resolve HubAI model slugs to one deployable benchmark instance.

## Classes

| Name | Description |
| --- | --- |
| [`ResolvedHubAIModel`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/hubai_utils.md#hubai_utils-Classes-ResolvedHubAIModel) | A benchmark model pinned to one HubAI instance. |

### class `ResolvedHubAIModel`

```python
class ResolvedHubAIModel
```

A benchmark model pinned to one HubAI instance.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `instance` | `ModelInstanceResponse` |  |
| `model_name` | `str` |  |
| `slug` | `str` |  |
| `variant_slug` | `str` |  |

## Functions

| Name | Description |
| --- | --- |
| [`create_hubai_client`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/hubai_utils.md#hubai_utils-Functions-create_hubai_client) | Create an SDK client using the ModelConverter HubAI settings. |
| [`is_hubai_model_variant_available`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/hubai_utils.md#hubai_utils-Functions-is_hubai_model_variant_available) | Return whether an accessible model has this variant slug. |
| [`resolve_hubai_benchmark_model`](https://docs.luxonis.com/software-v3/ai-inference/conversion/rvc-conversion/offline/modelconverter/modelconverter-api-reference/utils/hubai_utils.md#hubai_utils-Functions-resolve_hubai_benchmark_model) | Resolve a HubAI benchmark slug to exactly one platform instance. |

### function `create_hubai_client`

```python
def create_hubai_client() -> HubAIClient
```

Create an SDK client using the ModelConverter HubAI settings.

### function `is_hubai_model_variant_available`

```python
def is_hubai_model_variant_available(model_identifier: str, model_variant: str) -> bool
```

Return whether an accessible model has this variant slug.

### function `resolve_hubai_benchmark_model`

```python
def resolve_hubai_benchmark_model(identifier: str, platform: str) -> ResolvedHubAIModel
```

Resolve a HubAI benchmark slug to exactly one platform instance.

The SDK first resolves `[team/]model`. An unqualified model name must identify one visible model. Selection then follows these
rules:

 * `model`: require exactly one distinct variant slug, then search all its versions for instances deployable to `platform`.
 * `model:variant`: search all versions of that variant for instances deployable to `platform`.
 * `model:variant:version`: search only the exact version. The third segment is a version only if it contains exactly three
   integer SemVer components (`major.minor.patch`), without a prerelease or build suffix.
 * `model:variant:hash`: search all variant versions for an instance with that full or seven-character short MD5 hash. Any third
   segment that is not SemVer is interpreted as a hash.

Every search must find exactly one matching platform instance. Precision and creation time never break ties. The returned slug
includes the resolved team, variant, and full instance hash so the subsequent DepthAI download requests that selected artifact.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `identifier` | `str` | HubAI model slug in one of the forms above. | required |
| `platform` | `str` | Benchmark target, such as `RVC2` or `RVC4`. | required |

Returns

| Type | Description |
| --- | --- |
| `ResolvedHubAIModel` | The pinned download slug and selected SDK instance metadata. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the slug is invalid, a variant or instance is missing or ambiguous, or a complete result cannot be established from the SDK lists. |
