ChatSessionBase class

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

Signature:

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

Constructors

Constructor Modifiers Description
(constructor)(apiSettings, params, requestOptions) Constructs a new instance of the ChatSessionBase class

Properties

Property Modifiers Type Description
_apiSettings ApiSettings
_history Content[]
params ParamsType | undefined
requestOptions RequestOptions | undefined

Methods

Method Modifiers Description
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

Signature:

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

Parameters

Parameter Type Description
apiSettings ApiSettings
params ParamsType | undefined
requestOptions RequestOptions | undefined

ChatSessionBase._apiSettings

Signature:

protected _apiSettings: ApiSettings;

ChatSessionBase._history

Signature:

protected _history: Content[];

ChatSessionBase.params

Signature:

params?: ParamsType | undefined;

ChatSessionBase.requestOptions

Signature:

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.

Signature:

getHistory(): Promise<Content[]>;

Returns:

Promise<Content[]>