yera.models.interfaces.llms.gemini

Yera LLM interface for the Gemini Developer API.

Symbols

class GeminiLLM — LLM interface for models invoked through the Gemini Developer API.

GeminiLLM

LLM interface for models invoked through the Gemini Developer API.

Methods

__init__ — Initialize a Gemini interface without starting its API client.
start — Initialise the Gemini client.
stop — Close and clear the Gemini client.
chat — Stream a chat response from Gemini.
make_struct — Stream JSON conforming to a strict schema from Gemini.
make_request_struct — Stream a forced structured function call from Gemini.

GeminiLLM.__init__

__init__(
    config: LLMConfig,
    connection: GeminiConnection,
    overrides: dict,
) → None

Initialize a Gemini interface without starting its API client.

Parameters

config
type: LLMConfig

Model identity, capabilities, and default inference settings.

connection
type: GeminiConnection

Gemini connection used when the client is started.

overrides
type: dict

Inference values to apply over the model defaults.

Raises

TypeError

If the model does not declare Gemini capabilities.

GeminiLLM.start

start() → None

Initialise the Gemini client.

GeminiLLM.stop

stop() → None

Close and clear the Gemini client.

GeminiLLM.chat

chat(
    messages: list[Message],
    reasoning_level: ReasoningLevel | None = None,
    **overrides,
) → Iterator[LLMToken]

Stream a chat response from Gemini.

Parameters

messages
type: list[Message]

Conversation history to send to Gemini.

reasoning_level
type: ReasoningLevel | None = None

Optional reasoning effort overriding the configured default.

**overrides
type: str | float | int | bool

Per-call inference settings applied over the configured defaults.

GeminiLLM.make_struct

make_struct(
    messages: list[Message],
    reasoning_level: ReasoningLevel | None = None,
    **overrides,
) → Iterator[LLMToken]

Stream JSON conforming to a strict schema from Gemini.

Parameters

messages
type: list[Message]

Conversation history to send to Gemini.

cls
type: type[TStruct]

Struct class defining the required JSON response schema.

reasoning_level
type: ReasoningLevel | None = None

Optional reasoning effort overriding the configured default.

**overrides
type: str | float | int | bool

Per-call inference settings applied over the configured defaults.

Raises

TypeError

If the generated Gemini request does not contain the expected configuration type.

ValueError

If the model does not support structured outputs.

GeminiLLM.make_request_struct

make_request_struct(
    messages: list[Message],
    reasoning_level: ReasoningLevel | None = None,
    **overrides,
) → Iterator[LLMToken]

Stream a forced structured function call from Gemini.

Parameters

messages
type: list[Message]

Conversation history to send to Gemini.

cls
type: type[TStruct]

Struct class defining the forced function call and its arguments.

reasoning_level
type: ReasoningLevel | None = None

Optional reasoning effort overriding the configured default.

**overrides
type: str | float | int | bool

Per-call inference settings applied over the configured defaults.

Raises

TypeError

If the generated Gemini request does not contain the expected configuration type.

ValueError

If the model does not support tool calling or forced tool choice.