GoogleCloudPlatform / generative-ai

Sample code and notebooks for Generative AI on Google Cloud, with Gemini on Vertex AI
https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview
Apache License 2.0
8.25k stars 2.33k forks source link

[Bug] 400 User has requested a restricted HarmBlockThreshold setting BLOCK_NONE - which seems to requier allowlisting #814

Closed palladius closed 5 months ago

palladius commented 5 months ago

File Name

gemini/sample-apps/gemini-streamlit-cloudrun

What happened?

A bug happened! https://screenshot.googleplex.com/BjHmzdNb9z4vUC3

Relevant log output

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. [detail: "[ORIGINAL ERROR] generic::invalid_argument: 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. [google.rpc.error_details_ext] { message: \"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.\" }" ]

Code of Conduct

palladius commented 5 months ago

L>onger input from streamlit output:


streamlit run app.py \
        --browser.serverAddress=localhost \
        --server.enableCORS=false \
        --server.enableXsrfProtection=false \
        --server.port 8080

  You can now view your Streamlit app in your browser.

  URL: http://localhost:8080

2024-06-27 15:16:40.437 Uncaught app exception
Traceback (most recent call last):
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 170, in error_remapped_callable
    return _StreamingResponseIterator(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 92, in __init__
    self._stored_first_result = next(self._wrapped)
                                ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/grpc/_channel.py", line 543, in __next__
    return self._next()
           ^^^^^^^^^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/grpc/_channel.py", line 969, in _next
    raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "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."
        debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B2a00:1450:400a:802::200a%5D:443 {created_time:"2024-06-27T15:16:40.435873558+02:00", grpc_status:3, grpc_message:"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."}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
    exec(code, module.__dict__)
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/app.py", line 164, in <module>
    response = get_gemini_pro_text_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/app.py", line 52, in get_gemini_pro_text_response
    for response in responses:
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/vertexai/generative_models/_generative_models.py", line 689, in _generate_content_streaming
    response_stream = self._prediction_client.stream_generate_content(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py", line 2412, in stream_generate_content
    response = rpc(
               ^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/google/home/ricc/git/blahblahpoo/20240627-lavi-deploy-gemini-streamlit/gemini-streamlit-cloudrun/.gemini-streamlit/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 174, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
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. [detail: "[ORIGINAL ERROR] generic::invalid_argument: 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. [google.rpc.error_details_ext] { message: \"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.\" }"
]
holtskinner commented 5 months ago

Thanks for the notice, this needs to be changed in the Streamlit app to Block only high