/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export type BodyText2imageGen = { /** * The text prompt to guide the image transformation. */ prompt: string; /** * The text prompt to guide the image transformation. */ negativePrompt?: string | undefined; /** * The height of the generated image. */ height?: number | undefined; /** * The width of the generated image. */ width?: number | undefined; /** * Configuration scale for the image diffusion process. */ cfgScale?: number | undefined; /** * The sampler to use for the image generation process. */ sampler?: string | undefined; /** * The number of samples to generate. */ samples?: number | undefined; /** * Random noise seed (omit this option or use `0` for a random seed). */ seed?: number | undefined; /** * Number of diffusion steps to run. */ steps?: number | undefined; /** * Enable a safety check for each response. */ safetyCheck?: boolean | undefined; }; /** @internal */ export const BodyText2imageGen$inboundSchema: z.ZodType< BodyText2imageGen, z.ZodTypeDef, unknown > = z.object({ prompt: z.string(), negative_prompt: z.string().optional(), height: z.number().int().optional(), width: z.number().int().optional(), cfg_scale: z.number().optional(), sampler: z.string().optional(), samples: z.number().int().optional(), seed: z.number().int().optional(), steps: z.number().int().optional(), safety_check: z.boolean().optional(), }).transform((v) => { return remap$(v, { "negative_prompt": "negativePrompt", "cfg_scale": "cfgScale", "safety_check": "safetyCheck", }); }); /** @internal */ export type BodyText2imageGen$Outbound = { prompt: string; negative_prompt?: string | undefined; height?: number | undefined; width?: number | undefined; cfg_scale?: number | undefined; sampler?: string | undefined; samples?: number | undefined; seed?: number | undefined; steps?: number | undefined; safety_check?: boolean | undefined; }; /** @internal */ export const BodyText2imageGen$outboundSchema: z.ZodType< BodyText2imageGen$Outbound, z.ZodTypeDef, BodyText2imageGen > = z.object({ prompt: z.string(), negativePrompt: z.string().optional(), height: z.number().int().optional(), width: z.number().int().optional(), cfgScale: z.number().optional(), sampler: z.string().optional(), samples: z.number().int().optional(), seed: z.number().int().optional(), steps: z.number().int().optional(), safetyCheck: z.boolean().optional(), }).transform((v) => { return remap$(v, { negativePrompt: "negative_prompt", cfgScale: "cfg_scale", safetyCheck: "safety_check", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BodyText2imageGen$ { /** @deprecated use `BodyText2imageGen$inboundSchema` instead. */ export const inboundSchema = BodyText2imageGen$inboundSchema; /** @deprecated use `BodyText2imageGen$outboundSchema` instead. */ export const outboundSchema = BodyText2imageGen$outboundSchema; /** @deprecated use `BodyText2imageGen$Outbound` instead. */ export type Outbound = BodyText2imageGen$Outbound; } export function bodyText2imageGenToJSON( bodyText2imageGen: BodyText2imageGen, ): string { return JSON.stringify( BodyText2imageGen$outboundSchema.parse(bodyText2imageGen), ); } export function bodyText2imageGenFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BodyText2imageGen$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BodyText2imageGen' from JSON`, ); }