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"

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:
        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.1.tar.gz (10.8 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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: omtx-0.3.1.tar.gz
  • Upload date:
  • Size: 10.8 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.1.tar.gz
Algorithm Hash digest
SHA256 12162adf4ea0fcc7ae5d217927fdb11192a083f980bd9c68b1a253acc0e14d0a
MD5 a101c188d8b0d6398c9ac899bfdb6ed8
BLAKE2b-256 e73414f06478304813c3e2d9599f6b3582f7018335ab1ae1fa874fb4c133d065

See more details on using hashes here.

File details

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

File metadata

  • Download URL: omtx-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71969f51f443f8354a49064b9a7132466d7d29221c782c3d94f557ffa3e691a5
MD5 4c7ea43d73e5e1224d64c1433c5b2657
BLAKE2b-256 334272416e10e746b206bc1ad7883329a12b99ca8d4d4bf12e5265fc9909644a

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