The default security level of Gemini is too sensitive.

#2
by douglarek - opened

Maybe we need(Or a configurable parameter):


SAFETY_SETTINGS = [
    {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_NONE",
    },
]

...

 response = model.generate_content(
            messages, stream=True, generation_config=generation_config, safety_settings=SAFETY_SETTINGS
        )
Roboflow org

Hi @douglarek ๐Ÿ‘‹ I was thinking about adding those into the configuration as well.

Subject: Proposal to Enhance Safety Settings in Gemini

Dear Hugging Face Team,

I hope this message finds you well. I recently came across a discussion (Issue #2) regarding the default security level of Gemini being too sensitive. After analyzing the situation, I would like to propose an improvement that could address this concern.

Proposal:
Introduce a configurable parameter or settings under the name "SAFETY_SETTINGS" to allow users to customize safety thresholds based on different harm categories. By providing users with the flexibility to adjust safety settings, we can ensure a more tailored and controlled experience for our users.

Example SAFETY_SETTINGS:

SAFETY_SETTINGS = [
    {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_NONE",
    },
    {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_NONE",
    },
]

Implementation:
The proposed SAFETY_SETTINGS can be integrated into the code snippet below:

response = model.generate_content(
    messages, stream=True, generation_config=generation_config, safety_settings=SAFETY_SETTINGS
)

Benefits:

  1. Customization: Users can fine-tune safety settings based on their specific needs.
  2. Enhanced User Experience: Tailoring safety thresholds allows for a more personalized and controlled content generation process.

I believe that implementing this proposal would contribute to a more user-friendly and adaptable Gemini platform. I look forward to hearing your thoughts on this suggestion and am available for further discussion.

Best regards,

[douglarek]

Sign up or log in to comment