-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Opik 640 sdk improve ux in evaluate function when provider rate limit…
… exceeded (#923) * Add rate limit message to metrics calculation step in evaluate flow * Add exception_analyzer.is_llm_provider_rate_limit_error check to user defined task object * Fix lint errors * Suppress debug info for litellm * Fix lint errors * Small refactor in exception_analyzer * Fix lint errors
- Loading branch information
1 parent
6070d73
commit ad165a6
Showing
4 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import openai | ||
import litellm.exceptions | ||
|
||
|
||
def is_llm_provider_rate_limit_error(exception: Exception) -> bool: | ||
rate_limit_error_known_types = ( | ||
openai.RateLimitError, | ||
litellm.exceptions.RateLimitError, | ||
) | ||
|
||
is_rate_limit_error = isinstance(exception, rate_limit_error_known_types) or ( | ||
hasattr(exception, "status_code") and exception.status_code == 429 | ||
) | ||
|
||
return is_rate_limit_error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters