---
title: Extend compliance documentation with key values
description: Build custom compliance documentation templates with references to key values, adding the associated data to the template and limiting the manual editing needed to complete the compliance documentation.

---

# Extend compliance documentation with key values {: #extend-compliance-documentation-with-key-values }

When you [create a model package in the Model Registry](reg-create), you can [generate automated compliance documentation for the model](reg-compliance). The compliance documentation provides evidence that the components of the model work as intended, the model is appropriate for its intended business purpose, and the model is conceptually sound. You can [build custom compliance documentation templates](template-builder) with references to key values, adding the associated data to the template and limiting the manual editing needed to complete the compliance documentation.

Key values associated with a model in the Model Registry are key-value pairs containing information about the registered model package. Each key-value pair has the following:

* **Name:** The unique and descriptive name of the key (for the model package or version).

* **Value type:** The data type of the value associated with the key. The possible types are string, numeric, boolean, URL, image, dataset, pickle, binary, JSON, or YAML.

* **Value:** The stored data or file.

You can include string, numeric, boolean, image, and dataset key values in custom compliance documentation templates. When you generate compliance documentation for a model package using a custom template referencing a supported key value, DataRobot inserts the matching values from the associated model package; for example, if the key value has an image attached, building the compliance documentation inserts that image, or if the key value refers to a dataset, it inserts the first 100 rows and 42 columns of the dataset.

DataRobot automatically populates key values for registered models you create. These key values are read-only, and their names start with `datarobot.`. They are generated when you register a DataRobot model from the Leaderboard or a custom model from the Custom Model Workshop.

* DataRobot models: DataRobot creates training parameters and metrics (such as `datarobot.parameter.max_depth`), metrics (such as `datarobot.metric.AUC.validation`), and tags (such as `datarobot.registered.model.version`). The automatic training parameters and metrics depend on the particular DataRobot model.

* Custom models: DataRobot creates runtime parameters from the model. The automatic key values depend on the custom model.

Although you can't modify or delete these automatic key values, you can manually add key values as needed to supplement the system-provided values. Your compliance documentation template or integration workflow can use key values from either source.

## Create key values {: #create-key-values }

