Back to Firebase Js Sdk

ChatSessionBase class

docs-devsite/ai.chatsessionbase.md

12.12.13.1 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 %}

ChatSessionBase class

Base class for various ChatSession classes that enables sending chat messages and stores history of sent and received messages so far.

<b>Signature:</b>

typescript
export declare abstract class ChatSessionBase<ParamsType extends StartChatParams | StartTemplateChatParams, RequestType, FunctionDeclarationsToolType extends FunctionDeclarationsTool | TemplateFunctionDeclarationsTool> 

Constructors

ConstructorModifiersDescription
(constructor)(apiSettings, params, requestOptions)Constructs a new instance of the <code>ChatSessionBase</code> class

Properties

PropertyModifiersTypeDescription
_apiSettingsApiSettings
_historyContent<!-- -->[]
paramsParamsType | undefined
requestOptionsRequestOptions | undefined

Methods

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

ChatSessionBase.(constructor)

Constructs a new instance of the ChatSessionBase class

<b>Signature:</b>

typescript
constructor(apiSettings: ApiSettings, params?: ParamsType | undefined, requestOptions?: RequestOptions | undefined);

Parameters

ParameterTypeDescription
apiSettingsApiSettings
paramsParamsType | undefined
requestOptionsRequestOptions | undefined

ChatSessionBase._apiSettings

<b>Signature:</b>

typescript
protected _apiSettings: ApiSettings;

ChatSessionBase._history

<b>Signature:</b>

typescript
protected _history: Content[];

ChatSessionBase.params

<b>Signature:</b>

typescript
params?: ParamsType | undefined;

ChatSessionBase.requestOptions

<b>Signature:</b>

typescript
requestOptions?: RequestOptions | undefined;

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

<b>Signature:</b>

typescript
getHistory(): Promise<Content[]>;

<b>Returns:</b>

Promise<Content<!-- -->[]>