Skip to main content

Python SDK for the OM Gateway V2

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) Wait for the job and fetch the final payload
claims_result = client.wait_for_job(
    claims_job["job_id"],
    result_endpoint="/v2/jobs/generateClaims/{job_id}",
)
print("total claims:", claims_result["total_claims"])

# 3) Resynthesize report using a gene_key, auto-waiting for completion
report = client.diligence_synthesize_report(
    gene_key="acad8",
    wait=True,
)
print(report["sections"][0]["title"])

# 4) Deep research with automatic polling
deep = client.diligence_deep_research(
    query="CRISPR applications in cancer therapy",
    wait=True,
)
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"

or pass it when constructing the client:

from omtx import OMTXClient

client = OMTXClient(api_key="your-api-key")

Usage examples

Error handling and context manager

from omtx import OMTXClient, InsufficientCreditsError, OMTXError

with OMTXClient() as client:
    try:
        report = client.diligence_synthesize_report(gene_key="acad8", wait=True)
    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.access_unlock(protein_uuid="aa11bb22", gene_name="KRAS")

# 2) Stream the private dataset
stream = client.data_access_selective_stream(
    dataset="private",
    protein_uuid="aa11bb22",
    limit=100_000,
    fmt="csv",
)

print("Rows:", stream.headers.get("X-Row-Count"))
with open("kras_selective.csv", "wb") as fh:
    for chunk in stream.iter_bytes():
        fh.write(chunk)
stream.close()

Gene key discovery

from omtx import OMTXClient

client = OMTXClient()
gene_keys = client.diligence_list_gene_keys(min_true=5)
print(gene_keys["items"][:5])

Available helper methods

  • diligence_generate_claims(target, prompt, wait=False)
  • diligence_synthesize_report(gene_key, wait=False)
  • diligence_deep_research(query, wait=False, …)
  • diligence_list_gene_keys(min_true=1, …)
  • jobs_history(...), job_status(job_id), wait_for_job(job_id, …)
  • access_unlock(protein_uuid, gene_name=None), list_access_unlocks()
  • data_access_selective_stream(...), data_access_points_stream(...)
  • data_access_selective_stats(...), data_access_points_stats(...)
  • credits(), health()

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.3.0.tar.gz (10.6 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.3.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for omtx-0.3.0.tar.gz
Algorithm Hash digest
SHA256 26195fc8bb9010775a8e12e66f5f113dbce58a6a2807a7b994607233df6b488f
MD5 b2b49a79a0946d2a97690323db29b556
BLAKE2b-256 142e5b0e0723765b12900edaed8a5064e2e7504d50806e0527a7fda094a3a522

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for omtx-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 917afe07c3c91e4f9f4bf346f62c1bc6ebc1f7283f89ac0a2023884d463da13b
MD5 fd416d94c2ab14ccac092c2b04edcd66
BLAKE2b-256 f5f1f255280e1b1d95158aa1dc9d53aa661a7af2ba65c67c260a8a1bbcc713a3

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