Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

gemini - Safety config doesn't have any effect

I'm using the safety config and getting filtered responses on the most mundane questions, about company names etc

I'm using a config as below:

```

# block_level = generative_models.HarmBlockThreshold.BLOCK_NONE
block_level = generative_models.HarmBlockThreshold.BLOCK_ONLY_HIGH

safety_config = [
generative_models.SafetySetting(
category=generative_models.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold=block_level
),
generative_models.SafetySetting(
category=generative_models.HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold=block_level
),
generative_models.SafetySetting(
category=generative_models.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold=block_level
),
generative_models.SafetySetting(
category=generative_models.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold=block_level
),
]
```

and using it with

```

response = session.chat.send_message(
input,
safety_settings=safety_config
)
```

I realize there was a problem that the `BLOCK_NONE` is only available now with Paid plans, but that doesn't seem to be the issue here as the API parameter is accepted (and I'm using a paid account plan)

 

0 0 136
0 REPLIES 0