Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 2.89 KB

generative-ai.generativemodel.md

File metadata and controls

44 lines (32 loc) · 2.89 KB

Home > @google/generative-ai > GenerativeModel

GenerativeModel class

Class for generative model APIs.

Signature:

export declare class GenerativeModel 

Constructors

Constructor Modifiers Description
(constructor)(apiKey, modelParams, requestOptions) Constructs a new instance of the GenerativeModel class

Properties

Property Modifiers Type Description
apiKey string
generationConfig GenerationConfig
model string
requestOptions RequestOptions
safetySettings SafetySetting[]
systemInstruction? Content (Optional)
toolConfig? ToolConfig (Optional)
tools? Tool[] (Optional)

Methods

Method Modifiers Description
batchEmbedContents(batchEmbedContentRequest) Embeds an array of EmbedContentRequests.
countTokens(request) Counts the tokens in the provided request.
embedContent(request) Embeds the provided content.
generateContent(request) Makes a single non-streaming call to the model and returns an object containing a single GenerateContentResponse.
generateContentStream(request) Makes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response.
startChat(startChatParams) Gets a new ChatSession instance which can be used for multi-turn chats.