Gemini

class Gemini(client: ERROR CLASS: Symbol not found for Client, val name: String, models: Gemini.GeminiModels = RealGeminiModels(client.models)) : Model

Implementation of Model that interacts with Google Gemini models using the GenAI SDK.

This class provides functionality to generate content from Gemini models, supporting both unary and streaming responses. It can be configured to use either a Google AI API key or Vertex AI credentials for authentication.

GenAI SDK based Gemini currently prevents usage of API_KEY and GoogleCredentials on Android. Use Firebase AI instead.

Parameters

client

The Client instance from the GenAI SDK used for making API calls.

name

The name of the specific Gemini model to use (e.g., "gemini-3.1-flash-lite-preview").

Constructors

Link copied to clipboard
constructor(client: ERROR CLASS: Symbol not found for Client, name: String, models: Gemini.GeminiModels = RealGeminiModels(client.models))
constructor(name: String, apiKey: String? = null)

Creates a Gemini instance using a Google AI API key for authentication.

constructor(name: String, vertexCredentials: VertexCredentials)

Creates a Gemini instance using Vertex AI credentials for authentication.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface GeminiModels

Wrapper around GenAI SDK Models to allow mocking in tests.

Link copied to clipboard
class RealGeminiModels(delegate: ERROR CLASS: Symbol not found for com.google.genai.kotlin.Models) : Gemini.GeminiModels

Properties

Link copied to clipboard
open override val name: String

Functions

Link copied to clipboard
open override fun generateContent(request: LlmRequest, stream: Boolean = false): ERROR CLASS: Symbol not found for Flow<com/google/adk/kt/models/LlmResponse>

Generates content for the given LlmRequest. This returns a Flow of LlmResponses.