Catch rate limit (#124)

This commit is contained in:
cybermaggedon 2024-10-25 00:01:40 +01:00 committed by GitHub
parent 7954e863cc
commit db4e1df0fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ Input is prompt, output is response.
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
@ -139,7 +140,7 @@ class Processor(ConsumerProducer):
# 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)