monarch-initiative / ontogpt

LLM-based ontological extraction tools, including SPIRES
https://monarch-initiative.github.io/ontogpt/
BSD 3-Clause "New" or "Revised" License
603 stars 76 forks source link

Better catching of HTTP 401 errors #443

Open caufieldjh opened 2 months ago

caufieldjh commented 2 months ago

Right now, if an API isn't accessible due to missing or incorrect credentials, litellm encounters the resulting 401 error. It looks like this:

Error code: 401 - {'error': {'message': 'Authentication Error, Invalid proxy server token passed', 'type': 'auth_error', 'param': 'None', 'code': '401'}}

That's fine, and that error should be raised, but when processing multiple documents with an extraction the process will just move on to the next document and yield an empty result for the current one. That isn't ideal in the case of missing auth as it won't resolve itself without user input.

Authentication errors should be a hard stop.

caufieldjh commented 2 months ago

Might want to add 429 errors, too.

caufieldjh commented 2 months ago

Related to #368