omtx 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- omtx-0.4.1/LICENSE +23 -0
- omtx-0.4.1/PKG-INFO +216 -0
- omtx-0.4.1/README.md +170 -0
- omtx-0.4.1/omtx/__init__.py +19 -0
- omtx-0.4.1/omtx/client.py +812 -0
- omtx-0.4.1/omtx/exceptions.py +28 -0
- omtx-0.4.1/omtx/py.typed +1 -0
- omtx-0.4.1/omtx.egg-info/PKG-INFO +216 -0
- omtx-0.4.1/omtx.egg-info/SOURCES.txt +14 -0
- omtx-0.4.1/omtx.egg-info/dependency_links.txt +1 -0
- omtx-0.4.1/omtx.egg-info/requires.txt +1 -0
- omtx-0.4.1/omtx.egg-info/top_level.txt +1 -0
- omtx-0.4.1/pyproject.toml +28 -0
- omtx-0.4.1/setup.cfg +4 -0
- omtx-0.4.1/setup.py +49 -0
- omtx-0.4.1/tests/test_client.py +254 -0
omtx-0.4.1/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 OMTX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
omtx-0.4.1/PKG-INFO
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omtx
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: Python SDK for Om
|
|
5
|
+
Home-page: https://github.com/omtx/python-sdk
|
|
6
|
+
Author: Om
|
|
7
|
+
Author-email: Om <hello@omtx.ai>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2025 OMTX
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Project-URL: Homepage, https://github.com/omtx-ai/om-public
|
|
33
|
+
Project-URL: Issues, https://github.com/omtx-ai/om-public/issues
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Operating System :: OS Independent
|
|
37
|
+
Classifier: Typing :: Typed
|
|
38
|
+
Requires-Python: >=3.9
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: requests>=2.31.0
|
|
42
|
+
Dynamic: author
|
|
43
|
+
Dynamic: home-page
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
Dynamic: requires-python
|
|
46
|
+
|
|
47
|
+
# OMTX Python SDK
|
|
48
|
+
|
|
49
|
+
Lightweight helper for the OM Gateway. Queue diligence jobs, poll for results, and unlock/stream private data sets.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install omtx
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick start
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from omtx import OMTXClient
|
|
61
|
+
|
|
62
|
+
client = OMTXClient() # picks up OMTX_API_KEY
|
|
63
|
+
|
|
64
|
+
# 1) Generate claims (returns 202 + job_id)
|
|
65
|
+
claims_job = client.diligence_generate_claims(
|
|
66
|
+
target="BRAF",
|
|
67
|
+
prompt="Summarize known inhibitors"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# 2) Check status immediately (returns metadata + payload when ready)
|
|
71
|
+
job_record = client.jobs.status(claims_job["job_id"])
|
|
72
|
+
print(job_record["status"])
|
|
73
|
+
|
|
74
|
+
# 3) Optionally wait for completion (defaults to a 1 hour timeout)
|
|
75
|
+
claims_result = client.jobs.wait(
|
|
76
|
+
claims_job["job_id"],
|
|
77
|
+
result_endpoint="/v2/jobs/generateClaims/{job_id}",
|
|
78
|
+
)
|
|
79
|
+
print("total claims:", claims_result["total_claims"])
|
|
80
|
+
|
|
81
|
+
# 4) Kick off report synthesis (returns job metadata)
|
|
82
|
+
report_job = client.diligence.synthesize_report(gene_key="acad8")
|
|
83
|
+
report = client.jobs.wait(
|
|
84
|
+
report_job["job_id"],
|
|
85
|
+
result_endpoint="/v2/jobs/synthesizeReport/{job_id}",
|
|
86
|
+
)
|
|
87
|
+
print(report["sections"][0]["title"])
|
|
88
|
+
|
|
89
|
+
# 5) Deep research job (poll with jobs.wait when ready)
|
|
90
|
+
deep_job = client.diligence.deep_research(
|
|
91
|
+
query="CRISPR applications in cancer therapy",
|
|
92
|
+
)
|
|
93
|
+
deep = client.jobs.wait(
|
|
94
|
+
deep_job["job_id"],
|
|
95
|
+
result_endpoint="/v2/jobs/deep-research/{job_id}",
|
|
96
|
+
)
|
|
97
|
+
print(deep["final_report"][:400])
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Setup
|
|
101
|
+
|
|
102
|
+
### Get an API key
|
|
103
|
+
|
|
104
|
+
1. Sign up at [https://omtx.ai](https://omtx.ai)
|
|
105
|
+
2. Generate an API key from the dashboard
|
|
106
|
+
|
|
107
|
+
### Provide the API key
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
export OMTX_API_KEY="your-api-key"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
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`).
|
|
114
|
+
|
|
115
|
+
Or pass both API key and base URL when constructing the client:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from omtx import OMTXClient
|
|
119
|
+
|
|
120
|
+
client = OMTXClient(
|
|
121
|
+
api_key="your-api-key",
|
|
122
|
+
base_url="https://api-gateway-129153908223.us-central1.run.app",
|
|
123
|
+
)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Usage examples
|
|
127
|
+
|
|
128
|
+
### Error handling and context manager
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from omtx import OMTXClient, InsufficientCreditsError, OMTXError
|
|
132
|
+
|
|
133
|
+
with OMTXClient() as client:
|
|
134
|
+
try:
|
|
135
|
+
job = client.diligence.synthesize_report(gene_key="acad8")
|
|
136
|
+
report = client.jobs.wait(
|
|
137
|
+
job["job_id"], result_endpoint="/v2/jobs/synthesizeReport/{job_id}"
|
|
138
|
+
)
|
|
139
|
+
except InsufficientCreditsError:
|
|
140
|
+
print("Add credits before running resynthesis jobs.")
|
|
141
|
+
except OMTXError as exc:
|
|
142
|
+
print(f"Gateway call failed: {exc}")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Selective data access
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from omtx import OMTXClient
|
|
149
|
+
|
|
150
|
+
client = OMTXClient()
|
|
151
|
+
|
|
152
|
+
# 1) Unlock a dataset (consumes one Access Credit)
|
|
153
|
+
client.binders.unlock(protein_uuid="aa11bb22", gene_name="KRAS")
|
|
154
|
+
|
|
155
|
+
# 2) Stream the private dataset
|
|
156
|
+
stream = client.binders.selectivity.stream(
|
|
157
|
+
protein_uuid="aa11bb22",
|
|
158
|
+
limit=100_000,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
df = stream.to_dataframe()
|
|
162
|
+
print("Rows:", len(df))
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Gene key discovery
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from omtx import OMTXClient
|
|
169
|
+
|
|
170
|
+
client = OMTXClient()
|
|
171
|
+
gene_keys = client.diligence.list_gene_keys()
|
|
172
|
+
print(gene_keys["items"][:5])
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Retries & idempotency
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from omtx import OMTXClient
|
|
179
|
+
|
|
180
|
+
client = OMTXClient()
|
|
181
|
+
|
|
182
|
+
# Every POST call receives a timestamp-based idempotency key automatically.
|
|
183
|
+
claims = client.diligence.generate_claims(
|
|
184
|
+
target="BRAF",
|
|
185
|
+
prompt="Summarize inhibitors",
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Available helper methods
|
|
190
|
+
|
|
191
|
+
- `diligence.generate_claims(target, prompt)`
|
|
192
|
+
- `diligence.synthesize_report(gene_key)`
|
|
193
|
+
- `diligence.deep_research(query)`
|
|
194
|
+
- `diligence.list_gene_keys()` (fetches all keys)
|
|
195
|
+
- `jobs.history(...)`, `jobs.status(job_id)`, `jobs.wait(job_id, …)`
|
|
196
|
+
- `binders.unlock(protein_uuid, gene_name=None)`, `binders.list_unlocks()`
|
|
197
|
+
- `binders.selectivity.stream|stats|cost_estimate(...)`
|
|
198
|
+
- `binders.public/private/community/decoys.stream|cost_estimate(...)`
|
|
199
|
+
- `pricing.manifest()`, `pricing.cost_estimate(...)`
|
|
200
|
+
- `gateway.status()`
|
|
201
|
+
- `users.profile()`
|
|
202
|
+
|
|
203
|
+
## Requirements
|
|
204
|
+
|
|
205
|
+
- Python 3.9 or higher
|
|
206
|
+
- An OMTX API key
|
|
207
|
+
|
|
208
|
+
## Support
|
|
209
|
+
|
|
210
|
+
- Email: support@omtx.ai
|
|
211
|
+
- Docs: https://docs.omtx.ai
|
|
212
|
+
- Issues: https://github.com/omtx/python-sdk/issues
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT License – see `LICENSE` for details.
|
omtx-0.4.1/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# OMTX Python SDK
|
|
2
|
+
|
|
3
|
+
Lightweight helper for the OM Gateway. Queue diligence jobs, poll for results, and unlock/stream private data sets.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install omtx
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from omtx import OMTXClient
|
|
15
|
+
|
|
16
|
+
client = OMTXClient() # picks up OMTX_API_KEY
|
|
17
|
+
|
|
18
|
+
# 1) Generate claims (returns 202 + job_id)
|
|
19
|
+
claims_job = client.diligence_generate_claims(
|
|
20
|
+
target="BRAF",
|
|
21
|
+
prompt="Summarize known inhibitors"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# 2) Check status immediately (returns metadata + payload when ready)
|
|
25
|
+
job_record = client.jobs.status(claims_job["job_id"])
|
|
26
|
+
print(job_record["status"])
|
|
27
|
+
|
|
28
|
+
# 3) Optionally wait for completion (defaults to a 1 hour timeout)
|
|
29
|
+
claims_result = client.jobs.wait(
|
|
30
|
+
claims_job["job_id"],
|
|
31
|
+
result_endpoint="/v2/jobs/generateClaims/{job_id}",
|
|
32
|
+
)
|
|
33
|
+
print("total claims:", claims_result["total_claims"])
|
|
34
|
+
|
|
35
|
+
# 4) Kick off report synthesis (returns job metadata)
|
|
36
|
+
report_job = client.diligence.synthesize_report(gene_key="acad8")
|
|
37
|
+
report = client.jobs.wait(
|
|
38
|
+
report_job["job_id"],
|
|
39
|
+
result_endpoint="/v2/jobs/synthesizeReport/{job_id}",
|
|
40
|
+
)
|
|
41
|
+
print(report["sections"][0]["title"])
|
|
42
|
+
|
|
43
|
+
# 5) Deep research job (poll with jobs.wait when ready)
|
|
44
|
+
deep_job = client.diligence.deep_research(
|
|
45
|
+
query="CRISPR applications in cancer therapy",
|
|
46
|
+
)
|
|
47
|
+
deep = client.jobs.wait(
|
|
48
|
+
deep_job["job_id"],
|
|
49
|
+
result_endpoint="/v2/jobs/deep-research/{job_id}",
|
|
50
|
+
)
|
|
51
|
+
print(deep["final_report"][:400])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Setup
|
|
55
|
+
|
|
56
|
+
### Get an API key
|
|
57
|
+
|
|
58
|
+
1. Sign up at [https://omtx.ai](https://omtx.ai)
|
|
59
|
+
2. Generate an API key from the dashboard
|
|
60
|
+
|
|
61
|
+
### Provide the API key
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
export OMTX_API_KEY="your-api-key"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
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`).
|
|
68
|
+
|
|
69
|
+
Or pass both API key and base URL when constructing the client:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from omtx import OMTXClient
|
|
73
|
+
|
|
74
|
+
client = OMTXClient(
|
|
75
|
+
api_key="your-api-key",
|
|
76
|
+
base_url="https://api-gateway-129153908223.us-central1.run.app",
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Usage examples
|
|
81
|
+
|
|
82
|
+
### Error handling and context manager
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from omtx import OMTXClient, InsufficientCreditsError, OMTXError
|
|
86
|
+
|
|
87
|
+
with OMTXClient() as client:
|
|
88
|
+
try:
|
|
89
|
+
job = client.diligence.synthesize_report(gene_key="acad8")
|
|
90
|
+
report = client.jobs.wait(
|
|
91
|
+
job["job_id"], result_endpoint="/v2/jobs/synthesizeReport/{job_id}"
|
|
92
|
+
)
|
|
93
|
+
except InsufficientCreditsError:
|
|
94
|
+
print("Add credits before running resynthesis jobs.")
|
|
95
|
+
except OMTXError as exc:
|
|
96
|
+
print(f"Gateway call failed: {exc}")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Selective data access
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from omtx import OMTXClient
|
|
103
|
+
|
|
104
|
+
client = OMTXClient()
|
|
105
|
+
|
|
106
|
+
# 1) Unlock a dataset (consumes one Access Credit)
|
|
107
|
+
client.binders.unlock(protein_uuid="aa11bb22", gene_name="KRAS")
|
|
108
|
+
|
|
109
|
+
# 2) Stream the private dataset
|
|
110
|
+
stream = client.binders.selectivity.stream(
|
|
111
|
+
protein_uuid="aa11bb22",
|
|
112
|
+
limit=100_000,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
df = stream.to_dataframe()
|
|
116
|
+
print("Rows:", len(df))
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Gene key discovery
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from omtx import OMTXClient
|
|
123
|
+
|
|
124
|
+
client = OMTXClient()
|
|
125
|
+
gene_keys = client.diligence.list_gene_keys()
|
|
126
|
+
print(gene_keys["items"][:5])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Retries & idempotency
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from omtx import OMTXClient
|
|
133
|
+
|
|
134
|
+
client = OMTXClient()
|
|
135
|
+
|
|
136
|
+
# Every POST call receives a timestamp-based idempotency key automatically.
|
|
137
|
+
claims = client.diligence.generate_claims(
|
|
138
|
+
target="BRAF",
|
|
139
|
+
prompt="Summarize inhibitors",
|
|
140
|
+
)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Available helper methods
|
|
144
|
+
|
|
145
|
+
- `diligence.generate_claims(target, prompt)`
|
|
146
|
+
- `diligence.synthesize_report(gene_key)`
|
|
147
|
+
- `diligence.deep_research(query)`
|
|
148
|
+
- `diligence.list_gene_keys()` (fetches all keys)
|
|
149
|
+
- `jobs.history(...)`, `jobs.status(job_id)`, `jobs.wait(job_id, …)`
|
|
150
|
+
- `binders.unlock(protein_uuid, gene_name=None)`, `binders.list_unlocks()`
|
|
151
|
+
- `binders.selectivity.stream|stats|cost_estimate(...)`
|
|
152
|
+
- `binders.public/private/community/decoys.stream|cost_estimate(...)`
|
|
153
|
+
- `pricing.manifest()`, `pricing.cost_estimate(...)`
|
|
154
|
+
- `gateway.status()`
|
|
155
|
+
- `users.profile()`
|
|
156
|
+
|
|
157
|
+
## Requirements
|
|
158
|
+
|
|
159
|
+
- Python 3.9 or higher
|
|
160
|
+
- An OMTX API key
|
|
161
|
+
|
|
162
|
+
## Support
|
|
163
|
+
|
|
164
|
+
- Email: support@omtx.ai
|
|
165
|
+
- Docs: https://docs.omtx.ai
|
|
166
|
+
- Issues: https://github.com/omtx/python-sdk/issues
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT License – see `LICENSE` for details.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""OMTX Python SDK - Client for OM Gateway V2.
|
|
2
|
+
|
|
3
|
+
Includes:
|
|
4
|
+
- OMTXClient: Explicit client with automatic idempotency and typed methods
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .client import OMTXClient, JobTimeoutError
|
|
8
|
+
from .exceptions import OMTXError, InsufficientCreditsError, AuthenticationError
|
|
9
|
+
|
|
10
|
+
# edit the version below here!
|
|
11
|
+
__version__ = "0.4.1"
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"OMTXClient",
|
|
15
|
+
"OMTXError",
|
|
16
|
+
"InsufficientCreditsError",
|
|
17
|
+
"AuthenticationError",
|
|
18
|
+
"JobTimeoutError",
|
|
19
|
+
]
|