@cavi-ai/api-client/providers/gemini/runtime
Package subpath: ./providers/gemini/runtime
buildGeminiRequestBody
Kind: function
/**
* Build the Gemini request body from the universal run-start body. Full role
* fidelity: `system`-role array messages and `instructions` both feed
* `systemInstruction`; `assistant`->`model`, everything else->`user`. Throws
* ValidationFailed if no model is resolvable.
*/
export declare function buildGeminiRequestBody(body: RuntimeRunStartBody, defaultModel?: string): {
model: string;
payload: Record<string, unknown>;
};createGeminiProviderModule
Kind: function
export declare function createGeminiProviderModule(config: GeminiApiClientOptions): RuntimeProviderModule;GEMINI_RUNTIME_SUPPORT
Kind: variable
export declare const GEMINI_RUNTIME_SUPPORT: Readonly<{
runs: true;
streaming: true;
batch: true;
}>;GeminiApiClient
Kind: class
export declare class GeminiApiClient extends BaseHttpApiClient implements RuntimeClient {
readonly request: HttpApiTransport;
private readonly defaultModel?;
private readonly files;
constructor(options: GeminiApiClientOptions);
getRuntimeCapabilities(): Promise<RuntimeCapabilities>;
startRun(body: RuntimeRunStartBody): Promise<RuntimeRunStatus>;
streamRun(body: RuntimeRunStartBody, handlers: RunEventStreamHandlers, options?: {
signal?: AbortSignal;
}): Promise<void>;
getRun(_runId: string): Promise<RuntimeRunStatus>;
cancelRun(_runId: string): Promise<{
status: string;
}>;
submitBatch(requests: RuntimeBatchRequest[]): Promise<RuntimeBatchStatus>;
getBatch(batchId: string): Promise<RuntimeBatchStatus>;
cancelBatch(batchId: string): Promise<RuntimeBatchStatus>;
getBatchResults(batchId: string): Promise<RuntimeBatchResult[]>;
private readBatchModel;
private stateless;
}GeminiApiClientOptions
Kind: type
export type GeminiApiClientOptions = {
/** Gemini Developer API (AI Studio) key. Keep backend-owned; do not embed in browsers/mobile. */
apiKey: string;
/** Default model when a run does not specify one. No id ships by default. */
defaultModel?: string;
baseUrl?: string;
fetchImpl?: typeof fetch;
onTrace?: HttpApiClientOptions["onTrace"];
};mapGeminiStreamChunk
Kind: function
/** Map one Gemini SSE chunk to a MESSAGE_DELTA, or null when it carries no text. */
export declare function mapGeminiStreamChunk(sse: SseMessage, runId: string): RunStreamEvent | null;readGeminiFinishReason
Kind: function
/** Return the first candidate's finishReason, if the chunk is terminal. */
export declare function readGeminiFinishReason(sse: SseMessage): string | null;readGeminiStreamUsage
Kind: function
/** Extract the flat usageMetadata numbers from a chunk, if present. */
export declare function readGeminiStreamUsage(sse: SseMessage): Record<string, number> | null;