Skip to main content

Python SDK for Om

Project description

OMTX Python SDK

Lightweight helper for the OM Gateway. Queue diligence jobs, poll for results, and unlock/stream private data sets.

Installation

pip install omtx

Quick start

from omtx import OMTXClient

client = OMTXClient()  # picks up OMTX_API_KEY

# 1) Generate claims (returns 202 + job_id)
claims_job = client.diligence_generate_claims(
    target="BRAF",
    prompt="Summarize known inhibitors"
)

# 2) Check status immediately (returns metadata + payload when ready)
job_record = client.jobs.status(claims_job["job_id"])
print(job_record["status"])

# 3) Optionally wait for completion (defaults to a 1 hour timeout)
claims_result = client.jobs.wait(
    claims_job["job_id"],
    result_endpoint="/v2/jobs/generateClaims/{job_id}",
)
print("total claims:", claims_result["total_claims"])

# 4) Kick off report synthesis (returns job metadata)
report_job = client.diligence.synthesize_report(gene_key="acad8")
report = client.jobs.wait(
    report_job["job_id"],
    result_endpoint="/v2/jobs/synthesizeReport/{job_id}",
)
print(report["sections"][0]["title"])

# 5) Deep research job (poll with jobs.wait when ready)
deep_job = client.diligence.deep_research(
    query="CRISPR applications in cancer therapy",
)
deep = client.jobs.wait(
    deep_job["job_id"],
    result_endpoint="/v2/jobs/deep-research/{job_id}",
)
print(deep["final_report"][:400])

Setup

Get an API key

  1. Sign up at https://omtx.ai
  2. Generate an API key from the dashboard

Provide the API key

export OMTX_API_KEY="your-api-key"

The SDK defaults to the hosted gateway at https://api-gateway-129153908223.us-central1.run.app. If you need a different deployment, pass base_url explicitly (or set OMTX_BASE_URL).

Or pass both API key and base URL when constructing the client:

from omtx import OMTXClient

client = OMTXClient(
    api_key="your-api-key",
    base_url="https://api-gateway-129153908223.us-central1.run.app",
)

Usage examples

Error handling and context manager

from omtx import OMTXClient, InsufficientCreditsError, OMTXError

with OMTXClient() as client:
    try:
        job = client.diligence.synthesize_report(gene_key="acad8")
        report = client.jobs.wait(
            job["job_id"], result_endpoint="/v2/jobs/synthesizeReport/{job_id}"
        )
    except InsufficientCreditsError:
        print("Add credits before running resynthesis jobs.")
    except OMTXError as exc:
        print(f"Gateway call failed: {exc}")

Selective data access

from omtx import OMTXClient

client = OMTXClient()

# 1) Unlock a dataset (consumes one Access Credit)
client.binders.unlock(protein_uuid="aa11bb22", gene_name="KRAS")

# 2) Stream the private dataset
stream = client.binders.selectivity.stream(
    protein_uuid="aa11bb22",
    limit=100_000,
)

df = stream.to_dataframe()
print("Rows:", len(df))

Gene key discovery

from omtx import OMTXClient

client = OMTXClient()
gene_keys = client.diligence.list_gene_keys()
print(gene_keys["items"][:5])

Retries & idempotency

from omtx import OMTXClient

client = OMTXClient()

# Every POST call receives a timestamp-based idempotency key automatically.
claims = client.diligence.generate_claims(
    target="BRAF",
    prompt="Summarize inhibitors",
)

Available helper methods

  • diligence.generate_claims(target, prompt)
  • diligence.synthesize_report(gene_key)
  • diligence.deep_research(query)
  • diligence.list_gene_keys() (fetches all keys)
  • jobs.history(...), jobs.status(job_id), jobs.wait(job_id, …)
  • binders.unlock(protein_uuid, gene_name=None), binders.list_unlocks()
  • binders.selectivity.stream|stats|cost_estimate(...)
  • binders.public/private/community/decoys.stream|cost_estimate(...)
  • pricing.manifest(), pricing.cost_estimate(...)
  • gateway.status()
  • users.profile()

Requirements

  • Python 3.9 or higher
  • An OMTX API key

Support

License

MIT License – see LICENSE for details.

Project details


Download files

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

Source Distribution

omtx-0.4.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

omtx-0.4.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file omtx-0.4.0.tar.gz.

File metadata

  • Download URL: omtx-0.4.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for omtx-0.4.0.tar.gz
Algorithm Hash digest
SHA256 5e54c2cc6046397d47089ec4e8ddb3e3a417ec9936ba07ab4836781dd2a58f4f
MD5 e840db099ddc2dec21111757e09334ec
BLAKE2b-256 9ce794ec5c5d0dbe1f065391b66d1e8b8ae1bb6dfa6b18f523fe81b0c9d26cc3

See more details on using hashes here.

File details

Details for the file omtx-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: omtx-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for omtx-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21df55541cd2f196c456f0bc874c99d187c0e075f22c8b86b7076053f46151b5
MD5 bd11cae11c2d2d9f424734a41cda278b
BLAKE2b-256 0d45d996b2513a8c0b84e39d6e807a579e1ac141e0e8404d022fe3eecc7cf23b

See more details on using hashes here.

Supported by

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