Base class for generative models. NOTE: this class should not be instantiated directly. Use vertexai.preview.getGenerativeModel()
instead.
Package
@google-cloud/vertexaiConstructors
(constructor)(getGenerativeModelParams)
constructor
(
getGenerativeModelParams
:
GetGenerativeModelParams
);
Constructs a new instance of the GenerativeModel
class
getGenerativeModelParams
Properties
generation_config
generation_config
?:
GenerationConfig
;
model
model
:
string
;
safety_settings
safety_settings
?:
SafetySetting
[];
token
get
token
()
:
Promise<any>
;
Get access token from GoogleAuth. Throws GoogleAuthError when fails. {Promise
tools
tools
?:
Tool
[];
Methods
countTokens(request)
countTokens
(
request
:
CountTokensRequest
)
:
Promise<CountTokensResponse>
;
Make a async request to count tokens.
request
CountTokensRequest
A CountTokensRequest object with the request contents. The CountTokensResponse object with the token count.
generateContent(request)
generateContent
(
request
:
GenerateContentRequest
|
string
)
:
Promise<GenerateContentResult>
;
Make a async call to generate content.
request
GenerateContentRequest
| string
A GenerateContentRequest object with the request contents. The GenerateContentResponse object with the response candidates.
generateContentStream(request)
generateContentStream
(
request
:
GenerateContentRequest
|
string
)
:
Promise<StreamGenerateContentResult>
;
Make an async stream request to generate content. The response will be returned in stream.
startChat(request)
startChat
(
request
?:
StartChatParams
)
:
ChatSession
;
Instantiate a ChatSession. This method doesn't make any call to remote endpoint. Any call to remote endpoint is implemented in ChatSession class