Gets the chat history so far. Blocked prompts are not added to history. Neither blocked candidates nor the prompts that generated them are added to history.
Gets the chat history so far. Blocked prompts are not added to history. Neither blocked candidates nor the prompts that generated them are added to history.
[[["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,["# ChatSession class that enables sending chat messages and stores history of sent and received messages so far.\n\n**Signature:** \n\n export declare class ChatSession \n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|------------------------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------------|\n| [(constructor)(apiSettings, model, chromeAdapter, params, requestOptions)](./ai.chatsession.md#chatsessionconstructor) | | Constructs a new instance of the `ChatSession` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-----------------------------------------------------------------|-----------|-----------------------------------------------------------------------------------|-------------|\n| [model](./ai.chatsession.md#chatsessionmodel) | | string | |\n| [params](./ai.chatsession.md#chatsessionparams) | | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) \\| undefined | |\n| [requestOptions](./ai.chatsession.md#chatsessionrequestoptions) | | [RequestOptions](./ai.requestoptions.md#requestoptions_interface) \\| undefined | |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|--------------------------------------------------------------------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getHistory()](./ai.chatsession.md#chatsessiongethistory) | | Gets the chat history so far. Blocked prompts are not added to history. Neither blocked candidates nor the prompts that generated them are added to history. |\n| [sendMessage(request)](./ai.chatsession.md#chatsessionsendmessage) | | Sends a chat message and receives a non-streaming [GenerateContentResult](./ai.generatecontentresult.md#generatecontentresult_interface) |\n| [sendMessageStream(request)](./ai.chatsession.md#chatsessionsendmessagestream) | | Sends a chat message and receives the response as a [GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface) containing an iterable stream and a response promise. |\n\nChatSession.(constructor)\n-------------------------\n\nConstructs a new instance of the `ChatSession` class\n\n**Signature:** \n\n constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);\n\n#### Parameters\n\n| Parameter | Type | Description |\n|----------------|-----------------------------------------------------------------------------------|-------------|\n| apiSettings | ApiSettings | |\n| model | string | |\n| chromeAdapter | [ChromeAdapter](./ai.chromeadapter.md#chromeadapter_interface) \\| undefined | |\n| params | [StartChatParams](./ai.startchatparams.md#startchatparams_interface) \\| undefined | |\n| requestOptions | [RequestOptions](./ai.requestoptions.md#requestoptions_interface) \\| undefined | |\n\nChatSession.model\n-----------------\n\n**Signature:** \n\n model: string;\n\nChatSession.params\n------------------\n\n**Signature:** \n\n params?: StartChatParams | undefined;\n\nChatSession.requestOptions\n--------------------------\n\n**Signature:** \n\n requestOptions?: RequestOptions | undefined;\n\nChatSession.getHistory()\n------------------------\n\nGets the chat history so far. Blocked prompts are not added to history. Neither blocked candidates nor the prompts that generated them are added to history.\n\n**Signature:** \n\n getHistory(): Promise\u003cContent[]\u003e;\n\n**Returns:**\n\nPromise\\\u003c[Content](./ai.content.md#content_interface)\\[\\]\\\u003e\n\nChatSession.sendMessage()\n-------------------------\n\nSends a chat message and receives a non-streaming [GenerateContentResult](./ai.generatecontentresult.md#generatecontentresult_interface)\n\n**Signature:** \n\n sendMessage(request: string | Array\u003cstring | Part\u003e): Promise\u003cGenerateContentResult\u003e;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|---------------------------------------------------|-------------|\n| request | string \\| Array\\\u003cstring \\| [Part](./ai.md#part)\\\u003e | |\n\n**Returns:**\n\nPromise\\\u003c[GenerateContentResult](./ai.generatecontentresult.md#generatecontentresult_interface)\\\u003e\n\nChatSession.sendMessageStream()\n-------------------------------\n\nSends a chat message and receives the response as a [GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface) containing an iterable stream and a response promise.\n\n**Signature:** \n\n sendMessageStream(request: string | Array\u003cstring | Part\u003e): Promise\u003cGenerateContentStreamResult\u003e;\n\n#### Parameters\n\n| Parameter | Type | Description |\n|-----------|---------------------------------------------------|-------------|\n| request | string \\| Array\\\u003cstring \\| [Part](./ai.md#part)\\\u003e | |\n\n**Returns:**\n\nPromise\\\u003c[GenerateContentStreamResult](./ai.generatecontentstreamresult.md#generatecontentstreamresult_interface)\\\u003e"]]