mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Catch rate limit (#124)
This commit is contained in:
parent
7954e863cc
commit
db4e1df0fb
1 changed files with 2 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ Input is prompt, output is response.
|
||||||
|
|
||||||
import google.generativeai as genai
|
import google.generativeai as genai
|
||||||
from google.generativeai.types import HarmCategory, HarmBlockThreshold
|
from google.generativeai.types import HarmCategory, HarmBlockThreshold
|
||||||
|
from google.api_core.exceptions import ResourceExhausted
|
||||||
from prometheus_client import Histogram
|
from prometheus_client import Histogram
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
@ -139,7 +140,7 @@ class Processor(ConsumerProducer):
|
||||||
|
|
||||||
# FIXME: Wrong exception, don't know what this LLM throws
|
# FIXME: Wrong exception, don't know what this LLM throws
|
||||||
# for a rate limit
|
# for a rate limit
|
||||||
except TooManyRequests:
|
except ResourceExhausted as e:
|
||||||
|
|
||||||
print("Send rate limit response...", flush=True)
|
print("Send rate limit response...", flush=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue