Fail Vertex AI requests that return a blocked response due to the content filter.
It's been noticed that the Vertex API has been content-blocking the responses relating to vulnerability explanations intermittently.
As rerunning of the request can occasionally result in a response from the AI, we want to detect the "safetyAttributes"=>{"blocked"=>true}
value in the AI response, and raise an error so that the CircuitBreaker exponential backoff automatically retries the request under these circumstances, and if that still fails, ultimately causes the failure to raise to our Sentry logs.
Implementation Plan
-
backend raise an error when the the Explain This Vulnerability ai response contains "safetyAttributes"=>{"blocked"=>true}
to trigger retries
Edited by Gregory Havenga