In the [**Model Registry**](reg-create), [open a registered model version](reg-action#version-info) and access the **Key values** tab. In the table on this tab, you can view, add, edit, and delete key values, depending on your model package permissions.

![](images/key-values-tab.png)

??? note "Key value permissions"
    * Read-write key values use the permissions of the model package.
    * If you have view permissions for the model package, you can use key values in compliance documentation and search, sort, and filter the key values list.
    * If you have edit permissions for the model package, you can _also_ add, edit, and delete key values from the key values list.

When you add a new key value, you can add a string, numeric, boolean, URL, JSON, or YAML key value without an attached file. 

To add a new key value:

1. Click **+ Add key values > New key value**

    ![](images/add-new-kv.png)

2. In the **Add new key value** dialog box, configure the following settings:

    ![](images/add-new-kv-dialog.png)

    Setting     | Description
    ------------|------------------
    Category    | Select one of the following categories for the new key value to organize your key values by purpose: <ul><li>**Training parameter**</li><li>**Metric**</li><li>**Tag**</li><li>**Artifact**</li><li>**Runtime parameter**</li></ul>
    Value type  | Select one of the following value types for the new key value: <ul><li>**Dataset**</li><li>**Image**</li><li>**String**</li><li>**Pickle**</li><li>**Binary**</li><li>**Numeric**</li><li>**Boolean**</li><li>**URL**</li><li>**JSON**</li><li>**YAML**</li></ul>
    Value       | If you selected one of the following value types, enter the appropriate data:<ul><li>**String**: Enter any string up to 4 KB.</li><li>**Numeric**: Enter an integer or floating-point number.</li><li>**Boolean**: Select **True** or **False**.</li><li>**URL**: A URL in the format `scheme://location`; for example, `https://example.com`. DataRobot does not fetch the URL or provide a link to this URL in the user interface; however, in a downloaded compliance document, the URL may appear as a link.</li><li>**JSON**: Enter or upload JSON as a string. This JSON must parse correctly; otherwise, DataRobot won't accept it.</li><li>**YAML**: Enter or upload YAML as a string. DataRobot does not validate this YAML.</li></ul>
    Upload      | If you selected one of the following value types, add an artifact by uploading a file: <ul><li>**Upload a dataset**: A CSV file or any other compatible data file ( with a `.csv`, `.tsv`, `.dsv`, `.xls`, `.xlsx`, `.gz`, `.bz2`, `.tar`, `.tgz`, or `.zip` extension). The file is added as a dataset in the AI catalog, so all file types supported there are also supported for key values.</li><li>**Upload an image**: A JPEG or PNG file (with a `.jpg`, `.jpeg`, or `.png` extension).</li><li>**Upload a pickle file**: A Python PKL file (with the `.pkl` extension). DataRobot only stores the file for the key value; you can't access or run objects or code in the file.</li><li>**Upload a binary file**: A file with any file extension. DataRobot stores the file as an opaque object.
    Name        | Enter a descriptive name for the key in the key-value pair.
    Description | (Optional) Enter a description of the key value's purpose.

3. Click **OK** to save the key value. The new key appears in the table.


## View and manage key values {: #view-and-manage-key-values }

On the **Key values** tab, you can view key value information and manage your custom key values. You can search key values by name (full or partial) and refresh the list. You can also filter by the categories shown. If the model package has more than 10 key values, the list is paginated. 

Additional controls are located in the **Actions** column:

![](images/key-values-tab-actions.png)

Action      | Description
------------|------------------
View        | You can view values in the following ways: </ul><li>String, numeric, and boolean values: View the values directly in the table.</li><li>Image and dataset files: Click the preview icon (![](images/icon-insights-orange.png)). Previewing an image key value shows the image in the browser. Previewing a dataset key value brings you to the dataset page in the AI catalog.</li><li>Long strings, JSON, and YAML: Hover over the truncated value to view the full value.</li><li>Pickle and binary files: Cannot be previewed. In these cases, the "value" is the original filename of the uploaded file.</li></ul>
Edit        | Click the edit icon (![](images/icon-pencil.png)) to edit a key value. You can only edit the name, value, or description. Leaving a comment in the comment field is optional.
Delete      | Click the delete icon (![](images/icon-delete.png)) to delete a key value. If you delete an image, pickle, or binary key value, and no other key value is using the same file, DataRobot deletes the file from storage. Datasets remain in the AI catalog after deletion.

## Customize a compliance documentation template with key values {: #customize-a-compliance-documentation-template-with-key-values }

Once you've added key values, you can [build custom compliance documentation templates](template-builder) with references to those key values. Referencing key values in a compliance documentation template adds the associated data to the generated compliance documentation, limiting the amount of manual editing needed to complete the compliance documentation. 

To reference key values in a compliance documentation template: 

1. Click your profile avatar (or the default avatar ![](images/icon-gen-settings.png)) in the upper-right corner of DataRobot and, under **App Admin**, click **Template Builder**.

2. On the **Flexible Documentation Templates** page, [create or edit a compliance documentation template](template-builder#create-and-edit-templates).

3. In the template, on the **Key Values** panel, select a model package with key values from the **Model Package** list.

4. To add a key value reference to the template, edit a section, click to place the cursor where you want to insert the reference, then click the key value in the **Key Values** panel. 

    !!! note 
        You can include string, numeric, boolean, image, and dataset key values in custom compliance documentation templates. After you add a value, you can remove it by deleting the reference from the section.

    ![](images/add-kv-to-template.png)

5. To preview the document, click **Save changes** and then click **Preview template**. 

    As the template is not applied to any specific model package until you generate the compliance documentation, the preview displays placeholders for the key value.

### Copy key values from a previous model package version

Registered models have versions; each is an individual model package with an independent set of key values. If you created key values in an earlier version, you can copy these to a newer version:

1. Navigate to **Model Registry > Registered Models** page and open the registered model containing the version you want to add key values to.

2. To open the registered model version, do either of the following:

    ![](images/reg-model-open-version.png)

    * To open the version in the current tab, click the row for the version you want to access.

    * To open the version in a new tab, click the open icon (![](images/icon-open.png)) next to the **Type** column for the version you want to access.

3. Click **+ Add key values** and, under **Other**, click **Copy key values from previous version**.

4. In the **Copy key values to this registered version** dialog box, select **All categories** or a single category.

    ![](images/copy-kv-prev-ver-options.png)

5. Click **OK** to copy the key values.

    If a key value with the same name exists in the newer version and it is not read-only, the value from the older version will overwrite it. Otherwise, a new key value with that name is created in the newer version. Files for artifact key values (image, dataset, pickle, and binary) are not copied in bulk; instead, the new and old key values share the same file. If you edit either key value to use a different file, the other key value is unaffected, and the file is no longer shared. System key values are not included in bulk copy; for example, `model.version` is not overwritten in a newer version with the old version's value.
