Skip to main content

chemetrian

Official Python SDK for the Chemetrian API. Drive Bayesian Optimization (and future services) with pandas DataFrames and one API key.

Install

pip install chemetrian

Quickstart

from chemetrian import Chemetrian

client = Chemetrian(api_key="sk_live_…")                 # or set CHEMETRIAN_API_KEY
# QA: Chemetrian(api_key="sk_live_…", base_url="https://qa.chemetrian.com")

features = [
    {"feature_name": "temp",     "feature_type": "CONTINUOUS_NUMERICAL",
     "lower_bound": 20, "upper_bound": 120, "step_size": 10},
    {"feature_name": "catalyst", "feature_type": "CATEGORICAL",
     "feature_values": ["Pd", "Ni", "Cu"]},
]
targets = [{"target_name": "yield", "goal": "maximize", "threshold": 0}]

# 1. Start a campaign → DataFrame of suggested experiments (priority == 1)
df = client.bayesian_optimization.initialize(
    project="amide-coupling", workflow_name="run-1",
    features=features, targets=targets, batch_size=4,
)

# 2. Run the suggested rows, fill in the measured target, submit → next batch
df.loc[df["priority"] == 1, "yield"] = [72.4, 55.1, 38.9, 80.2]
df = client.bayesian_optimization.run_round("amide-coupling", "run-1", df, batch_size=4)

# 3. (Optional) start from existing data instead of step 1
df = client.bayesian_optimization.initialize_with_experiments(
    project="amide-coupling", workflow_name="run-2",
    experiments=historical_df, targets=targets, batch_size=4,   # features auto-detected
)

Each call submits a job and blocks until it finishes (polling under the hood), then returns a DataFrame. priority: 1 = suggested (run it), -1 = completed.

Projects & workflows

client.list_projects()
client.create_project("amide-coupling", description="Q3 scouting")
client.bayesian_optimization.list_workflows("amide-coupling")

Errors

All raise subclasses of chemetrian.ChemetrianError: ValidationError (client-side), AuthError (401), InsufficientCreditsError (402), NotFoundError (404), RateLimitError (429, auto-retried), JobFailedError, JobTimeoutError.

Configuration

arg / env purpose
api_key / CHEMETRIAN_API_KEY your key
base_url / CHEMETRIAN_API_URL API host (QA vs prod)
poll_interval, poll_timeout how long the SDK waits for a job

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chemetrian-0.2.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chemetrian-0.2.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file chemetrian-0.2.0.tar.gz.

File metadata

  • Download URL: chemetrian-0.2.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/5.15.154+

File hashes

Hashes for chemetrian-0.2.0.tar.gz
Algorithm Hash digest
SHA256 79f28b07322006d0a64b913d67483b393833dec7152a5f4bed58d7cf78468860
MD5 23de2ec7685705fabf8909a3cd8f8d21
BLAKE2b-256 6ebdfe66070b47c9b60f52dbaf33d307f9aa32d7a22f5e251f4258106f4bc098

See more details on using hashes here.

File details

Details for the file chemetrian-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: chemetrian-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/5.15.154+

File hashes

Hashes for chemetrian-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ded3aec1b895270fba72aba825f2efca1baad412425c834e836f41d1384df38
MD5 0215bd3a95486bfe04c1eadc69945ac4
BLAKE2b-256 782a677cdfa3ac3373b5c1e93a359252927d1bc1c83f0b606cfe1439818682e6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page