/* * 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"; /** * Optional STT (speech-to-text) VAD configuration for the voice session. */ export type SttConfig = { /** * Server-side VAD silence timeout in ms (100–5000). Controls how long to wait after silence before finalizing speech. */ silenceTimeoutMs?: number | undefined; /** * Timeout in ms before any speech is detected (1000–30000). */ initialSilenceTimeoutMs?: number | undefined; }; /** @internal */ export const SttConfig$inboundSchema: z.ZodType< SttConfig, z.ZodTypeDef, unknown > = z.object({ silence_timeout_ms: z.number().int().optional(), initial_silence_timeout_ms: z.number().int().optional(), }).transform((v) => { return remap$(v, { "silence_timeout_ms": "silenceTimeoutMs", "initial_silence_timeout_ms": "initialSilenceTimeoutMs", }); }); /** @internal */ export type SttConfig$Outbound = { silence_timeout_ms?: number | undefined; initial_silence_timeout_ms?: number | undefined; }; /** @internal */ export const SttConfig$outboundSchema: z.ZodType< SttConfig$Outbound, z.ZodTypeDef, SttConfig > = z.object({ silenceTimeoutMs: z.number().int().optional(), initialSilenceTimeoutMs: z.number().int().optional(), }).transform((v) => { return remap$(v, { silenceTimeoutMs: "silence_timeout_ms", initialSilenceTimeoutMs: "initial_silence_timeout_ms", }); }); export function sttConfigToJSON(sttConfig: SttConfig): string { return JSON.stringify(SttConfig$outboundSchema.parse(sttConfig)); } export function sttConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SttConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SttConfig' from JSON`, ); }