# 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`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.vision_encoder_container.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) .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*, *engine\_config: Optional[EngineConfig] = None*) - 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. - **engine\_config** – Optional engine-level deployment parameters (`n_threads`, `htp.cpu_mask`, `htp.poll`, etc.) to apply when building the Genie engine configuration. When `None` the defaults embedded in the container are used. Applies to both [`DIALOG`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-modules-genie-execution.html#qairt.modules.genie_execution.genie_config.ExportFormat.DIALOG) and [`LM_EXECUTOR`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-modules-genie-execution.html#qairt.modules.genie_execution.genie_config.ExportFormat.LM_EXECUTOR) exports since both serialise the same underlying engine config. - 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], Optional[[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)]] - Extract draft models, backend extensions config, and gen\_ai\_config for Eaglet. - Returns - A `(draft_models, draft_model_backend_extensions_config, draft_gen_ai_config)` tuple. All 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*, *engine\_config: Optional[EngineConfig] = None*, *\*\*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. ## WorkflowContainer `WorkflowContainer` aggregates the per-model containers produced by a [`WorkflowBuilder`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-builders.html#qairt.gen_ai_api.builders.workflow_builder.WorkflowBuilder) into one saveable, loadable artifact and dispatches to the appropriate executor (for example, [`ImageT2TExecutor`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.image_t2t_executor.ImageT2TExecutor) for an image-to-text workflow). - *class* qairt.gen\_ai\_api.containers.workflow\_container.WorkflowContainer(*containers: Dict[str, [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)]*, *workflow\_graph: [WorkflowGraph](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-configs-workflow.html#qairt.gen_ai_api.configs.workflow.WorkflowGraph)*) - 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) Container that aggregates multiple GenAIContainerable instances. - get\_executor(*device: Optional[[Device](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.device.Device)] = None*, *\**, *engine\_config: Optional[EngineConfig] = None*, *\*\*kwargs*) → [GenAIExecutable](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.gen_ai_executable.GenAIExecutable) - Determine and instantiate the appropriate executor. The selection logic is: - `TEXT_GENERATOR`-only or `TEXT_ENCODER → TEXT_GENERATOR` workflows: 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) is returned via [`from_workflow()`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.t2t_executor.T2TExecutor.from_workflow). - Workflows containing an `IMAGE_ENCODER` node return an [`ImageT2TExecutor`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.image_t2t_executor.ImageT2TExecutor). - Parameters - - **device** (*Optional* *[*[*Device*](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.device.Device)*]*) – Optional device specification passed through to the executor. - **\*\*kwargs** – Additional keyword arguments forwarded to the concrete executor constructors (e.g., `qairt_sdk_root`, `clean_up`). - Returns - An instance of the concrete executor matching the workflow. - Return type - [GenAIExecutable](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-executors.html#qairt.gen_ai_api.executors.gen_ai_executable.GenAIExecutable) - *classmethod* load(*path: str | os.PathLike*) → T - Load a WorkflowContainer from disk. Reads `metadata.json` to obtain the sub-container names (from `manifest.artifacts`) and the workflow graph, then uses the container factory to load each sub-container. Because the factory inspects each sub-container’s own manifest, nested [`WorkflowContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.workflow_container.WorkflowContainer) instances are handled recursively without any additional logic here. - save(*dest: str | os.PathLike*, *\**, *exist\_ok: bool = False*) - Save all aggregated containers. - *class* qairt.gen\_ai\_api.containers.workflow\_container.WorkflowContainerManifest(*\*args: Any*, *\*\*kwargs: Any*) - Bases: `ContainerManifest` Manifest for a [`WorkflowContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.workflow_container.WorkflowContainer). Extends the base `ContainerManifest` with no additional fields — sub-containers are registered in the inherited `artifacts` dict (logical name → relative subdirectory path), exactly like any other artifact. The concrete type of each sub-container is determined at load time by reading that sub-container’s own `metadata.json`; it is not duplicated here. - *class* qairt.gen\_ai\_api.containers.workflow\_container.WorkflowContainerMetadata(*\*args: Any*, *\*\*kwargs: Any*) - Bases: `AISWBaseModel` Metadata written to `metadata.json` for a [`WorkflowContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.workflow_container.WorkflowContainer). - manifest*: [WorkflowContainerManifest](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.workflow_container.WorkflowContainerManifest)* - - workflow\_graph*: [WorkflowGraph](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-configs-workflow.html#qairt.gen_ai_api.configs.workflow.WorkflowGraph)* - ## VisionEncoderContainer `VisionEncoderContainer` holds a compiled vision encoder model and is the container counterpart of [`VisionEncoderBuilderHTP`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-builders.html#qairt.gen_ai_api.builders.vision_encoder_builder_htp.VisionEncoderBuilderHTP). Container for a compiled vision encoder model. - *class* qairt.gen\_ai\_api.containers.vision\_encoder\_container.VisionEncoderContainer(*compiled\_model: [CompiledModel](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-core-api.html#qairt.CompiledModel)*, *config: VisionEncoderConfig*, *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: [`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 a compiled vision encoder model. Intended to be used as a sub-component of a [`WorkflowContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.workflow_container.WorkflowContainer) rather than as a standalone artifact. It does **not** provide a `get_executor()` method; execution is orchestrated by the enclosing workflow container. 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) so that it inherits the common on-disk infrastructure (`metadata.json`, `backend_extensions.json`) and can be serialised and deserialised as part of a workflow container’s `save()` / `load()` cycle. 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.vision_encoder_container.VisionEncoderContainer.save): dest/ metadata.json # ContainerMetadata (backend + manifest) backend_extensions.json # optional model.bin # compiled context binary (CacheModule) model.dlc # compiled DLC (DlcModule) — mutually exclusive vision_encoder_config.json # VisionEncoderConfig fields Copy to clipboard - *property* compiled\_model*: [CompiledModel](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-core-api.html#qairt.CompiledModel)* - The compiled model held by this container. - *classmethod* load(*path: str | os.PathLike*) → [VisionEncoderContainer](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.vision_encoder_container.VisionEncoderContainer) - Load a [`VisionEncoderContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.vision_encoder_container.VisionEncoderContainer) from *path*. - 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.vision_encoder_container.VisionEncoderContainer.save). - Returns - A new [`VisionEncoderContainer`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-containers.html#qairt.gen_ai_api.containers.vision_encoder_container.VisionEncoderContainer) instance. - Raises - - **NotADirectoryError** – If *path* is not a directory. - **FileNotFoundError** – If the config file or compiled model is absent. - save(*dest: str | os.PathLike*, *\**, *exist\_ok: bool = False*) - Extends GenAIContainer.save with vision-encoder-specific artifacts. After writing the common files via the parent, also writes the compiled model binary (model.bin or model.dlc) and vision\_encoder\_config.json. - Raises - **TypeError** – If the compiled model’s module type is not supported. - *property* vision\_config*: VisionEncoderConfig* - The `VisionEncoderConfig` for this container. Last Published: Aug 19, 2026 [Previous Topic Buildable.build()](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-gen-ai-api-builders.md)