PyRIT
PyRIT copied to clipboard
FEAT: Centralize Exception Handling and Implement in GPTv Target
- Centralized Exception Handling
- Adding exception handling to the Azure OpenAI GPT V chat target to manage bad request errors, authentication errors, empty response and rate limit errors.
- Added section in contributing guide
Description
Tests and Documentation
Added tests
As part of this, can you take a stab at documenting what we should do? E.g. this is my best stab at a strategy, which is similar to but different from the one you have coded
- If the output is None or JSON can't parse (there is no json in this target but a lot of our scorers and stuff use json), retry a few times then
process_exception - If there is a RateLimitError, retry a few times then
process_exception - If there is an auth error, raise (stops execution).. this may not need a special case if our default is to raise
- If there is a BadRequestError caused by the filter, do not retry and
process_exception. If BadRequestError is caused by something else, throw - We may retry/process_exception other known cases as they come up?
- If there is an unknown exception... raise?