Makes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response.
Makes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# GenerativeModel class\n\nClass for generative model APIs.\n\n**Signature:** \n\n export declare class GenerativeModel extends AIModel \n\n**Extends:** [AIModel](./ai.aimodel.md#aimodel_class)\n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|---------------------------------------------------------------------------------------------------------------------|-----------|----------------------------------------------------------|\n| [(constructor)(ai, modelParams, requestOptions, chromeAdapter)](./ai.generativemodel.md#generativemodelconstructor) | | Constructs a new instance of the `GenerativeModel` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-------------------------------------------------------------------------------|-----------|-------------------------------------------------------------------------|-------------|\n| [generationConfig](./ai.generativemodel.md#generativemodelgenerationconfig) | | [GenerationConfig](./ai.generationconfig.md#generationconfig_interface) | |\n| [requestOptions](./ai.generativemodel.md#generativemodelrequestoptions) | | [RequestOptions](./ai.requestoptions.md#requestoptions_interface) | |\n| [safetySettings](./ai.generativemodel.md#generativemodelsafetysettings) | | [SafetySetting](./ai.safetysetting.md#safetysetting_interface)\\[\\] | |\n| [systemInstruction](./ai.generativemodel.md#generativemodelsysteminstruction) | | [Content](./ai.content.md#content_interface) | |\n| [toolConfig](./ai.generativemodel.md#generativemodeltoolconfig) | | [ToolConfig](./ai.toolconfig.md#toolconfig_interface) | |\n| [tools](./ai.generativemodel.md#generativemodeltools) | | [Tool](./ai.md#tool)\\[\\] | |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|------------------------------------------------------------------------------------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [countTokens(request)](./ai.generativemodel.md#generativemodelcounttokens) | | Counts the tokens in the provided request. |\n| [generateContent(request)](./ai.generativemodel.md#generativemodelgeneratecontent) | | Makes a single non-streaming call to the model and returns an object containing a single [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface). |\n| [generateContentStream(request)](./ai.generativemodel.md#generativemodelgeneratecontentstream) | | Makes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response. |\n| [startChat(startChatParams)](./ai.generativemodel.md#generativemodelstartchat) | | Gets a new [ChatSession](./ai.chatsession.md#chatsession_class) instance which can be used for multi-turn chats. |\n\nGenerativeModel.(constructor)\n-----------------------------\n\nConstructs a new instance of the `GenerativeModel` class\n\n**Signature:** \n\n constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions, chromeAdapter?: ChromeAdapter | undefined);\n\n#### Parameters\n\n| Parameter | Type | Description |\n|----------------|-----------------------------------------------------------------------------|-------------|\n| ai | [AI](./ai.ai.md#ai_interface) | |\n| modelParams | [ModelParams](./ai.modelparams.md#modelparams_interface) | |\n| requestOptions | [RequestOptions](./ai.requestoptions.md#requestoptions_interface) | |\n| chromeAdapter | [ChromeAdapter](./ai.chromeadapter.md#chromeadapter_interface) \\| undefined | |\n\nGenerativeModel.generationConfig\n--------------------------------\n\n**Signature:** \n\n generationConfig: GenerationConfig;\n\nGenerativeModel.requestOptions\n------------------------------\n\n**Signature:** \n\n requestOptions?: RequestOptions;\n\nGenerativeModel.safetySettings\n------------------------------\n\n**Signature:** \n\n safetySettings: SafetySetting[];\n\nGenerativeModel.systemInstruction\n---------------------------------\n\n**Signature:** \n\n systemInstruction?: Content;\n\nGenerativeModel.toolConfig\n--------------------------\n\n**Signature:** \n\n toolConfig?: ToolConfig;\n\nGenerativeModel.tools\n---------------------\n\n**Signature:** \n\n tools?: Tool[];\n\nGenerativeModel.countTokens()\n-----------------------------\n\nCounts the tokens in the provided request.\n\n**Signature:** \n\n countTokens(request: CountTokensRequest | string | Array\u003cstring | Part\u003e): Promise\u003cCountTokensResponse\u003e;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------------------------------------------------------------------------------------------------------------------------------------|-------------|\n| request | [CountTokensRequest](./ai.counttokensrequest.md#counttokensrequest_interface) \\| string \\| Array\\\u003cstring \\| [Part](./ai.md#part)\\\u003e | |\n\n**Returns:**\n\nPromise\\\u003c[CountTokensResponse](./ai.counttokensresponse.md#counttokensresponse_interface)\\\u003e\n\nGenerativeModel.generateContent()\n---------------------------------\n\nMakes a single non-streaming call to the model and returns an object containing a single [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface).\n\n**Signature:** \n\n generateContent(request: GenerateContentRequest | string | Array\u003cstring | Part\u003e): Promise\u003cGenerateContentResult\u003e;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------|\n| request | [GenerateContentRequest](./ai.generatecontentrequest.md#generatecontentrequest_interface) \\| string \\| Array\\\u003cstring \\| [Part](./ai.md#part)\\\u003e | |\n\n**Returns:**\n\nPromise\\\u003c[GenerateContentResult](./ai.generatecontentresult.md#generatecontentresult_interface)\\\u003e\n\nGenerativeModel.generateContentStream()\n---------------------------------------\n\nMakes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response.\n\n**Signature:** \n\n generateContentStream(request: GenerateContentRequest | string | Array\u003cstring | Part\u003e): Promise\u003cGenerateContentStreamResult\u003e;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|------------------------------------------------------------------------------------------------------------------------------------------------|-------------|\n| request | [GenerateContentRequest](./ai.generatecontentrequest.md#generatecontentrequest_interface) \\| string \\| Array\\\u003cstring \\| [Part](./ai.md#part)\\\u003e | |\n\n**Returns:**\n\nPromise\\\u003c[GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface)\\\u003e\n\nGenerativeModel.startChat()\n---------------------------\n\nGets a new [ChatSession](./ai.chatsession.md#chatsession_class) instance which can be used for multi-turn chats.\n\n**Signature:** \n\n startChat(startChatParams?: StartChatParams): ChatSession;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------------|----------------------------------------------------------------------|-------------|\n| startChatParams | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) | |\n\n**Returns:**\n\n[ChatSession](./ai.chatsession.md#chatsession_class)"]]