Conditional statement expanded for errored API response (close #560) #628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solved endless loop and hanging UI by extending our error catching by expanding conditional check to properties.
Description
Solved endless loop and hanging UI by extending our error catching. We were getting an uncaught exception because response['content'} was throwing a KeyError when response does not contain a 'content' property.
Related Issues
Resolves #560 #272
Solution and Design
If we capture the case of a missing property AND the response['content'] is None. Execution continues and we hit max retry threshold. Original user behavior stays intact because we are not changing the error handling mechanism. Since we are properly catching errors now we let the UI show the user that the maximum number of retries have been attempted.
Small fixes:
Account for the case when we have no content in our response
Surround execution with try catch to follow existing design:
Test Plan
While there is no test class for
super_agi.py
you can see the manual testing below.https://www.loom.com/share/028e80623061493a8c167f1aa0df5edb?sid=29e496ec-62ba-4bed-b809-25cf29cd88de
Type of change
Checklist