LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2972 [MISC] Improve global rate limit error message for better user experience (#1652)
Ritwik G057420fa4a40
diff --git a/backend/api_v2/exceptions.py b/backend/api_v2/exceptions.pyindex 7dab3c178..246788bff 100644--- a/backend/api_v2/exceptions.py+++ b/backend/api_v2/exceptions.py@@ -82,9 +82,7 @@ class RateLimitExceeded(APIException):current_usage=current_usage, limit=limit)else:- detail = RateLimitMessages.get_global_limit_exceeded_message(- current_usage=current_usage, limit=limit- )+ detail = RateLimitMessages.get_global_limit_exceeded_message()super().__init__(detail, code)diff --git a/backend/api_v2/rate_limit_constants.py b/backend/api_v2/rate_limit_constants.pyindex 069171cad..045ade15e 100644--- a/backend/api_v2/rate_limit_constants.py+++ b/backend/api_v2/rate_limit_constants.py@@ -94,8 +94,8 @@ class RateLimitMessages:)GLOBAL_LIMIT_EXCEEDED_TEMPLATE = (- "System has reached the global maximum concurrent API requests limit "- "({current_usage}/{limit}). Please try again later."+ "Our system is currently experiencing high load. "+ "Please try again in a few moments.")LOCK_ACQUISITION_FAILED = "Failed to acquire rate limit lock. Please try again."@@ -110,8 +110,9 @@ class RateLimitMessages:)@classmethod- def get_global_limit_exceeded_message(cls, current_usage: int, limit: int) -> str:- """Get formatted global limit exceeded message."""- return cls.GLOBAL_LIMIT_EXCEEDED_TEMPLATE.format(- current_usage=current_usage, limit=limit- )+ def get_global_limit_exceeded_message(cls) -> str:+ """Get generic global limit exceeded message.++ Returns a user-friendly message without exposing system capacity.+ """+ return cls.GLOBAL_LIMIT_EXCEEDED_TEMPLATEdiff --git a/docs/API_DEPLOYMENT_RATE_LIMITING.md b/docs/API_DEPLOYMENT_RATE_LIMITING.mdindex a7465b530..ee5ec8c48 100644--- a/docs/API_DEPLOYMENT_RATE_LIMITING.md+++ b/docs/API_DEPLOYMENT_RATE_LIMITING.md@@ -406,6 +406,7 @@ Content-Type: application/jsonWhen rate limit is exceeded, API returns 429 with a standardized error response:+#### Organization Limit Exceeded```httpHTTP/1.1 429 Too Many RequestsContent-Type: application/json@@ -422,12 +423,29 @@ Content-Type: application/json}```+#### Global Limit Exceeded (System Overload)+```http+HTTP/1.1 429 Too Many Requests+Content-Type: application/json++{+ "type": "client_error",+ "errors": [+ {+ "code": "error",+ "detail": "Our system is currently experiencing high load. Please try again in a few moments.",+ "attr": null+ }+ ]+}+```+**Response Format**:The error response follows the `drf-standardized-errors` format used throughout the application:- `type`: Error type (always `"client_error"` for 429)- `errors`: Array of error objects- `code`: Error code (always `"error"`)- - `detail`: Human-readable error message with current usage and limit+ - `detail`: Human-readable error message- `attr`: Field name (null for non-field errors)**Note**: Clients should implement their own retry logic with exponential backoff. The rate limit will be released once active requests complete.