feat: Response 429 if ThrottlingException (#91)
This commit is contained in:
@@ -178,6 +178,9 @@ class BedrockModel(BaseChatModel):
|
|||||||
except bedrock_runtime.exceptions.ValidationException as e:
|
except bedrock_runtime.exceptions.ValidationException as e:
|
||||||
logger.error("Validation Error: " + str(e))
|
logger.error("Validation Error: " + str(e))
|
||||||
raise HTTPException(status_code=400, detail=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:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
raise HTTPException(status_code=500, detail=str(e))
|
raise HTTPException(status_code=500, detail=str(e))
|
||||||
@@ -762,6 +765,9 @@ class BedrockEmbeddingsModel(BaseEmbeddingsModel, ABC):
|
|||||||
except bedrock_runtime.exceptions.ValidationException as e:
|
except bedrock_runtime.exceptions.ValidationException as e:
|
||||||
logger.error("Validation Error: " + str(e))
|
logger.error("Validation Error: " + str(e))
|
||||||
raise HTTPException(status_code=400, detail=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:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
raise HTTPException(status_code=500, detail=str(e))
|
raise HTTPException(status_code=500, detail=str(e))
|
||||||
|
|||||||
Reference in New Issue
Block a user