Skip to content

Safety settings mismatch with API #810

@dani-mp

Description

@dani-mp

Environment details

  • Programming language: TypeScript
  • OS: macOS
  • Language runtime version: Node 20
  • Package version: 1.10.0

Steps to reproduce

When using the method property inside safety settings, we get an error:

Error: method parameter is not supported in Gemini API.

Also, about the default value for this field, the docs are in conflict with each other. One mentions that the default value is probability, but the other says it is severity.

Image Image

Finally, only 5 categories in HarmCategory are supported. Mapping all categories (which we were trying to do automatically) results in the following error:

{"error":{"code":400,"message":"* GenerateContentRequest.safety_settings[0]: element predicate failed: $.category in (HarmCategory.HARM_CATEGORY_HATE_SPEECH, HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT, HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT, HarmCategory.HARM_CATEGORY_HARASSMENT, HarmCategory.HARM_CATEGORY_CIVIC_INTEGRITY)\n","status":"INVALID_ARGUMENT"}}

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. 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