# GenAIContainerable

- *class* qairt.gen\_ai\_api.containers.gen\_ai\_containerable.GenAIContainerable

    - Bases: `ABC`

Final product of a GenAIBuilder constitutes all assets required for completing a generative AI task.

- *classmethod* load(*path: str | os.PathLike*) → [GenAIContainerable](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_containerable.GenAIContainerable)

    - Load a container from disk by inspecting its manifest.

Reads `metadata.json` inside *path* to determine the concrete
container type, then delegates to the appropriate subclass via the
container factory. Subclasses that override this method perform the
actual deserialization; this base implementation acts as a
manifest-aware dispatch entry point.

- Parameters

    - **path** – Path to load a previously serialized container from.

- Returns

    - Newly created instance of the appropriate subclass.

- *abstract* save(*dest: str | os.PathLike*, *\**, *exist\_ok: bool = False*)

    - Serialize container to disk.

Copies artifacts into the destination directory and updates any
configurations accordingly.

- Parameters

    - - **dest** – Path to save the artifacts.
- **exist\_ok** – If True, raise an exception if an artifact already
exists.

# GenAIContainer

Generic base class for GenAI model containers.

- *class* qairt.gen\_ai\_api.containers.gen\_ai\_container.ContainerMetadata(*\*args: Any*, *\*\*kwargs: Any*)

    - Bases: `AISWBaseModel`

Container metadata for serialization/deserialization.

The `manifest` field identifies the concrete container class that
produced this directory so that
`load_container()`
can dispatch to the correct `load()` implementation without any
caller-side knowledge of the container type.

- backend*: [BackendType](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.common.BackendType)*

    - 

- manifest*: ContainerManifest*

    -

- *class* qairt.gen\_ai\_api.containers.gen\_ai\_container.GenAIContainer(*backend: [BackendType](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.common.BackendType)*, *\**, *backend\_extensions\_config: Optional[Dict] = None*)

    - Bases: [`GenAIContainerable`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_containerable.GenAIContainerable)

Generic base class for GenAI model containers.

Provides the common on-disk infrastructure shared by all container types:

- `metadata.json` — [`ContainerMetadata`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_container.ContainerMetadata) (backend + manifest)
- `backend_extensions.json` — optional backend-extensions configuration

