API reference
Python API
The Modelbit Python package provides the Python API for interacting with Modelbit. These functions are called on the modelbit
module (e.g. import modelbit
) or on the logged in session (e.g. mb = modelbit.login()
).
Authentication
login
: Authenticate with your Modelbit workspace.
Deployments
deploy
: Create and update Modelbit deployments.get_inference
: Call the REST APIs of your deployments.
Inference-time helpers
get_dataset
: Fetch datasets and feature stores as Pandas DataFrames.get_secret
: Fetch secrets stored in Modelbit.log_image
: Log images during inferences and training jobs.setup
: Configure code to run during import time to reduce cold starts.trace
: Add performance tracing to inferences calls.
Deployment settings
add_files
: Add or change files in deployments.restart_deployment
: Restart running deployments.get_snowflake_mock_return_value
: Fetch the current Snowflake mock return value.set_snowflake_mock_return_value
: Set a new Snowflake mock return value.
Training jobs
Model registry
add_metrics
: Add metrics to a model in the registry.add_model
: Add one model to the registry.add_models
: Add multiple models to the registry.delete_models
: Remove one or more models from the registry.get_metrics
: Fetch model metrics from the registry.get_model
: Fetch one model from the registry.get_models
: Fetch multiple models from the registry.models
: List models stored in the registry.
Common files & packages
add_common_files
: Add common files for all deployments.add_package
: Upload a private packages as shared code to Modelbit.common_files
: List available common files.delete_common_files
: Delete common files from Modelbit.delete_package
: Remove a private package from Modelbit.
Git Branches
create_branch
: Create a new Git branch.get_branch
: Get the current Git branch.merge_deployment
: Merge a deployment from one branch to another.switch_branch
: Change the current Git branch.
Management
datasets
: List available datasets and feature stores.get_deployment_info
: Get the name and version of the current deployment.in_modelbit
: Check whether the current execution is running in Modelbit or not.warehouses
: List the warehouses connected to Modelbit.
Command line interface (CLI)
CLI reference for interacting with modelbit
on the command line. The CLI is installed as part of the Modelbit Python package.
Repository
clone
: Configure and clone a Git repository of your workspace.validate
: Check for missing files or configuration issues in your workspace.
Helpers
add_common_files
: Link files incommon
into your deployments.deployment
: Manage deployments.model
: Manage file-based models in the model registry.package
: Manage private packages to your Modelbit workspace.
Maintenance
debug
: Print debug information.version
: Return the version of the currently installedmodelbit
package.
Settings files
The Modelbit git repository includes several files that specify settings.
- Common files
settings.yaml
: Configure automatic linking of common files.
- Deployments
metadata.yaml
: Configure how deployments are served.
- Training jobs:
metadata.yaml
: Configure how training jobs run.