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, requestOptions)
constructor
(
request
:
StartChatSessionRequest
,
requestOptions
?:
RequestOptions
);
Constructs a new instance of the ChatSessionPreview
class
requestOptions
Properties
generation_config
generation_config
?:
GenerationConfig
;
history
get
history
()
:
Content
[];
requestOptions
requestOptions
?:
RequestOptions
;
safety_settings
safety_settings
?:
SafetySetting
[];
token
get
token
()
:
Promise<any>
;
Gets access token from GoogleAuth. Throws GoogleAuthError when fails.
tools
tools
?:
Tool
[];
Methods
appendHistory(streamGenerateContentResultPromise, newContent)
appendHistory
(
streamGenerateContentResultPromise
:
Promise<StreamGenerateContentResult>
,
newContent
:
Content
[])
:
Promise<void>
;
streamGenerateContentResultPromise
Promise
< StreamGenerateContentResult
>
newContent
Content
[]
Promise
<void>
sendMessage(request)
sendMessage
(
request
:
string
|
Array<string
|
Part
> )
:
Promise<GenerateContentResult>
;
Makes an sync call to send message.
sendMessageStream(request)
sendMessageStream
(
request
:
string
|
Array<string
|
Part
> )
:
Promise<StreamGenerateContentResult>
;
Makes an async call to stream send message. Response will be returned in stream.