Skip to content

Latest commit

 

History

History
193 lines (126 loc) · 6.59 KB

vertexai.generativemodel.md

File metadata and controls

193 lines (126 loc) · 6.59 KB

Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference

{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}

GenerativeModel class

Class for generative model APIs.

Signature:

export declare class GenerativeModel extends VertexAIModel 

Extends: VertexAIModel

Constructors

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

Properties

Property Modifiers Type Description
generationConfig GenerationConfig
requestOptions RequestOptions
safetySettings SafetySetting[]
systemInstruction Content
toolConfig ToolConfig
tools Tool[]

Methods

Method Modifiers Description
countTokens(request) Counts the tokens in the provided request.
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.

GenerativeModel.(constructor)

Constructs a new instance of the GenerativeModel class

Signature:

constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);

Parameters

Parameter Type Description
vertexAI VertexAI
modelParams ModelParams
requestOptions RequestOptions

GenerativeModel.generationConfig

Signature:

generationConfig: GenerationConfig;

GenerativeModel.requestOptions

Signature:

requestOptions?: RequestOptions;

GenerativeModel.safetySettings

Signature:

safetySettings: SafetySetting[];

GenerativeModel.systemInstruction

Signature:

systemInstruction?: Content;

GenerativeModel.toolConfig

Signature:

toolConfig?: ToolConfig;

GenerativeModel.tools

Signature:

tools?: Tool[];

GenerativeModel.countTokens()

Counts the tokens in the provided request.

Signature:

countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;

Parameters

Parameter Type Description
request CountTokensRequest | string | Array<string | Part>

Returns:

Promise<CountTokensResponse>

GenerativeModel.generateContent()

Makes a single non-streaming call to the model and returns an object containing a single GenerateContentResponse.

Signature:

generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;

Parameters

Parameter Type Description
request GenerateContentRequest | string | Array<string | Part>

Returns:

Promise<GenerateContentResult>

GenerativeModel.generateContentStream()

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.

Signature:

generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;

Parameters

Parameter Type Description
request GenerateContentRequest | string | Array<string | Part>

Returns:

Promise<GenerateContentStreamResult>

GenerativeModel.startChat()

Gets a new ChatSession instance which can be used for multi-turn chats.

Signature:

startChat(startChatParams?: StartChatParams): ChatSession;

Parameters

Parameter Type Description
startChatParams StartChatParams

Returns:

ChatSession