Table of Contents

Class SafetyAttributes

Namespace
Google.GenAI.Types
Assembly
Google.GenAI.dll

Safety attributes of a GeneratedImage or the user-provided prompt.

public record SafetyAttributes : IEquatable<SafetyAttributes>
Inheritance
SafetyAttributes
Implements
Inherited Members

Properties

Categories

List of RAI categories.

[JsonPropertyName("categories")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string>? Categories { get; set; }

Property Value

List<string>

ContentType

Internal use only.

[JsonPropertyName("contentType")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ContentType { get; set; }

Property Value

string

Scores

List of scores of each categories.

[JsonPropertyName("scores")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<double>? Scores { get; set; }

Property Value

List<double>

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a SafetyAttributes object.

public static SafetyAttributes? FromJson(string jsonString, JsonSerializerOptions? options = null)

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

SafetyAttributes

The deserialized SafetyAttributes object, or null if deserialization fails.