Table of Contents

Class GenerateContentResponsePromptFeedback

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

Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations.

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

Properties

BlockReason

Output only. The reason why the prompt was blocked.

[JsonPropertyName("blockReason")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public BlockedReason? BlockReason { get; set; }

Property Value

BlockedReason?

BlockReasonMessage

Output only. A readable message that explains the reason why the prompt was blocked. This field is not supported in Gemini API.

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

Property Value

string

SafetyRatings

Output only. A list of safety ratings for the prompt. There is one rating per category.

[JsonPropertyName("safetyRatings")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<SafetyRating>? SafetyRatings { get; set; }

Property Value

List<SafetyRating>

Methods

FromJson(string, JsonSerializerOptions?)

Deserializes a JSON string to a GenerateContentResponsePromptFeedback object.

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

Parameters

jsonString string

The JSON string to deserialize.

options JsonSerializerOptions

Optional JsonSerializerOptions.

Returns

GenerateContentResponsePromptFeedback

The deserialized GenerateContentResponsePromptFeedback object, or null if deserialization fails.