Install and initialize the client library

Published

September 23, 2024

ValidMind generates a unique code snippet for each registered model to connect with your developer environment. You initialize the client library with this code snippet, ensuring that your documentation and tests are uploaded to the correct model.

Prerequisites

In order to integrate the developer framework and to be able to upload to the platform UI, you must provide the following information through a code snippet that you copy from the ValidMind Platform UI:

Argument Description
api_host The location of the ValidMind API
api_key The account API key
api_secret The account secret key
project The project identifier

If you do not have a suitable model with a code snippet to use, you can register a model first.2

The developer framework also requires access to the data sources where data sets used for training, testing, and trained model files are stored. This access is needed to run model documentation and validation tests, and to upload to the platform UI to populate the model documentation and validation reports.

Locate the developer framework integration instructions

For existing projects, this information can be found in the ValidMind Platform UI:

  1. In the left sidebar, click Model Inventory.

  2. Select a model by clicking on it or find your model by applying a filter or searching for it.3

  3. In the left sidebar that appears for your model, click Getting Started.

  4. Locate the code snippet and click Copy snippet to clipboard.

Install the client library

To install the client library:

%pip install validmind

Initialize the client library

To initialize the client library, paste the code snippet with the client integration details directly into your development source code, replacing this example with your own:

import validmind as vm

vm.init(
  api_host = "https://API_HOST.validmind.ai/api/v1/tracking",
  api_key = "API_KEY",
  api_secret = "API_SECRET",
  project = "PROJECT-IDENTIFIER"
)

To also enable monitoring, add monitoring=True to the vm.init method in your code snippet. 4

After you have pasted the code snippet into your development source code and run your code, the Python client library will connect and register with ValidMind. You can now use the developer framework to document and test your models, and to upload model documentation and test results to the platform UI.