Skip to content

Commit 4eb0dd1

Browse files
authored
handle the server-overloaded case (#261)
Depends on #260 This PR handles the `server-overloaded` case from the infini-gram API and raises a relevant error for the client.
1 parent 9444c6b commit 4eb0dd1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/attribution/attribution_service.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ def get_attribution(
213213
attribution_response.title,
214214
str(attribution_response.detail),
215215
)
216+
217+
if attribution_response.type_ == "server-overloaded":
218+
raise exceptions.ServiceUnavailable(
219+
description="OLMoTrace is currently overloaded. Please try again later."
220+
)
221+
216222
raise exceptions.InternalServerError(
217223
description=f"infini-gram API reported an error: {attribution_response.title}"
218224
)

0 commit comments

Comments
 (0)