生成モデル API のクラス。
署名:
export declare class GenerativeModel
コンストラクタ
コンストラクタ | 修飾キー | 説明 |
---|---|---|
(structor)(vertexAI, modelParams, requestOptions) | GenerativeModel クラスの新しいインスタンスを作成します。 |
プロパティ
プロパティ | 修飾キー | タイプ | 説明 |
---|---|---|---|
generationConfig | GenerationConfig | ||
モデル | 文字列 | ||
requestOptions | RequestOptions | ||
安全性設定 | SafetySetting[] | ||
systemInstructions | Content | ||
toolConfig | ツール構成 | ||
ツール | ツール[] |
メソッド
メソッド | 修飾キー | 説明 |
---|---|---|
countTokens(リクエスト) | 指定されたリクエスト内のトークンをカウントします。 | |
generateContent(request) | モデルに対して非ストリーミング呼び出しを 1 回行い、GenerateContentResponse を 1 つ含むオブジェクトを返します。 | |
generateContentStream(request) | モデルに対する単一のストリーミング呼び出しを行い、ストリーミング レスポンス内のすべてのチャンクを反復処理するイテラブル ストリームと、最終的な集約されたレスポンスを返す Promise を含むオブジェクトを返します。 | |
startChat(startChatParams) | マルチターン チャットに使用できる新しい ChatSession インスタンスを取得します。 |
GenerativeModel.(コンストラクタ)
GenerativeModel
クラスの新しいインスタンスを作成します。
署名:
constructor(vertexAI: VertexAI, modelParams: ModelParams, requestOptions?: RequestOptions);
パラメータ
パラメータ | タイプ | 説明 |
---|---|---|
Vertex AI | VertexAI | |
modelParams | ModelParams | |
requestOptions | RequestOptions |
GenerativeModel.generationConfig
署名:
generationConfig: GenerationConfig;
GenerativeModel.model
署名:
model: string;
GenerativeModel.requestOptions
署名:
requestOptions?: RequestOptions;
GenerativeModel.safetySettings
署名:
safetySettings: SafetySetting[];
GenerativeModel.systemInstruction
署名:
systemInstruction?: Content;
GenerativeModel.toolConfig
署名:
toolConfig?: ToolConfig;
GenerativeModel.tools
署名:
tools?: Tool[];
GenerativeModel.countTokens()
指定されたリクエスト内のトークンをカウントします。
署名:
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
パラメータ
パラメータ | タイプ | 説明 |
---|---|---|
request | CountTokensRequest | 文字列 | 配列<文字列 | パーツ> |
戻り値:
Promise<CountTokensResponse>
GenerativeModel.generateContent()
モデルに対して非ストリーミング呼び出しを 1 回行い、GenerateContentResponse を 1 つ含むオブジェクトを返します。
署名:
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
パラメータ
パラメータ | タイプ | 説明 |
---|---|---|
request | GenerateContentRequest | 文字列 | 配列<文字列 | パーツ> |
戻り値:
Promise<GenerateContentResult>
GenerativeModel.generateContentStream()
モデルに対する単一のストリーミング呼び出しを行い、ストリーミング レスポンス内のすべてのチャンクを反復処理するイテラブル ストリームと、最終的な集約されたレスポンスを返す Promise を含むオブジェクトを返します。
署名:
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
パラメータ
パラメータ | タイプ | 説明 |
---|---|---|
request | GenerateContentRequest | 文字列 | 配列<文字列 | パーツ> |
戻り値:
Promise<GenerateContentStreamResult>
GenerativeModel.startChat()
マルチターン チャットに使用できる新しい ChatSession インスタンスを取得します。
署名:
startChat(startChatParams?: StartChatParams): ChatSession;
パラメータ
パラメータ | タイプ | 説明 |
---|---|---|
startChatParams | StartChatParams |
戻り値: