feat: Handle errors, retries, and improve response types#302
Conversation
| docs = self.ranker.get_top_n(query=self.input_text, limit=5) | ||
| return docs | ||
|
|
||
| @retry(stop=stop_after_attempt(3), wait=wait_fixed(1)) |
There was a problem hiding this comment.
I wasn't quite sure how we'd want to handle retries, but this felt like a fine starting point. In reality, I imagine if we need to spend more than a few second retrying (e.g. the user is rate limited or the service is down), we probably do not want to be retrying at all. Our user is still trying to write a document within Refstudio, even if the AI functionality is not working.
Codecov Report
@@ Coverage Diff @@
## main #302 +/- ##
==========================================
+ Coverage 85.52% 85.59% +0.07%
==========================================
Files 132 132
Lines 7310 7346 +36
Branches 775 775
==========================================
+ Hits 6252 6288 +36
Misses 1045 1045
Partials 13 13
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@cguedes @sehyod I pushed this with
no-verifysince I figured we might have some discussion on the typing changes. Leaving as draft for now, but please feel free to add your feedback.fixes #85 and allows errors to be return within the sidecar response types
For now, I'm passing through the exception in the
message, but I figured this PR would lead to some follow-up discussion on what we'd want to see on errors.Ok
Error