Home > @google/generative-ai > GenerativeModel
Class for generative model APIs.
Signature:
export declare class GenerativeModel
Constructor | Modifiers | Description |
---|---|---|
(constructor)(apiKey, modelParams, requestOptions) | Constructs a new instance of the GenerativeModel class |
Property | Modifiers | Type | Description |
---|---|---|---|
apiKey | string | ||
generationConfig | GenerationConfig | ||
model | string | ||
requestOptions | RequestOptions | ||
safetySettings | SafetySetting[] | ||
systemInstruction? | Content | (Optional) | |
toolConfig? | ToolConfig | (Optional) | |
tools? | Tool[] | (Optional) |
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. |