Back to Firebase Js Sdk

EnhancedGenerateContentResponse interface

docs-devsite/ai.enhancedgeneratecontentresponse.md

12.12.14.4 KB
Original Source

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

EnhancedGenerateContentResponse interface

Response object wrapped with helper methods.

<b>Signature:</b>

typescript
export interface EnhancedGenerateContentResponse extends GenerateContentResponse 

<b>Extends:</b> GenerateContentResponse

Properties

PropertyTypeDescription
functionCalls() => FunctionCall<!-- -->[] | undefinedAggregates and returns every FunctionCall from the first candidate of GenerateContentResponse<!-- -->.
inferenceSourceInferenceSource<b><i>(Public Preview)</i></b> Indicates whether inference happened on-device or in-cloud.
inlineDataParts() => InlineDataPart<!-- -->[] | undefinedAggregates and returns every InlineDataPart from the first candidate of GenerateContentResponse<!-- -->.
text() => stringReturns the text string from the response, if available. Throws if the prompt or candidate was blocked.
thoughtSummary() => string | undefinedAggregates and returns every TextPart with their <code>thought</code> property set to <code>true</code> from the first candidate of GenerateContentResponse<!-- -->.

EnhancedGenerateContentResponse.functionCalls

Aggregates and returns every FunctionCall from the first candidate of GenerateContentResponse<!-- -->.

<b>Signature:</b>

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

<b>Signature:</b>

typescript
inferenceSource?: InferenceSource;

EnhancedGenerateContentResponse.inlineDataParts

Aggregates and returns every InlineDataPart from the first candidate of GenerateContentResponse<!-- -->.

<b>Signature:</b>

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

EnhancedGenerateContentResponse.text

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

<b>Signature:</b>

typescript
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<!-- -->.

<b>Signature:</b>

typescript
thoughtSummary: () => string | undefined;