onepot 0.1.0__py3-none-any.whl
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.
- onepot/__init__.py +3 -0
- onepot/client.py +55 -0
- onepot/py.typed +0 -0
- onepot-0.1.0.dist-info/METADATA +71 -0
- onepot-0.1.0.dist-info/RECORD +6 -0
- onepot-0.1.0.dist-info/WHEEL +4 -0
onepot/__init__.py
ADDED
onepot/client.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Client:
|
|
5
|
+
def __init__(self, api_key: str):
|
|
6
|
+
self.api_key = api_key
|
|
7
|
+
self.base_url = "https://api.onepot.ai"
|
|
8
|
+
self.client = httpx.Client(
|
|
9
|
+
headers={"X-API-Key": api_key},
|
|
10
|
+
timeout=240.0,
|
|
11
|
+
follow_redirects=True,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
def search(
|
|
15
|
+
self,
|
|
16
|
+
smiles_list: list[str],
|
|
17
|
+
max_results: int = 100,
|
|
18
|
+
substructure_search: bool = False,
|
|
19
|
+
max_depth: int = 1,
|
|
20
|
+
include_chemistry_risk: bool = False,
|
|
21
|
+
include_chemistry_risk_score: bool = False,
|
|
22
|
+
):
|
|
23
|
+
"""Search for purchasable analogs of the given molecules.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
smiles_list: List of SMILES strings to search.
|
|
27
|
+
max_results: Maximum results per query (default 100).
|
|
28
|
+
substructure_search: Match substructures instead of similarity.
|
|
29
|
+
max_depth: Synthesis depth (currently only 1 supported).
|
|
30
|
+
include_chemistry_risk: Include chemistry_risk field (low/medium/high).
|
|
31
|
+
include_chemistry_risk_score: Include raw probability score (0-1).
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Dict with:
|
|
35
|
+
- queries: List of query results, each containing query_smiles, query_inchikey,
|
|
36
|
+
and results (list of {smiles, inchikey, similarity, supplier_risk, price_usd,
|
|
37
|
+
and optionally chemistry_risk/chemistry_risk_score}).
|
|
38
|
+
- credits_used: Number of credits consumed.
|
|
39
|
+
- credits_remaining: Remaining credit balance.
|
|
40
|
+
"""
|
|
41
|
+
resp = self.client.post(
|
|
42
|
+
f"{self.base_url}/v1/search",
|
|
43
|
+
json={
|
|
44
|
+
"smiles_list": smiles_list,
|
|
45
|
+
"max_results": max_results,
|
|
46
|
+
"substructure_search": substructure_search,
|
|
47
|
+
"max_depth": max_depth,
|
|
48
|
+
"include_chemistry_risk": include_chemistry_risk,
|
|
49
|
+
"include_chemistry_risk_score": include_chemistry_risk_score,
|
|
50
|
+
},
|
|
51
|
+
)
|
|
52
|
+
if not resp.is_success:
|
|
53
|
+
print(f"Error {resp.status_code}: {resp.text}")
|
|
54
|
+
resp.raise_for_status()
|
|
55
|
+
return resp.json()
|
onepot/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: onepot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the onepot API
|
|
5
|
+
Requires-Dist: httpx==0.28.1
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# onepot-api
|
|
10
|
+
|
|
11
|
+
Python client for the onepot API.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv add onepot
|
|
17
|
+
# or
|
|
18
|
+
pip install onepot
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from onepot import Client
|
|
25
|
+
|
|
26
|
+
client = Client(api_key="your-api-key")
|
|
27
|
+
|
|
28
|
+
response = client.search(
|
|
29
|
+
smiles_list=["Cc1c(C(=O)Nc2ccc(N3CC(C)OC(C)C3)nc2)cccc1-c1ccc(OC(F)(F)F)cc1", ...],
|
|
30
|
+
max_results=10,
|
|
31
|
+
include_chemistry_risk_score=True,
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Pricing
|
|
36
|
+
|
|
37
|
+
Credits are charged per SMILES in the query:
|
|
38
|
+
|
|
39
|
+
| Option | Credits per SMILES |
|
|
40
|
+
|--------|-------------------|
|
|
41
|
+
| Base search | 1 |
|
|
42
|
+
| `include_chemistry_risk=True` | 5 |
|
|
43
|
+
| `include_chemistry_risk_score=True` | 10 |
|
|
44
|
+
|
|
45
|
+
## Response Format
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
{
|
|
49
|
+
"queries": [
|
|
50
|
+
{
|
|
51
|
+
"query_smiles": "Cc1c(C(=O)Nc2ccc(N3CC(C)OC(C)C3)nc2)cccc1-c1ccc(OC(F)(F)F)cc1",
|
|
52
|
+
"query_inchikey": "VZZJRYRQSPEMTK-CALCHBBNSA-N",
|
|
53
|
+
"results": [
|
|
54
|
+
{
|
|
55
|
+
"smiles": "CCO",
|
|
56
|
+
"inchikey": "VZZJRYRQSPEMTK-CALCHBBNSA-N",
|
|
57
|
+
"similarity": 1.0,
|
|
58
|
+
"supplier_risk": "medium",
|
|
59
|
+
"price_usd": 250,
|
|
60
|
+
"chemistry_risk": "medium", # if include_chemistry_risk=True
|
|
61
|
+
"chemistry_risk_score": 0.5 # if include_chemistry_risk_score=True
|
|
62
|
+
},
|
|
63
|
+
...
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
...
|
|
67
|
+
],
|
|
68
|
+
"credits_used": 10,
|
|
69
|
+
"credits_remaining": 990
|
|
70
|
+
}
|
|
71
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
onepot/__init__.py,sha256=FnX9HH-2dXADluNfucg98JPMfruMoBpN9ER9lZkVQvQ,49
|
|
2
|
+
onepot/client.py,sha256=aAY5IHkFYoYY7nAy1dJxCtEVISzLEsUqQtvuqvEJV9w,2125
|
|
3
|
+
onepot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
onepot-0.1.0.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
|
|
5
|
+
onepot-0.1.0.dist-info/METADATA,sha256=rrfzrWDoWTGJ_AWptjBTAuB4mq8DtpvmJzk8JWKccf4,1592
|
|
6
|
+
onepot-0.1.0.dist-info/RECORD,,
|