Class: GeminiModelDriver
Defined in: gemini/src/driver/gemini-model-driver.ts:33
Runtime ModelDriver implementation for the Google Gemini generateContent HTTP protocol (@paraharness/gemini).
Maps CompiledWirePrefix to systemInstruction and tools: [{ functionDeclarations }], preserves thought: true and cryptographic thoughtSignature fields on same-model turns and forks, enforces strict user / model role alternation, and supports native responseJsonSchema structured output.
Implements
Constructors
Constructor
new GeminiModelDriver(
transport?,
modelNode?,
driverCtx?
): GeminiModelDriver;Defined in: gemini/src/driver/gemini-model-driver.ts:58
Initializes a GeminiModelDriver with an HTTP transport, optional GeminiModelNode, and runtime context.
Defers all credential and environment variable lookups until invokeTurn() is executed.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
transport? | GeminiHttpTransport | defaultGeminiHttpTransport | HTTP transport for generateContent. |
modelNode? | GeminiModelNode | undefined | Optional bound GeminiModelNode. |
driverCtx? | RuntimeDriverContext | undefined | Optional runtime driver context. |
Returns
GeminiModelDriver
Methods
appendToolResultNotes()
appendToolResultNotes(
frame,
notes,
targetCallId?,
opts?
): Promise<WireFrameRecord>;Defined in: gemini/src/driver/gemini-model-driver.ts:132
Appends synchronization or recovery notes in-place to a Gemini role: 'tool' or role: 'user' frame.
Updates both rawWireFrame (functionResponse or { text } parts) and frame.canonical.
Parameters
| Parameter | Type | Description |
|---|---|---|
frame | WireFrameRecord | Existing tool or user wire frame record. |
notes | readonly string[] | Synchronization note strings to append. |
targetCallId? | string | Optional tool callId to target on a tool frame. |
opts? | AppendToolResultNotesOptions | Optional error status override. |
Returns
Promise<WireFrameRecord>
Updated wire frame record to persist via LedgerStore.replaceMessageFrame().
Implementation of
ModelDriver.appendToolResultNotes
invokeTurn()
invokeTurn(req): Promise<ModelTurnResponse>;Defined in: gemini/src/driver/gemini-model-driver.ts:80
Invokes a single Gemini /v1beta/models/{model}:generateContent turn and returns the raw wire frame and canonical projection.
Validates HTTP status codes before parsing bodyText so non-JSON error payloads never crash with SyntaxError, and propagates HTTP 429 rate-limit responses with { status: 429, resetAtMs }.
Parameters
| Parameter | Type | Description |
|---|---|---|
req | ModelTurnRequest | Turn request payload, wire prefix, and structured output schema. |
Returns
Promise<ModelTurnResponse>
Raw wire response, canonical message, structured output, and usage metrics.
Throws
On HTTP 429 rate limits, non-2xx statuses, aborted signals, or outputSchema validation failures.
Implementation of
prepareFork()
prepareFork(ctx, target): Promise<readonly WireFrameRecord[]>;Defined in: gemini/src/driver/gemini-model-driver.ts:116
Synthesizes the initial WireFrameRecord[] chain for a downward fork or cross-model escalation.
Preserves thought: true and thoughtSignature fields when target.substituteTombstones === false and strips them while substituting compactedTombstones when target.substituteTombstones === true.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | ForkContext | Fork lineage, history mode, and assistant turn-batch pairing metadata. |
target | PrepareForkTarget | Target model configuration and tombstone substitution flag. |
Returns
Promise<readonly WireFrameRecord[]>
Synthesized wire frame chain to persist in LedgerStore.
Implementation of
Properties
vendor
readonly vendor: "google";Defined in: gemini/src/driver/gemini-model-driver.ts:38
Vendor alias matching vendorId ('google').
Implementation of
vendorId
readonly vendorId: "google";Defined in: gemini/src/driver/gemini-model-driver.ts:35
Primary vendor identifier ('google').