Gemini

class Gemini(client: <Error class: unknown class>, 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.

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(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.

constructor(client: <Error class: unknown class>, name: String, models: Gemini.GeminiModels = RealGeminiModels(client.models))

Types

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

Internal wrapper around GenAI SDK Models to allow mocking in tests.

Link copied to clipboard
class RealGeminiModels(delegate: <Error class: unknown class>) : 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): Flow<LlmResponse>

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