/** * Cross-environment Gemini media generation adapter battery. * * @module @nhtio/adk/batteries/generation/gemini/adapter * * @remarks * Opinionated media-generation battery for the native Gemini `generativelanguage` REST surface — * `POST /models/{model}:generateContent` — over raw `fetch`. No `@google/genai` SDK dependency, so * it runs unchanged in Node, the browser, edge runtimes, and workers. * * Construction validates options eagerly via * {@link @nhtio/adk/batteries/generation/gemini/validation!validateOptions} and throws * {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_INVALID_GEMINI_GENERATION_OPTIONS} on * failure — config bugs fail loud, not at generate/edit time. */ import type { GenerationImageInput } from "../_shared/index"; import type { GeneratedMediaOutput, GeminiGenerateOptions, GeminiEditOptions } from "./types"; /** * Media generation adapter for the native Gemini `generativelanguage` `generateContent` wire * shape. * * @remarks * Reusable: construct once, call {@link GeminiGenerationAdapter.generate} / * {@link GeminiGenerationAdapter.edit} as many times as needed. */ export declare class GeminiGenerationAdapter { #private; /** * Whether this battery can run in the current environment. For the HTTP-backed Gemini battery * this is always `true` (a `fetch` is always resolvable); present for surface-parity with * WebGPU-gated batteries. */ static isAvailable(): boolean; /** * @param options - Constructor options. Validated eagerly. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_INVALID_GEMINI_GENERATION_OPTIONS} when `options` does not satisfy * {@link @nhtio/adk/batteries/generation/gemini/validation!geminiGenerationOptionsSchema} (e.g. missing `model`). */ constructor(options: unknown); /** See {@link GeminiGenerationAdapter.isAvailable}. Instance alias for surface-parity. */ isAvailable(): boolean; /** * No-op warm-up. The Gemini battery has no engine to preload; present for surface-parity with * on-device generation batteries so callers can treat them interchangeably. */ preload(): Promise; /** * No-op state reset. Present for surface-parity with on-device generation batteries. */ reset(): void; /** * Generates one or more images from a text prompt. * * @param prompt - The text prompt describing the desired image(s). * @param opts - Per-call options (`n`, `aspectRatio`), each falling back to the adapter's * configured default when applicable. * @returns One {@link GeneratedMediaOutput} per generated image part in the response. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_GEMINI_GENERATION_HTTP_ERROR} on a non-2xx response or transport failure. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_GEMINI_GENERATION_REQUEST_TIMEOUT} when the handshake exceeds `requestTimeoutMs`. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_GEMINI_GENERATION_MALFORMED_RESPONSE} when the 2xx body is not the expected shape, or contains zero image parts. */ generate(prompt: string, opts?: GeminiGenerateOptions): Promise; /** * Edits one or more source images from a text prompt. * * @param inputs - One image, or several images, in any {@link GenerationImageInput} form. * @param prompt - The text prompt describing the desired edit. * @param opts - Per-call options (`n`, `aspectRatio`), each falling back to the adapter's * configured default when applicable. * @returns One {@link GeneratedMediaOutput} per edited image part in the response. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_GEMINI_GENERATION_HTTP_ERROR} on a non-2xx response or transport failure. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_GEMINI_GENERATION_REQUEST_TIMEOUT} when the handshake exceeds `requestTimeoutMs`. * @throws {@link @nhtio/adk/batteries/generation/gemini/exceptions!E_GEMINI_GENERATION_MALFORMED_RESPONSE} when the 2xx body is not the expected shape, or contains zero image parts. */ edit(inputs: GenerationImageInput | GenerationImageInput[], prompt: string, opts?: GeminiEditOptions): Promise; }