Skip to main content

BioML Tasks Python client

This is a Python client for BioML Tasks. It lets you run ML APIs from your Python code or Jupyter notebook.

Install

pip install bioml_tasks

Authenticate

Before running any Python scripts that use the API, you need to set your BioML Tasks API token in your environment.

Grab your token from biomltasks.com/settings and set it as an environment variable:

export BIOML_TASKS_API_TOKEN=<your token>

We recommend not adding the token directly to your source code, because you don't want to put your credentials in source control. If anyone used your API key, their usage would be charged to your account.

Run a model

Create a new Python file and add the following code:

>>> import bioml_tasks
>>> bioml_tasks.run(
        "<user_name>/<api_name>",
        input={"prompt": "a 19th century portrait of a wombat gentleman", "another_arg": "its value"}
    )

Errors and Exceptions

  • bioml_tasks.exceptions.MlApiNotFoundError - Raised when trying to run an API that does not exist, or that the user doesn't have access to.
  • bioml_tasks.exceptions.MlApiNotDeployedError - Raised when trying to run an API that exists, but is not deployed.
  • bioml_tasks.exceptions.MlApiDeploymentError - Raised when trying to run an API that has been deployed but is not running. This is usually due to insufficient compute or incorrect setup code.
  • bioml_tasks.exceptions.MlApiError - An error from the deployed ML API.
  • bioml_tasks.exceptions.BioMlTasksError - A generic error for all other errors.
  • bioml_tasks.exceptions.BioMlTasksException - The base class that all the above errors inherit from.

Development

See CONTRIBUTING.md

Release files for bioml-tasks 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bioml-tasks 0.2.0
File Size Uploaded
bioml_tasks-0.2.0.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bioml-tasks 0.2.0
File Interpreter ABI Platform
bioml_tasks-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.3 kB

Release files / bioml_tasks-0.2.0.tar.gz

Download URL bioml_tasks-0.2.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
20d8e603d84b7bb34f733146eeb484a6732c2a676289b50dfb868c69808c30a3
BLAKE2b-256 checksum
How to use checksums
793ac003b5aafa7aea13578a1dccc0e05ccc3c450a50b5eeab215b3185cfa3a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / bioml_tasks-0.2.0-py3-none-any.whl

Download URL bioml_tasks-0.2.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4952405455a126d54d934dac5049ace8f1e4a53cbe8160119e4446b2eedd7ff6
BLAKE2b-256 checksum
How to use checksums
a001c93cbc703d72b0dcdff343718d9bee39a7319e0531b1d246e932fb66292a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page