I’m using the Gemini Flash 2.5 model and I’m getting the following error in the response:
block_reason=<BlockedReason.OTHER: ‘OTHER’>
I looked at the documentation and saw that there were some parameters to indicate that no type of content should be blocked, which are modified as follows:
response = client.models.generate_content(
model="gemini-2.5-flash-preview-05-20",
contents=[myfile, "Example prompt"],
config=types.GenerateContentConfig(
safety_settings=[
types.SafetySetting(category=types.HarmCategory.HARM_CATEGORY_HARASSMENT, threshold=types.HarmBlockThreshold.BLOCK_NONE),
types.SafetySetting(category=types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, threshold=types.HarmBlockThreshold.BLOCK_NONE),
types.SafetySetting(category=types.HarmCategory.HARM_CATEGORY_HATE_SPEECH, threshold=types.HarmBlockThreshold.BLOCK_NONE),
types.SafetySetting(category=types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, threshold=types.HarmBlockThreshold.BLOCK_NONE),
types.SafetySetting(category=types.HarmCategory.HARM_CATEGORY_CIVIC_INTEGRITY, threshold=types.HarmBlockThreshold.BLOCK_NONE)
]
),
)
But even with these parameters indicating that nothing should be blocked, I still get the same error. Does anyone know if it’s because it’s not picking up these parameters correctly or because the model has a minimum security level that can’t be modified, or if it could be due to copyright issues since I’m transferring episodes from a series to it?
Thank you.