diff --git a/src/api/models/bedrock.py b/src/api/models/bedrock.py index 4b58951..c05400c 100644 --- a/src/api/models/bedrock.py +++ b/src/api/models/bedrock.py @@ -178,6 +178,9 @@ def _invoke_bedrock(self, chat_request: ChatRequest, stream=False): except bedrock_runtime.exceptions.ValidationException as e: logger.error("Validation Error: " + str(e)) raise HTTPException(status_code=400, detail=str(e)) + except bedrock_runtime.exceptions.ThrottlingException as e: + logger.error("Throttling Error: " + str(e)) + raise HTTPException(status_code=429, detail=str(e)) except Exception as e: logger.error(e) raise HTTPException(status_code=500, detail=str(e)) @@ -724,6 +727,9 @@ def _invoke_model(self, args: dict, model_id: str): except bedrock_runtime.exceptions.ValidationException as e: logger.error("Validation Error: " + str(e)) raise HTTPException(status_code=400, detail=str(e)) + except bedrock_runtime.exceptions.ThrottlingException as e: + logger.error("Throttling Error: " + str(e)) + raise HTTPException(status_code=429, detail=str(e)) except Exception as e: logger.error(e) raise HTTPException(status_code=500, detail=str(e))