# Genie DLC

Genie DLC APIs provide a means to load models packaged in a DLC (Deep Learning Container) file which
is supported by QAIRT model conversion tools. A DLC bundles one or more Genie use cases
(dialog, embedding, node) along with their configurations into a single file which simplifies deployment
and initialization.  QAIRT GenAiBuilder tool auto-generates and bundles Genie configuration files with
automatic population of model-driven configuration parameters into a single file. The DLC APIs allow
creating dialog, embedding, and node configurations directly from a DLC, optionally overwriting the
bundled configuration with a standalone Genie config.

## DLC API Overview

The DLC workflow consists of two steps:

1. Create a `GenieDlcConfig` from a DLC file path, then create a `GenieDlc` handle from it.
2. Use the `GenieDlc` handle to create dialog, embedding, or node configurations via the
`createFromDlc` APIs.

The following APIs are provided:

- `GenieDlcConfig_create` / `GenieDlcConfig_free` — create and free a DLC configuration.
- `GenieDlc_create` / `GenieDlc_free` — create and free a DLC handle.
- `GenieDlc_getUseCases` — retrieve the list of use cases supported by the DLC as a JSON string.
- `GenieDialogConfig_createFromDlc` — create a dialog configuration from a DLC.
- `GenieEmbeddingConfig_createFromDlc` — create an embedding configuration from a DLC.
- `GenieNodeConfig_createFromDlc` — create a node configuration from a DLC.

## Example on how to use DLC APIs

The following example demonstrates loading a dialog configuration from a DLC file using the C API:

# Create DLC Config
    GenieDlcConfig_Handle_t dlcConfigHandle = NULL;
    GenieDlcConfig_create("/path/to/model.dlc", &dlcConfigHandle);
    
    # Create DLC Handle
    GenieDlc_Handle_t dlcHandle = NULL;
    GenieDlc_create(dlcConfigHandle, &dlcHandle);
    
    # Query supported use cases
    # useCasesJson is a JSON array of use case objects, each with a "name" field, e.g.:
    # [
    #   { "name": "dialog", "config": { "name": "llama_dialog_config" } },
    #   { "name": "embedding", "config": { "name": "llama_embedding_config" } }
    # ]
    const char* useCasesJson = nullptr;
    const Genie_AllocCallback_t allocCallback([](size_t size, const char** data) {
      *data = (char*)malloc(size);
    });
    GenieDlc_getUseCases(dlcHandle, allocCallback, &useCasesJson);
    
    # Parse useCasesJson to select the desired use case name, e.g. "dialog"
    # The "name" value from a use case entry is passed as the useCaseName argument below
    free((char*)useCasesJson);
    
    # Create Dialog Config from DLC using the use case name obtained from useCasesJson
    GenieDialogConfig_Handle_t dialogConfigHandle = NULL;
    GenieDialogConfig_createFromDlc(dlcHandle, "dialog", nullptr, &dialogConfigHandle);
    
    # Create Dialog
    GenieDialog_Handle_t dialogHandle = NULL;
    GenieDialog_create(dialogConfigHandle, &dialogHandle);
    
    # Run Dialog Query API
    GenieDialog_query(dialogHandle, promptStr, GENIE_DIALOG_SENTENCE_COMPLETE, queryCallback);
    
    # Free handles
    GenieDialog_free(dialogHandle);
    GenieDialogConfig_free(dialogConfigHandle);
    GenieDlc_free(dlcHandle);
    GenieDlcConfig_free(dlcConfigHandle);
    Copy to clipboard

## Overwriting DLC Configuration

The `createFromDlc` APIs accept an optional `configStr` parameter. When provided, the
standalone Genie JSON configuration string overwrites the configuration bundled in the DLC for
the specified use case. Pass `nullptr` (C) or an empty string (C++) to use the DLC’s bundled
configuration unchanged.

Warning

The standalone config must use the same JSON hierarchy as the Genie config bundled in the DLC.
The overwrite is applied as a recursive field-level merge: each key in the standalone config is
matched by name at each nesting level and overwrites the corresponding field in the DLC config.
A field placed at the wrong nesting level will not overwrite the intended field — it will
instead be inserted as a new, unrecognised key that Genie silently ignores.

# Create Dialog Config from DLC, overwriting with a standalone config
    std::string overrideConfig = R"({"backend": {
                                                  "dialog" : {
                                                    "sampler" : {
                                                      "version" : 1,
                                                      "seed" : 42,
                                                      "temp" : 0.8,
                                                      "top-k" : 40,
                                                      "top-p" : 0.95
                                                    }
                                                  }
                                                })";
    GenieDialogConfig_Handle_t dialogConfigHandle = NULL;
    GenieDialogConfig_createFromDlc(dlcHandle, "dialog", overrideConfig.c_str(), &dialogConfigHandle);
    Copy to clipboard

## Using DLC APIs in genie-app

The `genie-app` tool supports DLC operations through the `dlc` command group. The following
script demonstrates the full DLC workflow for a dialog use case:

# Create DLC config and DLC handle
    dlc config create dlcConfig1 /path/to/model.dlc
    dlc create dlc1 dlcConfig1
    
    # (Optional) Save supported use cases to a JSON file
    dlc getUseCases dlc1 use_cases.json
    
    # Create dialog config from DLC
    dialog config createFromDlc dialogConfig1 dlc1 dialog
    
    # Create dialog and run a query
    dialog create dialog1 dialogConfig1
    dialog query dialog1 "Describe the Snapdragon platform in one sentence."
    
    # Clean up
    dialog free dialog1
    dialog config free dialogConfig1
    dlc free dlc1
    dlc config free dlcConfig1
    Copy to clipboard

To overwrite the DLC’s bundled configuration with a standalone Genie config file, pass the
path to the config file as an optional final argument:

dialog config createFromDlc dialogConfig1 dlc1 dialog /path/to/override.json
    Copy to clipboard

The same pattern applies to embedding and node configurations:

embedding config createFromDlc embConfig1 dlc1 embedding
    node config createFromDlc nodeConfig1 dlc1 node
    Copy to clipboard

## genie-app DLC Command Reference

dlc config create  CONFIG_NAME FILE.dlc
    dlc config free    CONFIG_NAME
    dlc create         DLC_NAME CONFIG_NAME
    dlc getUseCases    DLC_NAME OUTPUT_FILE.json
    dlc free           DLC_NAME
    
    dialog config createFromDlc    CONFIG_NAME DLC_NAME USE_CASE_NAME [STANDALONE_GENIE_CONFIG]
    embedding config createFromDlc CONFIG_NAME DLC_NAME USE_CASE_NAME [STANDALONE_GENIE_CONFIG]
    node config createFromDlc      CONFIG_NAME DLC_NAME USE_CASE_NAME [STANDALONE_GENIE_CONFIG]
    Copy to clipboard

Last Published: Jun 04, 2026

[Previous Topic
Genie Accuracy](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/accuracy_accuracy.md) [Next Topic
Library](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/library.md)