com.google.ai.edge.aicore


Interfaces

DownloadCallback

Callback functions used for model downloading.

Part

Interface representing data sent to and received from requests.

Classes

Candidate

A piece of a response from the model.

Content

Represents content sent to and received from the model.

Content.Builder
DownloadConfig

Configuration parameters to use for system model download.

GenerateContentResponse

Represents a response from the model.

GenerationConfig

Configuration parameters to use for content generation.

GenerationConfig.Builder
GenerativeModel

A facilitator for a given system model.

TextPart

Represents text or string based data sent to and received from requests.

Exceptions

ConnectionException

Error during connection.

DownloadException

Error during download.

GenerativeAIException

Parent class for any errors that occur from GenerativeModel.

InferenceException

Error during inference.

PreparationException

Error during preparation.

TokenizationException

Error during tokenization.

UnknownException

Unknown Error.

Annotations

Candidate.FinishReason

Finish reason associated with a Candidate

Content.Role

Role associated with Content

GenerativeAIException.ErrorCode

The set of GenerativeAIException error codes.

Top-level functions summary

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

Function to construct content sent to and received in a DSL-like manner.

GenerationConfig

Helper method to construct a GenerationConfig in a DSL-like manner.

Extension functions summary

Top-level functions

content

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

Function to construct content sent to and received in a DSL-like manner.

Contains a collection of text, image, and binary parts.

Example usage:

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

generationConfig

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

Helper method to construct a GenerationConfig in a DSL-like manner.

Example Usage:

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")
}

Extension functions

asTextOrNull

fun Part.asTextOrNull(): String?
Returns
String?

The part as a String if it represents text, and null otherwise