com.google.ai.edge.aicore


インターフェース

DownloadCallback

モデルのダウンロードに使用されるコールバック関数。

Part

リクエストとの間で送受信されるデータを表すインターフェース。

クラス

Candidate

モデルからのレスポンスの一部。

Content

モデルとの間で送受信されるコンテンツを表します。

Content.Builder
DownloadConfig

システムモデルのダウンロードに使用する構成パラメータ。

GenerateContentResponse

モデルからのレスポンスを表します。

GenerationConfig

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

GenerationConfig.Builder
GenerativeModel

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

TextPart

リクエストとの間で送受信されるテキストまたは文字列ベースのデータを表現します。

例外

ConnectionException

接続中にエラーが発生しました。

DownloadException

ダウンロード中にエラーが発生しました。

GenerativeAIException

GenerativeModel で発生するエラーの親クラス。

InferenceException

推論中にエラーが発生しました。

PreparationException

準備中にエラーが発生しました。

TokenizationException

トークン化中にエラーが発生しました。

UnknownException

不明なエラーです。

アノテーション

Candidate.FinishReason

Candidate に関連付けられた終了理由

Content.Role

Content に関連付けられたロール

GenerativeAIException.ErrorCode

GenerativeAIException エラーコードのセット。

トップレベル関数の概要

Content
content(@Content.Role role: Int, init: Content.Builder.() -> Unit)

DSL のような方法で送受信されるコンテンツを構築する関数。

GenerationConfig

DSL のような方法で GenerationConfig を構築するヘルパー メソッド。

拡張関数の概要

トップレベル関数

content

fun content(@Content.Role role: Int = Role.USER, init: Content.Builder.() -> Unit): Content

DSL のような方法で送受信されるコンテンツを構築する関数。

テキスト、画像、バイナリ パートのコレクションが含まれています。

使用例:

content(Role.MODEL) {
text("Example string")
)

generationConfig

fun generationConfig(init: GenerationConfig.Builder.() -> Unit): GenerationConfig

DSL のような方法で GenerationConfig を構築するヘルパー メソッド。

使用例:

generationConfig {
context = context // required
workerExecutor = workerThread // Set the [ExecutorService] on which background tasks should be run. If no value is specified, a background thread pool will be used.
callbackExecutor = callbackExecutor // Set the [Executor] on which callbacks should be invoked. If no value is specified, callbacks will be invoked on the UI thread.
temperature = 0.75f
topK = 30
candidateCount = 4
maxOutputTokens = 300
stopSequences = listOf("in conclusion", "-----", "do you need")
}

拡張関数

asTextOrNull

fun Part.asTextOrNull(): String?
戻り値
String?

テキストを表す場合は String、それ以外の場合は null