Closed jachermocilla closed 1 year ago
Hi @jachermocilla, the API is supporting this, but you most likely are hitting the rate limits. Can you share the code you are using?
Hi @drugilsberg . Here's the code. It's basically the same as the one in the README.md. I commented a few lines. API key is not the actual shown here. Thanks.
api_key = 'apk-xxxxx'
from rxn4chemistry import RXN4ChemistryWrapper
rxn4chemistry_wrapper = RXN4ChemistryWrapper(api_key=api_key)
# NOTE: you can create a project or set an esiting one using:
# rxn4chemistry_wrapper.set_project('PROJECT_ID')
rxn4chemistry_wrapper.create_project('test_wrapper')
print(rxn4chemistry_wrapper.project_id)
response = rxn4chemistry_wrapper.predict_automatic_retrosynthesis(
'OC1C(O)C=C(Br)C=C1', ai_model='enzymatic-2021-04-16'
)
#results = rxn4chemistry_wrapper.get_predict_automatic_retrosynthesis_results(
# response['prediction_id']
#)
#print(results['status'])
print(response)
# NOTE: upon 'SUCCESS' you can inspect the predicted retrosynthetic paths.
#print(results['retrosynthetic_paths'][0])
de. It's basically the same as the one in the README.md. I commented a few lines. API key is not the actual shown here. Thanks.
Thanks a lot for sharing this and sorry for the lack clarity, it's sufficient to put a couple of sleep here and there as the RXN API allow a maximum of 5 requests per minute and at least a second between consecutive calls. Here a suggested modification:
import time
api_key = 'apk-xxxxx'
from rxn4chemistry import RXN4ChemistryWrapper
rxn4chemistry_wrapper = RXN4ChemistryWrapper(api_key=api_key)
# NOTE: you can create a project or set an esiting one using:
# rxn4chemistry_wrapper.set_project('PROJECT_ID')
rxn4chemistry_wrapper.create_project('test_wrapper')
time.sleep(2)
print(rxn4chemistry_wrapper.project_id)
response = rxn4chemistry_wrapper.predict_automatic_retrosynthesis(
'OC1C(O)C=C(Br)C=C1', ai_model='enzymatic-2021-04-16'
)
time.sleep(30) # retros on average takes 2 minutes so here a sleep of 30 seconds is reasonable
#results = rxn4chemistry_wrapper.get_predict_automatic_retrosynthesis_results(
# response['prediction_id']
#)
#print(results['status'])
print(response)
# NOTE: upon 'SUCCESS' you can inspect the predicted retrosynthetic paths.
#print(results['retrosynthetic_paths'][0])
Great!It's working now. Thanks for your help. Will close the issue now.
Thanks to you, will also update the snippet.
Hello. I tried the example using an API key but I get this error. May I know if the API endpoint is still supported. Thanks.![image](https://user-images.githubusercontent.com/1525257/196396312-7ee2f5cf-ec2e-4088-9a44-7f4d92c0c5bb.png)