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.
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.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;