/* * 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 TranscriptionSegment = { /** * Unique identifier of the segment. */ id: number; /** * Seek offset of the segment */ seek: number; /** * Start time of the segment in seconds. */ start: number; /** * End time of the segment in seconds. */ end: number; /** * Text content of the segment. */ text: string; /** * Array of token IDs for the text content. */ tokens: Array; /** * Temperature parameter used for generating the segment. */ temperature: number; /** * Average logprob of the segment. If the value is lower than -1, consider the logprobs failed. */ avgLogprob: number; /** * Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed. */ compressionRatio: number; /** * Probability of no speech in the segment. If the value is higher than 1.0 and the avg_logprob is below -1, consider this segment silent. */ noSpeechProb: number; }; /** @internal */ export const TranscriptionSegment$inboundSchema: z.ZodType< TranscriptionSegment, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), seek: z.number().int(), start: z.number(), end: z.number(), text: z.string(), tokens: z.array(z.number().int()), temperature: z.number(), avg_logprob: z.number(), compression_ratio: z.number(), no_speech_prob: z.number(), }).transform((v) => { return remap$(v, { "avg_logprob": "avgLogprob", "compression_ratio": "compressionRatio", "no_speech_prob": "noSpeechProb", }); }); /** @internal */ export type TranscriptionSegment$Outbound = { id: number; seek: number; start: number; end: number; text: string; tokens: Array; temperature: number; avg_logprob: number; compression_ratio: number; no_speech_prob: number; }; /** @internal */ export const TranscriptionSegment$outboundSchema: z.ZodType< TranscriptionSegment$Outbound, z.ZodTypeDef, TranscriptionSegment > = z.object({ id: z.number().int(), seek: z.number().int(), start: z.number(), end: z.number(), text: z.string(), tokens: z.array(z.number().int()), temperature: z.number(), avgLogprob: z.number(), compressionRatio: z.number(), noSpeechProb: z.number(), }).transform((v) => { return remap$(v, { avgLogprob: "avg_logprob", compressionRatio: "compression_ratio", noSpeechProb: "no_speech_prob", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TranscriptionSegment$ { /** @deprecated use `TranscriptionSegment$inboundSchema` instead. */ export const inboundSchema = TranscriptionSegment$inboundSchema; /** @deprecated use `TranscriptionSegment$outboundSchema` instead. */ export const outboundSchema = TranscriptionSegment$outboundSchema; /** @deprecated use `TranscriptionSegment$Outbound` instead. */ export type Outbound = TranscriptionSegment$Outbound; } export function transcriptionSegmentToJSON( transcriptionSegment: TranscriptionSegment, ): string { return JSON.stringify( TranscriptionSegment$outboundSchema.parse(transcriptionSegment), ); } export function transcriptionSegmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TranscriptionSegment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TranscriptionSegment' from JSON`, ); }