providerplaneai
    Preparing search index...

    GeminiProvider: Concrete BaseProvider implementation for Google Gemini models.

    Responsibilities:

    • Owns the GoogleGenAI SDK client
    • Initializes provider-level configuration
    • Registers supported capabilities
    • Delegates execution to capability-specific implementations

    Implements chat, embedding, image, and moderation capabilities for Gemini.

    Input type for chat requests

    Input type for embedding requests

    Input type for image generation requests

    Input type for moderation requests

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    capabilities: Partial<CapabilityMap> = {}

    Support provider capabilities

    config: ProviderConnectionConfig | null = null

    Current connection config

    executors?: Map<CapabilityKeyType, CapabilityExecutor<any, any, any>>
    providerType: AIProviderType

    Type of this provider (OpenAI, Anthropic, Gemini, etc.)

    Methods

    • Resolve and merge configuration for a capability.

      Merge precedence (low → high):

      1. providerDefaults (global provider-level defaults)
      2. model capability defaults (models[modelName][capability])
      3. runtimeOptions (request-level overrides)

      Model resolution fallback: runtimeOptions.model → config.defaultModels[capability] → config.defaultModel

      Parameters

      • capability: string

        Name of the capability.

      • runtimeOptions: any = {}

        Request-level override options.

      Returns { generalParams: any; model: any; modelParams: any; providerParams: any }

      Merged configuration with keys such as model, modelParams, providerParams, and generalParams.

      When a model cannot be resolved for the requested capability.

    • Deep-merge multiple objects. Arrays override completely, objects are recursively merged, primitives override. Used for merging provider defaults, model configurations, and runtime options.

      Parameters

      • ...sources: any[]

        Objects to merge.

      Returns any

      Deep-merged object.

    • Strips keys from providerParams that must never be forwarded to an SDK constructor because they can redirect API traffic or override credentials.

      Blocked keys across all supported SDKs:

      • baseURL / baseUrl — redirects all provider traffic to an arbitrary host, causing the API key to be sent to an attacker-controlled server.
      • apiKey / authToken — would silently override the key already set from config.
      • httpAgent — custom HTTP agent can route traffic through an arbitrary proxy.
      • fetch / globalFetch — custom fetch implementations can intercept all requests.
      • httpOptions — Gemini SDK wrapper for baseUrl and custom fetch.

      Parameters

      • params: Record<string, unknown>

        Raw providerParams from caller config.

      Returns Record<string, unknown>

      Params with dangerous constructor keys removed.