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
| Parameters | |
|---|---|
| Name | Description | 
request | 
        
          StartChatSessionRequest
           | 
      
requestOptions | 
        
          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>;| Parameters | |
|---|---|
| Name | Description | 
streamGenerateContentResultPromise | 
        
          Promise<StreamGenerateContentResult>
           | 
      
newContent | 
        
          Content[]
           | 
      
| Returns | |
|---|---|
| Type | Description | 
Promise<void> | 
        |
sendMessage(request)
sendMessage(request: string | Array<string | Part>): Promise<GenerateContentResult>;Makes an sync call to send message.
| Parameter | |
|---|---|
| Name | Description | 
request | 
        
          string | Array<string | Part>
          send message request. Part  | 
      
| Returns | |
|---|---|
| Type | Description | 
Promise<GenerateContentResult> | 
        {Promise 
  | 
      
sendMessageStream(request)
sendMessageStream(request: string | Array<string | Part>): Promise<StreamGenerateContentResult>;Makes an async call to stream send message. Response will be returned in stream.
| Parameter | |
|---|---|
| Name | Description | 
request | 
        
          string | Array<string | Part>
          send message request. Part  | 
      
| Returns | |
|---|---|
| Type | Description | 
Promise<StreamGenerateContentResult> | 
        {Promise 
  |