Chat session to make multi-turn send message request. sendMessage
method makes async call to get response of a chat message. sendMessageStream
method makes async call to stream response of a chat message.
Package
@google-cloud/vertexaiConstructors
(constructor)(request)
constructor
(
request
:
StartChatSessionRequest
);
Constructs a new instance of the ChatSession
class
Properties
generation_config
generation_config
?:
GenerationConfig
;
history
get
history
()
:
Content
[];
safety_settings
safety_settings
?:
SafetySetting
[];
tools
tools
?:
Tool
[];
Methods
appendHistory(streamGenerateContentResultPromise, newContent)
appendHistory
(
streamGenerateContentResultPromise
:
Promise<StreamGenerateContentResult>
,
newContent
:
Content
[])
:
Promise<void>
;
Parameters
Name
Description
streamGenerateContentResultPromise
Promise
< StreamGenerateContentResult
>
newContent
Content
[]
Returns
Type
Description
Promise
<void>
sendMessage(request)
sendMessage
(
request
:
string
|
Array<string
|
Part
> )
:
Promise<GenerateContentResult>
;
Make an sync call to send message.
sendMessageStream(request)
sendMessageStream
(
request
:
string
|
Array<string
|
Part
> )
:
Promise<StreamGenerateContentResult>
;
Make an async call to stream send message. Response will be returned in stream.