Table of Contents

Class GenerateContentResponse

Individual response from {@link GenerativeModel.generateContent} and {@link GenerativeModel.generateContentStream}. generateContentStream() will return one in each chunk until the stream is done.

public class GenerateContentResponse : IChatCompletionEvent, ITextStreamEvent
Inheritance
object
GenerateContentResponse
Implements
ITextStreamEvent

Remarks

This is Google's equivalent of the ChatCompletion object in OpenAI.

Properties

Candidates

Candidate responses from the model.

public GeminiCandidate[] Candidates { get; set; }

Property Value

GeminiCandidate[]

ModelVersion

Output only. The model version used to generate the response.

public string ModelVersion { get; set; }

Property Value

string

PromptFeedback

Returns the prompt's feedback related to the content filters.

public PromptFeedback PromptFeedback { get; set; }

Property Value

PromptFeedback

ResponseId

Output only. responseId is used to identify each response.

public string ResponseId { get; set; }

Property Value

string

Usage

Output only. Metadata on the generation requests' token usage.

public UsageMetadata Usage { get; set; }

Property Value

UsageMetadata

Methods

FirstTextDelta()

public string FirstTextDelta()

Returns

string

IsFinal()

public bool IsFinal()

Returns

bool

ToChatCompletionEvent(string)

public ChatCompletion ToChatCompletionEvent(string modelId)

Parameters

modelId string

Returns

ChatCompletion

ToContentParts()

public List<GeminiContentPart> ToContentParts()

Returns

List<GeminiContentPart>

ToInlineDataList()

public List<string> ToInlineDataList()

Returns

List<string>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.