rxn4chemistry / biocatalysis-model

RXN for biochemical reactions
MIT License
61 stars 14 forks source link

error when using the model #3

Closed hongxianglics closed 2 years ago

hongxianglics commented 2 years ago

Hi, I was trying to use the model, and I got this error. Could you please help me find out the problem? Thanks!

my code:

api_key = 'my api' from rxn4chemistry import RXN4ChemistryWrapper rxn4chemistry_wrapper = RXN4ChemistryWrapper(api_key=api_key)

rxn4chemistry_wrapper.create_project('test') 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(results['retrosynthetic_paths'][0])

my return:

response['prediction_id'] KeyError: 'prediction_id'

drugilsberg commented 2 years ago

hey @hongxianglics, what is the content of response? maybe the previous call simply failed, I suggest to introduce a sleep of 2 second after the project creation to make sure you do not do too frequent consecutive requests.

We have a mechanism in place to avoid dos attacks that will trigger errors in case requests are too frequent.

The constraints are:

The limitations are not so strict if you consider that the retro prediction on average can take a couple of minutes.