GenerativeModel


class GenerativeModel : AutoCloseable


特定のシステムモデルのファシリテーター。

概要

パブリック コンストラクタ

GenerativeModel(
    generationConfig: GenerationConfig,
    downloadConfig: DownloadConfig
)

パブリック関数

open Unit

クライアントを閉じてリソースを解放します。

suspend GenerateContentResponse
generateContent(vararg prompt: Content)

指定された Content を使用して、システムモデルからレスポンスを生成します。

suspend GenerateContentResponse

指定されたテキスト(Content)をシステムモデルからレスポンスとして生成します。

Flow<GenerateContentResponse>
generateContentStream(vararg prompt: Content)

指定された Content を使用して、システムモデルからストリーミング レスポンスを生成します。

Flow<GenerateContentResponse>

指定されたテキスト(Content)をシステムモデルからストリーミング レスポンスとして生成します。

suspend <Error class: unknown class>

タイミングのオーバーヘッドを推論から除外するために、エンジンを事前に準備します。

公開プロパティ

DownloadConfig

システムモデルのダウンロード用の構成

GenerationConfig

コンテンツ生成に使用する構成パラメータ

パブリック コンストラクタ

GenerativeModel

GenerativeModel(
    generationConfig: GenerationConfig,
    downloadConfig: DownloadConfig = DownloadConfig()
)

パブリック関数

閉じる

open fun close(): Unit

クライアントを閉じてリソースを解放します。

generateContent

suspend fun generateContent(vararg prompt: Content): GenerateContentResponse

指定された Content を使用して、システムモデルからレスポンスを生成します。

パラメータ
vararg prompt: Content

モデルに送信する Content のグループ。

戻り値
GenerateContentResponse

GenerateContentResponse(遅延あり)。同時実行を適切に管理するには、関数を suspend コンテキスト内で呼び出す必要があります。

generateContent

suspend fun generateContent(prompt: String): GenerateContentResponse

指定されたテキスト(Content)をシステムモデルからレスポンスとして生成します。

パラメータ
prompt: String

モデルに送信する Content の 1 つの部分に変換されるテキスト。

戻り値
GenerateContentResponse

GenerateContentResponse(遅延あり)。同時実行を適切に管理するには、関数を suspend コンテキスト内で呼び出す必要があります。

generateContentStream

fun generateContentStream(vararg prompt: Content): Flow<GenerateContentResponse>

指定された Content を使用して、システムモデルからストリーミング レスポンスを生成します。

パラメータ
vararg prompt: Content

モデルに送信する Content のグループ。

戻り値
Flow<GenerateContentResponse>

モデルから返されたときにレスポンスを出力する Flow

generateContentStream

fun generateContentStream(prompt: String): Flow<GenerateContentResponse>

指定されたテキスト(Content)をシステムモデルからストリーミング レスポンスとして生成します。

パラメータ
prompt: String

モデルに送信する Content の 1 つの部分に変換されるテキスト。

戻り値
Flow<GenerateContentResponse>

モデルから返されたレスポンスを出力する Flow

prepareInferenceEngine

suspend fun prepareInferenceEngine(): <Error class: unknown class>

タイミングのオーバーヘッドを推論から除外するために、エンジンを事前に準備します。このメソッドの呼び出しは任意ですが、最初の推論のレイテンシを最小限に抑えるために、最初の推論呼び出しのかなり前に呼び出すことをおすすめします。

公開プロパティ

downloadConfig

val downloadConfigDownloadConfig

システムモデルのダウンロード用の構成

generationConfig

val generationConfigGenerationConfig

コンテンツ生成に使用する構成パラメータ