Skip to content

Commit

Permalink
🔖 chore: update Gemini retry/disable rules
Browse files Browse the repository at this point in the history
  • Loading branch information
MartialBE committed Dec 28, 2024
1 parent a8860a9 commit faa5090
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions controller/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var containsKeywords = []string{
"You exceeded your current quota", // openai
"Permission denied", // gcp
"Quota exceeded for quota metric", // gemini
"API key not valid", // gemini
"The security token included in the request is invalid", //AWS
"Operation not allowed", //AWS
"Your account is not authorized", //AWS
Expand Down
4 changes: 4 additions & 0 deletions relay/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ func shouldRetryBadRequest(channelType int, apiErr *types.OpenAIErrorWithStatusC
case config.ChannelTypeBedrock:
return strings.Contains(apiErr.OpenAIError.Message, "Operation not allowed")
default:
// gemini
if apiErr.OpenAIError.Param == "INVALID_ARGUMENT" && strings.Contains(apiErr.OpenAIError.Message, "API key not valid") {
return true
}
return false
}
}
Expand Down

0 comments on commit faa5090

Please sign in to comment.