I’ve been using the Gemini Pro API (vertexai.generative_models) with the BLOCK_NONE safety_config, but starting today, I’m getting a “400 Request contains an invalid argument.” error when using it. Was there a change in specifications?
Seeing the same error, starting today. Also the docs seem to be updated but not in sync with the actual API ![]()
Using the official example from here https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/configure-safety-attributes#example_curl_command
LOCATION="us-central1"
MODEL_ID="gemini-1.0-pro"
PROJECT_ID="test-project"
curl \
-X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://${LOCATION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL_ID}:streamGenerateContent -d \
$'{
"contents": {
"role": "user",
"parts": { "text": "Hello!" }
},
"safety_settings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_LOW_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_ONLY_HIGH"
}
]
}'
Returns the following 400 error:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
But works fine if you replace BLOCK_NONE with BLOCK_ONLY_HIGH
Facing the same issue any solutions?
Facing the same issue for the last 2 days. It seems to be something that they changed on the backend of the API. The error message works well when specifying something that is not allowed. I’m working with Google Engineers, I’ll keep you posted!
with “BLOCK_NONE”:
[{'error': {'code': 400, 'message': 'Request contains an invalid argument.', 'status': 'INVALID_ARGUMENT'}}]
With any other filter, it works, even if I invent the value I get another message:
[{'error': {'code': 400, 'message': 'Invalid value at 'safety_settings[0].threshold' (type.googleapis.com/google.cloud.aiplatform.v1.SafetySetting.HarmBlockThreshold), "BLOCK"', 'status': 'INVALIDARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'safety_settings[0].threshold', 'description': 'Invalid value at 'safety_settings[0].threshold' (type.googleapis.com/google.cloud.aiplatform.v1.SafetySetting.HarmBlockThreshold), "BLOCK"'}]}]}}]
Apparently the docs got updated. It now states that you need monthly billing in order to use BLOCK_NONE. Not sure what’s the reasoning behind that.
Important: In order to access the “BLOCK_NONE” setting, you may switch your account type to monthly invoiced billing …
Hello guys!
new update here I got from Google engineers yesterday, they changed the requisite to use “BLOCK_NONE”, no you need to have an “invoiced” type of billing account. So let me paste here information about requirements and links:
Requirements to convert your account to invoiced (this is making Gemini useless for startups that need the “BLOCK_NONE”):
- Being registered as a business for a minimum of one year.
- Spending a minimum of $2,500 a month for the last 3 months.
Answer from Google:
- To use it, you now need to be on an account type that is invoiced.
- The documentation at https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/configure-safety-attributes#safety_settings
Thank you for posting valuable information!! and Ohh my, we are a startup dealing with a big government project, it seems I need to consider switching to either Microsoft or AWS. ![]()
Thank you bro!!!
I’m getting the same error all of a sudden. Something must of changed in the last week as it worked fine a week ago…
google.api_core.exceptions.InvalidArgument: 400 User has requested a restricted HarmBlockThreshold setting BLOCK_NONE. You can get access either (a) through an allowlist via your Google account team, or (b) by switching your account type to monthly invoiced billing via this instruction: https://cloud.google.com/billing/docs/how-to/invoiced-billing.
We faced the same issue all of a sudden.
It’s documented on https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-attributes#safety-settings and can be fixed by changing BLOCK_NONE to BLOCK_ONLY_HIGH. It’s still very unfortunate, since I guess the filtering will have a negative impact on the streaming performance of the responses.