/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type EvalSampleAudioObject = { object: "eval.sample.audio"; /** * Playable clip reference: a base64 `data:` URI or an http(s) URL. */ audio: string; /** * Echoes the requested sample index so the client has a complete cache key without tracking it. */ sampleIndex: number; /** * The task the clip was resolved from (the clip differs across tasks). */ taskId: string; /** * The model row the clip was read from. The clip is identical across models within a task. */ model: string; }; /** @internal */ export const EvalSampleAudioObject$inboundSchema: z.ZodType< EvalSampleAudioObject, z.ZodTypeDef, unknown > = z.object({ object: z.literal("eval.sample.audio"), audio: z.string(), sample_index: z.number().int(), task_id: z.string(), model: z.string(), }).transform((v) => { return remap$(v, { "sample_index": "sampleIndex", "task_id": "taskId", }); }); /** @internal */ export type EvalSampleAudioObject$Outbound = { object: "eval.sample.audio"; audio: string; sample_index: number; task_id: string; model: string; }; /** @internal */ export const EvalSampleAudioObject$outboundSchema: z.ZodType< EvalSampleAudioObject$Outbound, z.ZodTypeDef, EvalSampleAudioObject > = z.object({ object: z.literal("eval.sample.audio"), audio: z.string(), sampleIndex: z.number().int(), taskId: z.string(), model: z.string(), }).transform((v) => { return remap$(v, { sampleIndex: "sample_index", taskId: "task_id", }); }); export function evalSampleAudioObjectToJSON( evalSampleAudioObject: EvalSampleAudioObject, ): string { return JSON.stringify( EvalSampleAudioObject$outboundSchema.parse(evalSampleAudioObject), ); } export function evalSampleAudioObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EvalSampleAudioObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EvalSampleAudioObject' from JSON`, ); }