GenerateContentResponse Class

Response from the model supporting multiple candidate responses. Safety ratings and content filtering are reported for both prompt in PromptFeedback and for each candidate in FinishReason and in SafetyRatings. The API: - Returns either all requested candidates or none of them - Returns no candidates at all only if there was something wrong with the prompt (check PromptFeedback) - Reports feedback on each candidate in FinishReason and SafetyRatings.

Definition

Namespace: GenerativeAI.Types
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public class GenerateContentResponse
Inheritance
Object    GenerateContentResponse

Constructors

GenerateContentResponseInitializes a new instance of the GenerateContentResponse class

Properties

Candidates Candidate responses from the model.
ModelVersion Output only. The model version used to generate the response.
PromptFeedback Returns the prompt's feedback related to the content filters.
UsageMetadata Output only. Metadata on the generation requests' token usage.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToString Converts the GenerateContentResponse instance to its string representation.
(Overrides ObjectToString)

Operators

(GenerateContentResponse to String) Converts the GenerateContentResponse instance to its string representation explicitly.

Extension Methods

ExtractCodeBlocks Extracts all code blocks from the provided GenerateContentResponse.
(Defined by GenerateContentResponseExtensions)
ExtractJsonBlocks Extracts all JSON blocks from the provided GenerateContentResponse.
(Defined by GenerateContentResponseExtensions)
GetFunction Returns the first candidate’s first function call.
(Defined by GenerateContentResponseExtensions)
Text Returns the text of the first candidate’s first content part.
(Defined by GenerateContentResponseExtensions)
ToChatCompletion Transforms a GenerateContentResponse into a ChatCompletion.
(Defined by AbstractionMapper)
ToObjectT Extracts all JSON blocks from the provided GenerateContentResponse.
(Defined by GenerateContentResponseExtensions)
ToObjectsT Converts JSON blocks contained within the GenerateContentResponse into objects of the specified type.
(Defined by GenerateContentResponseExtensions)
ToStreamingChatCompletionUpdate Converts a GenerateContentResponse into a StreamingChatCompletionUpdate.
(Defined by AbstractionMapper)

See Also