Concrete subclasses (e.g.
[`LLMContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.llm_container.LLMContainer),
`VisionEncoderContainer`)
call `super().save()` to write the common files and then append their
own model-specific artifacts.  For loading, subclasses call
`_load_common()` to retrieve the shared fields and then construct
their own instance.

- *property* backend*: [BackendType](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.common.BackendType)*

    - The backend this container was built for.

- *property* backend\_extensions\_config*: Optional[Dict]*

    - Optional backend-extensions configuration dict.

- *classmethod* load(*path: str | os.PathLike*) → [GenAIContainer](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_container.GenAIContainer)

    - Load a container from *path*.

Subclasses must override this method.  The base implementation raises
`NotImplementedError` to prevent accidental use of the generic
base class for loading.

- Parameters

    - **path** – Directory produced by a previous call to [`save()`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_container.GenAIContainer.save).

- Raises

    - **NotImplementedError** – Always — use a concrete subclass.

- save(*dest: str | os.PathLike*, *\**, *exist\_ok: bool = False*)

    - Write the common container files to *dest*.

Creates the destination directory, writes `metadata.json` and
(when present) `backend_extensions.json`.  Subclasses should call
`super().save(dest, exist_ok=exist_ok)` first and then write their
own model-specific artifacts.

- Parameters

    - - **dest** – Destination directory.  Created if it does not exist.
- **exist\_ok** – When `False` (default) raise `ValueError` if
*dest* already exists.

- Raises

    - - **NotADirectoryError** – If *dest* exists but is not a directory.
- **ValueError** – If *dest* already exists and *exist\_ok* is `False`.

## LLMContainer

LLM container — text-generator specific GenAI container.

- *class* qairt.gen\_ai\_api.containers.llm\_container.LLMContainer(*models: List[[CompiledModel](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-core-api.html#qairt.CompiledModel)]*, *gen\_ai\_config: [GenAIConfig](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-configs.html#qairt.gen_ai_api.configs.gen_ai_config.GenAIConfig)*, *backend: [BackendType](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.common.BackendType)*, *\**, *backend\_extensions\_config: Optional[Dict] = None*, *compile\_config: Optional[[CompileConfig](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-compiler.html#qairt.api.compiler.config.CompileConfig)] = None*, *profiling\_report: Optional[Dict] = None*)

    - Bases: [`GenAIContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_container.GenAIContainer)

Container for text-generator (LLM) models.

Produced by a [`GenAIBuilderHTP`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-builders-htp.html#qairt.gen_ai_api.builders.gen_ai_builder_htp.GenAIBuilderHTP)
and consumed by a [`T2TExecutor`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.t2t_executor.T2TExecutor).

Extends [`GenAIContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.gen_ai_container.GenAIContainer)
with LLM-specific artifacts:

- tokenizer
- [`GenAIConfig`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-configs.html#qairt.gen_ai_api.configs.gen_ai_config.GenAIConfig) (context length,
vocabulary, chat template, embedding LUT, speculative-decoding config, …)
- compiled model splits (context binaries or DLCs)
- LoRA adapter binaries
- Eaglet draft container and token map

On-disk layout produced by [`save()`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.llm_container.LLMContainer.save):

dest/
      metadata.json              # ContainerMetadata (backend + manifest)
      backend_extensions.json    # optional
      tokenizer.json
      gen_ai_config.json
      models/
        split_0/
          model.bin              # context binary  (or model.dlc)
          <use_case>.bin         # LoRA adapter(s)
        split_1/ …
        use_cases.json
      chat_template/             # optional
      embedding_table.bin        # optional
      eaglet_draft_container/    # optional
      eaglet_token_map.json      # optional
    Copy to clipboard

- export(*dest: str | os.PathLike*, *\**, *export\_format: [ExportFormat](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-modules-genie-execution.html#qairt.modules.genie_execution.genie_config.ExportFormat) = ExportFormat.DIALOG*, *target\_device: Optional[[Device](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.device.Device)] = None*, *push\_to\_target: bool = False*)

    - Export container artifacts to a destination directory on the host or on a target device.

Container artifacts for the model are always included. If a
*target\_device* is specified, bin/lib files from the SDK for that
target are included in the export. Further, if *push\_to\_target* is
`True`, *dest* should be a location on the *target\_device* and all
exported files will be placed at that location.

The exported contents are identical to what is produced by the
`GenieT2TRunner.load()` method.

- Parameters

    - - **dest** – The path where the container contents will be exported.
If *push\_to\_target* is `True` this is a path on the target device.
- **export\_format** – The export format that should be used.
- **target\_device** – The target device to collect SDK artifacts for.
- **push\_to\_target** – When `True` the export is performed directly on
the device using the device interface; otherwise the export is
performed locally.

- Raises

    - - **NotADirectoryError** – If the destination path exists but is not a directory.
- **ValueError** – If *push\_to\_target* is `True` but no *target\_device* is given.

- *property* gen\_ai\_config*: [GenAIConfig](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-configs.html#qairt.gen_ai_api.configs.gen_ai_config.GenAIConfig)*

    - The `GenAIConfig` for this container.

- get\_draft\_models\_and\_config() → Tuple[Optional[List[[CompiledModel](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-core-api.html#qairt.CompiledModel)]], Optional[Dict]]

    - Extract draft models and backend extensions config for Eaglet speculative decoding.

- Returns

    - A `(draft_models, draft_model_backend_extensions_config)` tuple.
Both values are `None` when no Eaglet speculative decoding is configured.

- get\_executor(*device: Optional[[Device](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.device.Device)] = None*, *clean\_up: bool = True*, *prepare\_environment: bool = True*, *\*\*kwargs*) → [T2TExecutor](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.t2t_executor.T2TExecutor)

    - Return a [`T2TExecutor`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.t2t_executor.T2TExecutor).

Deprecated since version Use: `WorkflowBuilder` to construct a `WorkflowContainer` and
call `get_executor()` on that instead::

> 
> 
> # Before
> container.get\_executor(device=device)
> # After
> WorkflowBuilder.from\_builders({‘genai’: builder}).build().get\_executor(device=device)

- Parameters

    - - **device** – Optional device to run the executor on.
- **clean\_up** – Whether to clean up resources when the executor is done.
- **prepare\_environment** – Whether to prepare the environment for the executor.
- **\*\*kwargs** – Additional keyword arguments passed to the executor.

- Returns

    - A [`T2TExecutor`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.t2t_executor.T2TExecutor) instance.

- Raises

    - **ValueError** – If no models were loaded into the container.

- *classmethod* load(*path: str | os.PathLike*) → Self

    - Load an [`LLMContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.llm_container.LLMContainer) from disk.

- Parameters

    - **path** – Directory produced by a previous call to [`save()`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.llm_container.LLMContainer.save).

- Returns

    - An [`LLMContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.llm_container.LLMContainer) instance with the loaded artifacts.

- Raises

    - - **NotADirectoryError** – If *path* is not a directory or the models
    sub-directory is missing.
- **FileNotFoundError** – If required files (tokenizer, gen\_ai\_config)
    are absent.

- *property* models*: List[[CompiledModel](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-core-api.html#qairt.CompiledModel)]*

    - The compiled model splits held by this container.

- save(*dest: str | os.PathLike*, *\**, *exist\_ok: bool = False*)

    - Save all artifacts to disk.

Calls `GenAIContainer.save()` to write the common files
(`metadata.json`, `backend_extensions.json`) and then writes the
LLM-specific artifacts.

- Parameters

    - - **dest** – Path to save the artifacts.
- **exist\_ok** – When `False` (default) raise `ValueError` if
*dest* already exists.

- write\_use\_cases\_json(*dest: str | os.PathLike*)

    - Write `use_cases.json` inside the models directory.

Extracts all unique use-case names from the models’
`lora_use_case_binary_map` and writes them to a JSON file so that
[`load()`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.llm_container.LLMContainer.load) can reconstruct the LoRA adapter map.

- Parameters

    - **dest** – Base destination path where the models directory resides.

Last Published: May 26, 2026

[Previous Topic
GenAIBuilder](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-gen-ai-api-builders.md) [Next Topic
GenAIExecutable](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-gen-ai-api-executors.md)