Interface representing a `ChatSession` class that enables sending chat messages and stores a history of sent and received messages so far.

**Signature:**

    export interface ChatSession 

## Properties

| Property | Type | Description |
|---|---|---|
| [model](https://firebase.google.com/docs/reference/js/ai.chatsession#chatsessionmodel) | string |   |
| [params](https://firebase.google.com/docs/reference/js/ai.chatsession#chatsessionparams) | [StartChatParams](https://firebase.google.com/docs/reference/js/ai.startchatparams#startchatparams_interface) |   |
| [requestOptions](https://firebase.google.com/docs/reference/js/ai.chatsession#chatsessionrequestoptions) | [RequestOptions](https://firebase.google.com/docs/reference/js/ai.requestoptions#requestoptions_interface) |   |

## Methods

| Method | Description |
|---|---|
| [getHistory()](https://firebase.google.com/docs/reference/js/ai.chatsession#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. |
| [sendMessage(request, singleRequestOptions)](https://firebase.google.com/docs/reference/js/ai.chatsession#chatsessionsendmessage) | Sends a chat message and receives a non-streaming [GenerateContentResult](https://firebase.google.com/docs/reference/js/ai.generatecontentresult#generatecontentresult_interface) |
| [sendMessageStream(request, singleRequestOptions)](https://firebase.google.com/docs/reference/js/ai.chatsession#chatsessionsendmessagestream) | Sends a chat message and receives the response as a [GenerateContentStreamResult](https://firebase.google.com/docs/reference/js/ai.generatecontentstreamresult#generatecontentstreamresult_interface) containing an iterable stream and a response promise. |

## ChatSession.model

**Signature:**

    model: string;

## ChatSession.params

**Signature:**

    params?: StartChatParams;

## ChatSession.requestOptions

**Signature:**

    requestOptions?: RequestOptions;

## ChatSession.getHistory()

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.

**Signature:**

    getHistory(): Promise<Content[]>;

**Returns:**

Promise\<[Content](https://firebase.google.com/docs/reference/js/ai.content#content_interface)\[\]\>

## ChatSession.sendMessage()

Sends a chat message and receives a non-streaming [GenerateContentResult](https://firebase.google.com/docs/reference/js/ai.generatecontentresult#generatecontentresult_interface)

**Signature:**

    sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| request | string \| Array\<string \| [Part](https://firebase.google.com/docs/reference/js/ai#part)\> |   |
| singleRequestOptions | [SingleRequestOptions](https://firebase.google.com/docs/reference/js/ai.singlerequestoptions#singlerequestoptions_interface) |   |

**Returns:**

Promise\<[GenerateContentResult](https://firebase.google.com/docs/reference/js/ai.generatecontentresult#generatecontentresult_interface)\>

## ChatSession.sendMessageStream()

Sends a chat message and receives the response as a [GenerateContentStreamResult](https://firebase.google.com/docs/reference/js/ai.generatecontentstreamresult#generatecontentstreamresult_interface) containing an iterable stream and a response promise.

**Signature:**

    sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| request | string \| Array\<string \| [Part](https://firebase.google.com/docs/reference/js/ai#part)\> |   |
| singleRequestOptions | [SingleRequestOptions](https://firebase.google.com/docs/reference/js/ai.singlerequestoptions#singlerequestoptions_interface) |   |

**Returns:**

Promise\<[GenerateContentStreamResult](https://firebase.google.com/docs/reference/js/ai.generatecontentstreamresult#generatecontentstreamresult_interface)\>