Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS][Gemini] Allow safetySettings to be driven by a single string. #1153

Open
mbleigh opened this issue Oct 31, 2024 · 0 comments
Open

[JS][Gemini] Allow safetySettings to be driven by a single string. #1153

mbleigh opened this issue Oct 31, 2024 · 0 comments
Labels
bug Something isn't working js

Comments

@mbleigh
Copy link
Collaborator

mbleigh commented Oct 31, 2024

The granular safety settings of Gemini are pretty obnoxious, would be nice if you could set them to a blanket value that would be expanded to each category:

gemini15Flash.withConfig({
  safetySettings: "BLOCK_ONLY_HIGH",
})

// equivalent to
gemini15Flash.withConfig({
  safetySettings: [
    {
      category: 'HARM_CATEGORY_HATE_SPEECH',
      threshold: 'BLOCK_ONLY_HIGH',
    },
    {
      category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
      threshold: 'BLOCK_ONLY_HIGH',
    },
    {
      category: 'HARM_CATEGORY_HARASSMENT',
      threshold: 'BLOCK_ONLY_HIGH',
    },
    {
      category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
      threshold: 'BLOCK_ONLY_HIGH',
    },
  ]
});
@mbleigh mbleigh added bug Something isn't working js labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working js
Projects
Status: No status
Development

No branches or pull requests

1 participant