EnhancedGenerateContentResponse interface

Response object wrapped with helper methods.

Signature:

export interface EnhancedGenerateContentResponse extends GenerateContentResponse 

Extends: GenerateContentResponse

Properties

Property Type Description
functionCalls () => FunctionCall[] | undefined Aggregates and returns every FunctionCall from the first candidate of GenerateContentResponse.
inferenceSource InferenceSource (Public Preview) Indicates whether inference happened on-device or in-cloud.
inlineDataParts () => InlineDataPart[] | undefined Aggregates and returns every InlineDataPart from the first candidate of GenerateContentResponse.
text () => string Returns the text string from the response, if available. Throws if the prompt or candidate was blocked.
thoughtSummary () => string | undefined Aggregates and returns every TextPart with their thought property set to true from the first candidate of GenerateContentResponse.

EnhancedGenerateContentResponse.functionCalls

Aggregates and returns every FunctionCall from the first candidate of GenerateContentResponse.

Signature:

functionCalls: () => FunctionCall[] | undefined;

EnhancedGenerateContentResponse.inferenceSource

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Indicates whether inference happened on-device or in-cloud.

Signature:

inferenceSource?: InferenceSource;

EnhancedGenerateContentResponse.inlineDataParts

Aggregates and returns every InlineDataPart from the first candidate of GenerateContentResponse.

Signature:

inlineDataParts: () => InlineDataPart[] | undefined;

EnhancedGenerateContentResponse.text

Returns the text string from the response, if available. Throws if the prompt or candidate was blocked.

Signature:

text: () => string;

EnhancedGenerateContentResponse.thoughtSummary

Aggregates and returns every TextPart with their thought property set to true from the first candidate of GenerateContentResponse.

Thought summaries provide a brief overview of the model's internal thinking process, offering insight into how it arrived at the final answer. This can be useful for debugging, understanding the model's reasoning, and verifying its accuracy.

Thoughts will only be included if ThinkingConfig.includeThoughts is set to true.

Signature:

thoughtSummary: () => string | undefined;