# Extend compliance documentation with key values
URL: https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/registry/reg-key-values.html

> 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

When you [create a model package in the Model Registry](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/registry/reg-create.html), you can [generate automated compliance documentation for the model](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/registry/reg-compliance.html). 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](https://docs.datarobot.com/en/docs/classic-ui/modeling/analyze-models/compliance-classic/template-builder.html) 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 asdatarobot.parameter.max_depth), metrics (such asdatarobot.metric.AUC.validation), and tags (such asdatarobot.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

In the [Model Registry](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/registry/reg-create.html), [open a registered model version](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/registry/reg-action.html#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.

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
2. In theAdd new key valuedialog box, configure the following settings: SettingDescriptionCategorySelect one of the following categories for the new key value to organize your key values by purpose:Training parameterMetricTagArtifactRuntime parameterValue typeSelect one of the following value types for the new key value:DatasetImageStringPickleBinaryNumericBooleanURLJSONYAMLValueIf you selected one of the following value types, enter the appropriate data:String: Enter any string up to 4 KB.Numeric: Enter an integer or floating-point number.Boolean: SelectTrueorFalse.URL: A URL in the formatscheme://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.JSON: Enter or upload JSON as a string. This JSON must parse correctly; otherwise, DataRobot won't accept it.YAML: Enter or upload YAML as a string. DataRobot does not validate this YAML.UploadIf you selected one of the following value types, add an artifact by uploading a file:Upload a dataset: A CSV file or any other compatible data file ( with a.csv,.tsv,.dsv,.xls,.xlsx,.gz,.bz2,.tar,.tgz, or.zipextension). The file is added as a dataset in the AI catalog, so all file types supported there are also supported for key values.Upload an image: A JPEG or PNG file (with a.jpg,.jpeg, or.pngextension).Upload a pickle file: A Python PKL file (with the.pklextension). DataRobot only stores the file for the key value; you can't access or run objects or code in the file.Upload a binary file: A file with any file extension. DataRobot stores the file as an opaque object.NameEnter a descriptive name for the key in the key-value pair.Description(Optional) Enter a description of the key value's purpose.
3. ClickOKto save the key value. The new key appears in the table.

## 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:

| Action | Description |
| --- | --- |
| View | You can view values in the following ways: String, numeric, and boolean values: View the values directly in the table.Image and dataset files: Click the preview icon (). 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.Long strings, JSON, and YAML: Hover over the truncated value to view the full value.Pickle and binary files: Cannot be previewed. In these cases, the "value" is the original filename of the uploaded file. |
| Edit | Click the edit icon () 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 () 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

Once you've added key values, you can [build custom compliance documentation templates](https://docs.datarobot.com/en/docs/classic-ui/modeling/analyze-models/compliance-classic/template-builder.html) 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) in the upper-right corner of DataRobot and, underApp Admin, clickTemplate Builder.
2. On theFlexible Documentation Templatespage,create or edit a compliance documentation template.
3. In the template, on theKey Valuespanel, select a model package with key values from theRegistered Model Versionlist.
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 theKey Valuespanel. NoteYou 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.
5. To preview the document, clickSave changesand then clickPreview 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 toModel Registry > Registered Modelspage 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:
3. Click+ Add key valuesand, underOther, clickCopy key values from previous version.
4. In theCopy key values to this registered versiondialog box, selectAll categoriesor a single category.
5. ClickOKto 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.versionis not overwritten in a newer version with the old version's value.

---
