/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The detail level for image processing. 'high' for detailed analysis (higher cost), 'low' for basic analysis (lower cost), 'auto' lets the model choose based on image size. Defaults to 'auto'. */ export const Detail = { High: "high", Low: "low", Auto: "auto", } as const; /** * The detail level for image processing. 'high' for detailed analysis (higher cost), 'low' for basic analysis (lower cost), 'auto' lets the model choose based on image size. Defaults to 'auto'. */ export type Detail = ClosedEnum; /** * Input image content item: Image input for multimodal analysis. Provide either file_id or image_url. */ export type InputImage = { /** * The content type identifier for image input. */ type: "input_image"; /** * The detail level for image processing. 'high' for detailed analysis (higher cost), 'low' for basic analysis (lower cost), 'auto' lets the model choose based on image size. Defaults to 'auto'. */ detail?: Detail | undefined; /** * The ID of a previously uploaded file containing the image. Mutually exclusive with image_url. */ fileId?: string | undefined; /** * A URL or data URI pointing to the image. Mutually exclusive with file_id. */ imageUrl?: string | undefined; }; /** @internal */ export const Detail$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Detail); /** @internal */ export const Detail$outboundSchema: z.ZodNativeEnum = Detail$inboundSchema; /** @internal */ export const InputImage$inboundSchema: z.ZodType< InputImage, z.ZodTypeDef, unknown > = z.object({ type: z.literal("input_image"), detail: Detail$inboundSchema.default("auto"), file_id: z.string().optional(), image_url: z.string().optional(), }).transform((v) => { return remap$(v, { "file_id": "fileId", "image_url": "imageUrl", }); }); /** @internal */ export type InputImage$Outbound = { type: "input_image"; detail: string; file_id?: string | undefined; image_url?: string | undefined; }; /** @internal */ export const InputImage$outboundSchema: z.ZodType< InputImage$Outbound, z.ZodTypeDef, InputImage > = z.object({ type: z.literal("input_image"), detail: Detail$outboundSchema.default("auto"), fileId: z.string().optional(), imageUrl: z.string().optional(), }).transform((v) => { return remap$(v, { fileId: "file_id", imageUrl: "image_url", }); }); export function inputImageToJSON(inputImage: InputImage): string { return JSON.stringify(InputImage$outboundSchema.parse(inputImage)); } export function inputImageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InputImage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InputImage' from JSON`, ); }