Skip to content

HARM_CATEGORY_JAILBREAK not supported in Gemini API #775

@eypclk

Description

@eypclk

Description

The HarmCategory.Known.HARM_CATEGORY_JAILBREAK enum value exists in the Java SDK (v1.32.0) but is explicitly marked as unsupported in the Javadoc:

"The harm category is for jailbreak prompts. This enum value is not supported in Gemini API."

Code Example

List<SafetySetting> safetySettings = List.of(
    SafetySetting.builder()
        .category(HarmCategory.Known.HARM_CATEGORY_JAILBREAK) // Exists but not supported
        .threshold(HarmBlockThreshold.Known.BLOCK_MEDIUM_AND_ABOVE)
        .build()
);

Questions

  1. Is this feature planned for future releases? If yes, what is the expected timeline?
  2. Is there currently an alternative approach to prevent jailbreak attempts?

Environment

  • SDK Version: google-genai 1.32.0 (Maven)
  • Language: Java

Expected Behavior

  • A roadmap/timeline should be provided for when this feature will be supported

Additional Context

This would help developers make informed decisions about security settings implementation.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions