Skip to content

Commit

Permalink
Catch rate limit (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
cybermaggedon authored Oct 24, 2024
1 parent 7954e86 commit db4e1df
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import google.generativeai as genai
from google.generativeai.types import HarmCategory, HarmBlockThreshold
from google.api_core.exceptions import ResourceExhausted
from prometheus_client import Histogram
import os

Expand Down Expand Up @@ -139,7 +140,7 @@ def handle(self, msg):

# FIXME: Wrong exception, don't know what this LLM throws
# for a rate limit
except TooManyRequests:
except ResourceExhausted as e:

print("Send rate limit response...", flush=True)

Expand Down

0 comments on commit db4e1df

Please sign in to comment.