/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../lib/primitives.js"; import { ClosedEnum } from "../types/enums.js"; import { smartUnion } from "../types/smart-union.js"; import { AttachmentInput, AttachmentInput$Outbound, AttachmentInput$outboundSchema, } from "./attachment-input.js"; import { ReasoningOptions, ReasoningOptions$Outbound, ReasoningOptions$outboundSchema, } from "./reasoning-options.js"; import { ResponseFormat, ResponseFormat$Outbound, ResponseFormat$outboundSchema, } from "./response-format.js"; import { ResponsesFunctionTool, ResponsesFunctionTool$Outbound, ResponsesFunctionTool$outboundSchema, } from "./responses-function-tool.js"; import { ResponsesInputItem, ResponsesInputItem$Outbound, ResponsesInputItem$outboundSchema, } from "./responses-input-item.js"; import { ResponsesToolChoice, ResponsesToolChoice$Outbound, ResponsesToolChoice$outboundSchema, } from "./responses-tool-choice.js"; import { StreamOptions, StreamOptions$Outbound, StreamOptions$outboundSchema, } from "./stream-options.js"; export type Input = string | Array; export const Modality = { Text: "text", Image: "image", Audio: "audio", Video: "video", Embedding: "embedding", } as const; export type Modality = ClosedEnum; export type ResponsesCreateRequest = { model: string; input: string | Array; attachments?: Array | undefined; attachment?: AttachmentInput | undefined; stream?: boolean | undefined; modalities?: Array | undefined; instructions?: string | undefined; previousResponseId?: string | undefined; maxOutputTokens?: number | undefined; temperature?: number | undefined; tools?: Array | undefined; toolChoice?: ResponsesToolChoice | undefined; responseFormat?: ResponseFormat | undefined; streamOptions?: StreamOptions | undefined; parallelToolCalls?: boolean | undefined; metadata?: { [k: string]: any } | undefined; serviceTier?: string | undefined; store?: boolean | undefined; reasoningEffort?: string | undefined; reasoning?: ReasoningOptions | undefined; include?: Array | undefined; promptCacheKey?: string | undefined; promptCacheRetention?: string | undefined; text?: { [k: string]: any } | undefined; n?: number | undefined; size?: string | undefined; quality?: string | undefined; imageUrl?: string | undefined; voice?: string | undefined; language?: string | undefined; speed?: number | undefined; duration?: number | undefined; aspectRatio?: string | undefined; resolution?: string | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export type Input$Outbound = string | Array; /** @internal */ export const Input$outboundSchema: z.ZodMiniType = smartUnion([z.string(), z.array(ResponsesInputItem$outboundSchema)]); export function inputToJSON(input: Input): string { return JSON.stringify(Input$outboundSchema.parse(input)); } /** @internal */ export const Modality$outboundSchema: z.ZodMiniEnum = z.enum( Modality, ); /** @internal */ export type ResponsesCreateRequest$Outbound = { model: string; input: string | Array; attachments?: Array | undefined; attachment?: AttachmentInput$Outbound | undefined; stream?: boolean | undefined; modalities?: Array | undefined; instructions?: string | undefined; previous_response_id?: string | undefined; max_output_tokens?: number | undefined; temperature?: number | undefined; tools?: Array | undefined; tool_choice?: ResponsesToolChoice$Outbound | undefined; response_format?: ResponseFormat$Outbound | undefined; stream_options?: StreamOptions$Outbound | undefined; parallel_tool_calls?: boolean | undefined; metadata?: { [k: string]: any } | undefined; service_tier?: string | undefined; store?: boolean | undefined; reasoning_effort?: string | undefined; reasoning?: ReasoningOptions$Outbound | undefined; include?: Array | undefined; prompt_cache_key?: string | undefined; prompt_cache_retention?: string | undefined; text?: { [k: string]: any } | undefined; n?: number | undefined; size?: string | undefined; quality?: string | undefined; image_url?: string | undefined; voice?: string | undefined; language?: string | undefined; speed?: number | undefined; duration?: number | undefined; aspect_ratio?: string | undefined; resolution?: string | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const ResponsesCreateRequest$outboundSchema: z.ZodMiniType< ResponsesCreateRequest$Outbound, ResponsesCreateRequest > = z.pipe( z.catchall( z.object({ model: z.string(), input: smartUnion([ z.string(), z.array(ResponsesInputItem$outboundSchema), ]), attachments: z.optional(z.array(AttachmentInput$outboundSchema)), attachment: z.optional(AttachmentInput$outboundSchema), stream: z.optional(z.boolean()), modalities: z.optional(z.array(Modality$outboundSchema)), instructions: z.optional(z.string()), previousResponseId: z.optional(z.string()), maxOutputTokens: z.optional(z.int()), temperature: z.optional(z.number()), tools: z.optional(z.array(ResponsesFunctionTool$outboundSchema)), toolChoice: z.optional(ResponsesToolChoice$outboundSchema), responseFormat: z.optional(ResponseFormat$outboundSchema), streamOptions: z.optional(StreamOptions$outboundSchema), parallelToolCalls: z.optional(z.boolean()), metadata: z.optional(z.record(z.string(), z.any())), serviceTier: z.optional(z.string()), store: z.optional(z.boolean()), reasoningEffort: z.optional(z.string()), reasoning: z.optional(ReasoningOptions$outboundSchema), include: z.optional(z.array(z.string())), promptCacheKey: z.optional(z.string()), promptCacheRetention: z.optional(z.string()), text: z.optional(z.record(z.string(), z.any())), n: z.optional(z.int()), size: z.optional(z.string()), quality: z.optional(z.string()), imageUrl: z.optional(z.string()), voice: z.optional(z.string()), language: z.optional(z.string()), speed: z.optional(z.number()), duration: z.optional(z.number()), aspectRatio: z.optional(z.string()), resolution: z.optional(z.string()), }), z.any(), ), z.transform((v) => { return { ...remap$(v, { previousResponseId: "previous_response_id", maxOutputTokens: "max_output_tokens", toolChoice: "tool_choice", responseFormat: "response_format", streamOptions: "stream_options", parallelToolCalls: "parallel_tool_calls", serviceTier: "service_tier", reasoningEffort: "reasoning_effort", promptCacheKey: "prompt_cache_key", promptCacheRetention: "prompt_cache_retention", imageUrl: "image_url", aspectRatio: "aspect_ratio", }), }; }), ); export function responsesCreateRequestToJSON( responsesCreateRequest: ResponsesCreateRequest, ): string { return JSON.stringify( ResponsesCreateRequest$outboundSchema.parse(responsesCreateRequest), ); }