diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9352959fe..88f268157 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,5 +13,4 @@ repos: entry: python3 -m mypy --ignore-missing-imports language: system types: [python] - files: ^litellm/ - exclude: ^litellm/tests/ \ No newline at end of file + files: ^litellm/ \ No newline at end of file diff --git a/litellm/proxy/hooks/parallel_request_limiter.py b/litellm/proxy/hooks/parallel_request_limiter.py index d42a5739a..39cc73751 100644 --- a/litellm/proxy/hooks/parallel_request_limiter.py +++ b/litellm/proxy/hooks/parallel_request_limiter.py @@ -48,6 +48,9 @@ class MaxParallelRequestsHandler(CustomLogger): if user_api_key is None: return + if self.user_api_key_cache is None: + return + request_count_api_key = f"{user_api_key}_request_count" # check if it has collected an entire stream response self.print_verbose(f"'complete_streaming_response' is in kwargs: {'complete_streaming_response' in kwargs}") @@ -67,6 +70,9 @@ class MaxParallelRequestsHandler(CustomLogger): if api_key is None: return + if self.user_api_key_cache is None: + return + ## decrement call count if call failed if (hasattr(original_exception, "status_code") and original_exception.status_code == 429 diff --git a/litellm/tests/test_streaming.py b/litellm/tests/test_streaming.py index e02440e8d..818ee6664 100644 --- a/litellm/tests/test_streaming.py +++ b/litellm/tests/test_streaming.py @@ -1003,8 +1003,6 @@ def test_together_ai_completion_call_mistral(): print(f"error occurred: {traceback.format_exc()}") pass -test_together_ai_completion_call_starcoder() - def test_together_ai_completion_call_starcoder_bad_key(): try: api_key = "bad-key"