# GenAIBuilderFactory - *class* qairt.gen\_ai\_api.gen\_ai\_builder\_factory.GenAIBuilderFactory - Bases: `object` Factory class to create `qairt.gen_ai_api.gen_ai_builder.GenAIBuilder` instances - *classmethod* create(*pretrained\_model\_path: str | os.PathLike, backend\_type: ~typing.Union[~typing.Literal[<BackendType.CPU: 'CPU'>], ~typing.Literal['CPU']], \*, cache\_root: ~typing.Optional[~typing.Union[str, ~os.PathLike]] = None*) → [GenAIBuilderCPU](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-builders-cpu.html#qairt.gen_ai_api.builders.gen_ai_builder_cpu.GenAIBuilderCPU) - *classmethod* create(*pretrained\_model\_path: str | os.PathLike, backend\_type: ~typing.Union[~typing.Literal[<BackendType.HTP: 'HTP'>], ~typing.Literal['HTP']] = BackendType.HTP, \*, cache\_root: ~typing.Optional[~typing.Union[str, ~os.PathLike]] = None, tokenizer\_path: ~typing.Optional[~typing.Union[str, ~os.PathLike]] = None, config\_path: ~typing.Optional[~typing.Union[str, ~os.PathLike]] = None, config\_dict: ~typing.Optional[dict] = None*) → [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) - *classmethod* create(*pretrained\_model\_path: str | os.PathLike*, *backend\_type: str | [qairt.api.configs.common.BackendType](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.common.BackendType)*, *\**, *cache\_root: Optional[Union[str, PathLike]] = None*, *tokenizer\_path: Optional[Union[str, PathLike]] = None*, *config\_path: Optional[Union[str, PathLike]] = None*, *config\_dict: Optional[dict] = None*) → Union[[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), [GenAIBuilderCPU](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-builders-cpu.html#qairt.gen_ai_api.builders.gen_ai_builder_cpu.GenAIBuilderCPU)] - Creates a GenAIBuilder instance based on the provided pretrained model path and backend type. This function makes the following assumptions: > > > - Directory Contents: The following directory and naming structure is expected > > > > > > > > > - For the HTP Backend: > > > > > > > > > > > > > > > - <pretrained\_model\_path>.dir > > > - - <model>.onnx > > > - <model>.encodings (a file containing quantization overrides) > > > - <model>.data (optional) > > > - config.json (a Hugging Face transformers configuration for the model) > > > - tokenizer.json (the corresponding configuration for the tokenizer from Hugging Face) > > > > > > > > > > > > > > > > > If the pretrained model path is a file, the directory containing it will be used to locate > > > additional required artifacts. If the pretrained model path is a directory, then the directory > > > is assumed to contain a single onnx model and a single set of corresponding encodings. A warning > > > will be returned if more than one model or encodings are found. > > > > > > - For the CPU Backend: > > > > > > > > > > > > > > > <pretrained\_model\_path>.dir where the directory contains the transformers configuration, > > > model weights, tokenizer and other artifacts as if the model where downloaded directly from > > > Hugging Face. > - Model Architecture: > > > The builder will attempt to identify the model and provide a pre-configured instance based on the > architecture. If HTP is requested and the model architecture is not recognized, > then a default GenAIBuilderHTP instance will be returned, with a warning. > See [`qairt.gen_ai_api.gen_ai_builder_factory.SupportedLLMs`](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-gen-ai-builder-factory.html#qairt.gen_ai_api.gen_ai_builder_factory.SupportedLLMs) for a list of pre-configured > architectures. - Parameters - - **pretrained\_model\_path** (*str*) – The path to the pretrained ONNX model. The pretrained model path may be a directory containing the model or a file path to the model itself. - **backend\_type** ([*BackendType*](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-configs.html#qairt.api.configs.common.BackendType)) – The type of backend to use. Defaults to BackendType.HTP. - **cache\_root** (*Path* *,* *optional*) – The root directory for caching, if desired. - **tokenizer\_path** (*str* *|* *PathLike* *,* *optional*) – Explicit path to the tokenizer. If provided, this takes precedence over convention-based discovery. Can be a file path or directory (will look for tokenizer.json inside). Defaults to None. - **config\_path** (*str* *|* *PathLike* *,* *optional*) – Explicit path to the model config. If provided, this takes precedence over convention-based discovery. Can be a file path or directory (will look for config.json inside). Defaults to None. - **config\_dict** (*dict* *,* *optional*) – In-memory config dict. When provided, *config\_path* is ignored for config loading and no file I/O is performed. The dict is forwarded to all architecture-specific builders and the default `GenAIBuilderHTP.from_pretrained()`. Mutually exclusive with *config\_path* at the builder level; providing both raises `ValueError`. - Returns - The created GenAIBuilder instance. - Return type - [GenAIBuilder](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-gen-ai-api-builders.html#qairt.gen_ai_api.builders.gen_ai_builder.GenAIBuilder) - Raises - **ValueError** – If the pretrained model path does not exist or if required files are missing. - *classmethod* create\_audio\_encoder(*pretrained\_model\_path: str | os.PathLike*, *cache\_root: Optional[Union[str, PathLike]] = None*, *\**, *config\_path: Optional[Union[str, PathLike]] = None*, *config\_section: str = 'audio\_config'*, *encodings\_path: Optional[Union[str, PathLike]] = None*, *\*\*kwargs*) → AudioEncoderBuilderHTP - Create an `AudioEncoderBuilderHTP` for the given model. Reads `config.json` to determine the model architecture and returns the most specific audio encoder builder available: - `Qwen3OmniForConditionalGeneration` → `Qwen3OmniAudioEncoderBuilderHTP` - Unknown / unrecognised → base `AudioEncoderBuilderHTP` - Parameters - - **pretrained\_model\_path** – Path to the ONNX audio encoder model file or a directory containing exactly one `.onnx` file. - **cache\_root** – Optional root directory for caching build artifacts. - **config\_path** – Explicit path to `config.json` or a directory containing it. When omitted the directory that contains *pretrained\_model\_path* is searched. - **config\_section** – Key inside `config.json` that holds the audio encoder parameters. Defaults to `"audio_config"`. - **encodings\_path** – Explicit path to the quantization encodings file. When provided, set on the builder after construction. If omitted, convention-based discovery alongside the model is used. - **\*\*kwargs** – Additional keyword arguments forwarded to the builder’s `from_pretrained` call. - Returns - An `AudioEncoderBuilderHTP` (or subclass) instance. - Raises - **ValueError** – If *pretrained\_model\_path* does not exist. - *classmethod* create\_vision\_encoder(*pretrained\_model\_path: str | os.PathLike*, *cache\_root: Optional[Union[str, PathLike]] = None*, *\**, *config\_path: Optional[Union[str, PathLike]] = None*, *config\_section: str = 'vision\_config'*, *encodings\_path: Optional[Union[str, PathLike]] = None*, *\*\*kwargs*) → [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) - Create a `VisionEncoderBuilderHTP` for the given model. - Parameters - - **pretrained\_model\_path** – Path to the ONNX vision encoder model file or a directory containing exactly one `.onnx` file. - **cache\_root** – Optional root directory for caching build artifacts. - **config\_path** – Explicit path to `config.json` or a directory containing it. When omitted the directory that contains *pretrained\_model\_path* is searched. - **config\_section** – Key inside `config.json` that holds the vision encoder parameters. Defaults to `"vision_config"`. - **encodings\_path** – Explicit path to the quantization encodings file. - **\*\*kwargs** – Additional keyword arguments forwarded to the builder’s `from_pretrained` call. - Returns - A `VisionEncoderBuilderHTP` (or subclass) instance. - *class* qairt.gen\_ai\_api.gen\_ai\_builder\_factory.SupportedLLMs(*value*) - Bases: `Enum` Enumeration of preconfigured builder architectures for the HTP backend - BAICHUAN *= 'BaiChuanForCausalLM'* - - GPT\_OSS *= 'GptOssForCausalLM'* - - INDUS *= 'GPT2LMHeadModel'* - - JAIS *= 'JAISLMHeadModel'* - - LLAMA *= 'LlamaForCausalLM'* - - MISTRAL *= 'MistralForCausalLM'* - - PHI *= 'Phi3ForCausalLM'* - - PLAMO *= 'PlamoForCausalLM'* - - QWEN *= 'Qwen2ForCausalLM'* - - QWEN25VL *= 'Qwen2\_5\_VLForConditionalGeneration'* - - QWEN3 *= 'Qwen3ForCausalLM'* - - QWEN3OMNI *= 'Qwen3OmniForConditionalGeneration'* - - QWEN3OMNI\_NEXT *= 'Qwen3OmniNextForConditionalGeneration'* - - QWEN3VL *= 'Qwen3VLForConditionalGeneration'* - - QWEN3\_5 *= 'Qwen3\_5ForConditionalGeneration'* - - QWEN3\_MOE *= 'Qwen3MoeForCausalLM'* - Last Published: Aug 19, 2026 [Previous Topic Classes](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-gen-ai.md) [Next Topic Buildable](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-gen-ai-api-builders.md)