Store record credentials in .env files
.env file instead of using inline credentials, allowing you to follow best practices for security when running Jupyter Notebooks.
May 26, 2026
Initialize the ValidMind Library with the code snippet unique to each record (model) per document to connect your environment to the ValidMind Platform, ensuring test results are uploaded to the correct record and automatically populated in the right document.
The ValidMind Library requires access to the data sources where relevant datasets and record files are stored in order to help you run tests.
In order to upload test results from the ValidMind Library to the ValidMind Platform, provide the following information through a code snippet copied from the platform:
| Argument | Description |
|---|---|
api_host |
The location of the ValidMind API |
api_key |
The account API key |
api_secret |
The account secret key |
document |
The record document identifier key |
model |
The record identifier |
Retrieve your code snippet for your record's selected document from the ValidMind Platform:
In the left sidebar, click Inventory.
Under the record type drop-down, select the type of record you want to retrieve the code snippet for.4
Select a record by clicking on it or find your record by applying a filter or searching for it.5
In the left sidebar that appears for your record, click Getting Started.
Select the document you want to automatically upload test results to.6
Click Copy snippet to clipboard.
A template must already be applied to your selected document to populate test results in the ValidMind Platform. Attempting to initialize the library with a document that does not have a template applied will result in an error.
To install the library:
To initialize the library, paste the code snippet with the client integration details directly into your development source code, replacing this example with your own:
To also enable monitoring, add monitoring=True to the vm.init method in your code snippet. 8
After you run the code snippet in your environment, the ValidMind Library will connect to your record and selected document in the ValidMind Platform. Automate your workflow by using the library to run tests, then seamlessly upload your test results to the platform.
After installing the ValidMind Library,9 you'll want to periodically make sure you are on the latest version to access any new features and other enhancements:
In your Jupyter Notebook or developer environment, retrieve the information for the currently installed version of the library:
If the version returned is lower than the version indicated in our production open-source code,10 run the following command:
10 ValidMind GitHub: validmind-library/validmind/__version__.py