import { BaseReport } from "../contracts/result/base-report.type.mjs"; import { ExecuteResult } from "../contracts/result/execute-result.type.mjs"; import { FlowObserveOption } from "../observe/resolve-observers.mjs"; import { GeneratedImage, ImageModelContract } from "../contracts/image-model.contract.mjs"; //#region ../ai/src/image/image.d.ts /** * Parameters for {@link image}. `model` comes from an adapter's * `image()` factory (`openai.image({ name })` / `google.image({ name })`); * the rest are provider-neutral generation knobs plus the standard * observability seam every verb shares. */ type ImageParams = { /** The image model to generate from (`sdk.image({ name })`). */model: ImageModelContract; /** Text description of the image(s) to generate. */ prompt: string; /** How many images to generate. Adapters clamp to the provider max. */ count?: number; /** Requested pixel size as `"WxH"` (e.g. `"1024x1024"`). */ size?: string; /** Quality tier (e.g. `"standard"` / `"hd"`). */ quality?: string; /** Aspect ratio (e.g. `"1:1"`, `"16:9"`) — ratio-based providers (Imagen). */ aspectRatio?: string; /** Concepts to steer away from (Imagen `negativePrompt`). */ negativePrompt?: string; /** Output container hint (`"png"` / `"jpeg"` / `"webp"`). */ format?: string; /** Cancellation handle, wired into the provider request where supported. */ signal?: AbortSignal; /** * Observability routing for this call — same `observe` seam as * agents / workflows. `true` routes to the globally registered * observers; an `Observer` object routes flow-locally; `false` opts * out; omitted follows the global observe-all flag. */ observe?: FlowObserveOption; /** Groups this call into a session for flat cost/trace queries. */ sessionId?: string; /** Report node name (defaults to `"image"`). */ name?: string; /** Provider-specific options forwarded verbatim to the adapter. */ options?: Record; }; /** Success payload of an {@link image} run. */ type ImageData = { /** The generated images, normalized to the discriminated shape. */images: GeneratedImage[]; }; /** * The report node an {@link image} run produces — a {@link BaseReport} * (`type: "image"`) plus which model ran and how many images came back, * so panoptic and any flat-row consumer attribute the cost/latency * without special-casing. */ type ImageReport = BaseReport & { type: "image"; /** Identity of the image model this run used. */ model: { name: string; provider: string; }; /** Number of images returned (0 on failure). */ imageCount: number; }; /** * Result envelope of {@link image} — the same uniform * `{ data, error, usage, report }` every executable returns, narrowed * with the `"image"` discriminant. */ type ImageResult = ExecuteResult & { type: "image"; report: ImageReport; }; /** * Generate one or more images from a text prompt — the image-output * counterpart to `ai.agent`, and the first verb of the output-modality * track (Theme I). Wraps an {@link ImageModelContract} (from * `openai.image(...)` / `google.image(...)`) in the framework's uniform * result contract: * * - **Never throws.** Provider failures (auth, rate-limit, * content-filter, invalid request) surface as a typed `AIError` on * `result.error`; `result.data` is then `undefined`. * - **Cost-truth.** When the model carries pricing, `result.usage.cost` * is filled in — per-token for gpt-image-1, per-image for * DALL·E / Imagen — folding into the same `Usage.cost` rollup as text. * - **Observable.** The completed {@link ImageReport} routes to any * registered `Observer` (panoptic, OTel, …) via the shared `observe` * seam, exactly like an agent run. * * @example * const openai = new OpenAISDK({ apiKey }); * const { data, error, usage } = await ai.image({ * model: openai.image({ name: "gpt-image-1" }), * prompt: "an isometric office desk, soft studio lighting", * size: "1024x1024", * }); * * if (error) console.warn(error.code); * else for (const img of data.images) save(img); // { type: "base64" | "url", ... } */ declare function image(params: ImageParams): Promise; //#endregion export { ImageData, ImageParams, ImageReport, ImageResult, image }; //# sourceMappingURL=image.d.mts.map