mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-08 03:10:24 +00:00
fix(llm): enhance rate limit error detection in base LLM implementation
This commit is contained in:
parent
ff7d25e313
commit
c3c7b5a4a0
1 changed files with 10 additions and 2 deletions
|
|
@ -402,7 +402,11 @@ class BaseLLM(ABC):
|
|||
# Check if this is an inappropriate content error
|
||||
error_message = str(e.args[0]) if e.args else str(e)
|
||||
is_inappropriate_content = "inappropriate content" in error_message.lower()
|
||||
is_rate_limit_error = "request rate increased too quickly" in error_message.lower()
|
||||
is_rate_limit_error = (
|
||||
"request rate increased too quickly" in error_message.lower() or
|
||||
"exceeded your current quota" in error_message.lower() or
|
||||
"insufficient_quota" in error_message.lower()
|
||||
)
|
||||
|
||||
if is_inappropriate_content:
|
||||
logger.error(f"chat with model={effective_model} detected inappropriate content error")
|
||||
|
|
@ -475,7 +479,11 @@ class BaseLLM(ABC):
|
|||
# Check if this is an inappropriate content error
|
||||
error_message = str(e.args[0]) if e.args else str(e)
|
||||
is_inappropriate_content = "inappropriate content" in error_message.lower()
|
||||
is_rate_limit_error = "request rate increased too quickly" in error_message.lower()
|
||||
is_rate_limit_error = (
|
||||
"request rate increased too quickly" in error_message.lower() or
|
||||
"exceeded your current quota" in error_message.lower() or
|
||||
"insufficient_quota" in error_message.lower()
|
||||
)
|
||||
|
||||
if is_inappropriate_content:
|
||||
logger.error(f"chat sync with model={effective_model} detected inappropriate content error")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue