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 |
InferenceException |
Error during inference. |
PreparationException |
Error during preparation. |
TokenizationException |
Error during tokenization. |
UnknownException |
Unknown Error. |
Annotations
Candidate.FinishReason |
Finish reason associated with a |
Content.Role |
Role associated with |
GenerativeAIException.ErrorCode |
The set of |
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 |
generationConfig(init: GenerationConfig.Builder.() -> Unit) Helper method to construct a |
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")
}