Closed saum7800 closed 1 year ago
oh - what was the breaking change? Happy to take a look as well @neubig
No worries @krrishdholakia , probably just a minor conflict: https://github.com/neulab/prompt2model/pull/328/conflicts
ah yes, just a minor conflict, will update my PR
Ok, sounds good. Thanks for the merge!
Updated the PR. Feel free to review whenever you get a chance @viswavi / @neubig
Description
Currently the
OpenAIInstructionParser
handles OpenAI exceptions from its own class. With this change, the exception is handled as required directly from theChatGPTAgent
. Refactoring the exception handling is a step in the direction of converting theOpenAIInstructionParser
to a more generalInstructionParser
class that can be passed any Generative Agent (OpenAI, cohere, local hf models, etc).Key Changes
handle_openai_error
returns the handled error instead of the number of API callsOpenAIInstructionParser
checks for the response being an exception or an actual response and continues the same logic as previously specified. This pattern will be extendable to future models.prompt_parser
test modified to mock the exact function that would be throwing the error in use.