com.google.mlkit.genai.prompt
Interfaces
| GenerativeModel | Provides an interface for performing content generation. | 
Classes
| Candidate | A piece of a response from the model. | 
| CountTokensResponse | Data class holding token count information. | 
| GenerateContentRequest | A request to generate content. | 
| GenerateContentRequest.Builder | |
| GenerateContentResponse | Represents a response from the model. | 
| GenerationConfig | Configuration parameters to use for content generation. | 
| GenerationConfig.Builder | |
| ImagePart | A data class representing an image part of a prompt. | 
| Part | A sealed class representing a part of a multimodal prompt. | 
| PromptPrefix | A data class representing a prompt prefix. | 
| TextPart | A data class representing a text part of a prompt. | 
Objects
| Generation | Entry class to get a  | 
Annotations
| Candidate.FinishReason | The reason why this  | 
Top-level functions summary
| GenerateContentRequest | generateContentRequest(text: TextPart, init: GenerateContentRequest.Builder.() -> Unit)Helper method to construct a  | 
| GenerateContentRequest | generateContentRequest(image: ImagePart, text: TextPart, init: GenerateContentRequest.Builder.() -> Unit)Helper method to construct a  | 
| GenerationConfig | generationConfig(init: GenerationConfig.Builder.() -> Unit)Helper method to construct a  | 
Top-level functions
generateContentRequest
fun generateContentRequest(text: TextPart, init: GenerateContentRequest.Builder.() -> Unit): GenerateContentRequest
Helper method to construct a GenerateContentRequest in a DSL-like manner.
Example Usage:
// Generation Request with text only:
generateContentRequest(TextPart("Hello World")) {
  temperature = 0.5f
  seed = 123
  topK = 10
  candidateCount = 5
  maxOutputTokens = 200
}generateContentRequest
fun generateContentRequest(image: ImagePart, text: TextPart, init: GenerateContentRequest.Builder.() -> Unit): GenerateContentRequest
Helper method to construct a GenerateContentRequest in a DSL-like manner.
Example Usage:
// Generation Request with image and text:
generateContentRequest(ImagePart(bitmap), TextPart("Hello World")) {
  temperature = 0.5f
  seed = 123
  topK = 10
  candidateCount = 5
  maxOutputTokens = 200
}generationConfig
fun generationConfig(init: GenerationConfig.Builder.() -> Unit): GenerationConfig
Helper method to construct a GenerationConfig in a DSL-like manner.
Example usage:
generationConfig() {
workerExecutor = workerThread // Set the [ExecutorService] on which background tasks should be run. If no value is specified, a background thread pool will be used.
}
