import { BaseReport } from "../contracts/result/base-report.type.mjs"; import { ExecuteResult } from "../contracts/result/execute-result.type.mjs"; import { FlowObserveOption } from "../observe/resolve-observers.mjs"; import { AudioInput, TranscriptionModelContract, TranscriptionSegment } from "../contracts/transcription-model.contract.mjs"; //#region ../ai/src/transcribe/transcribe.d.ts /** Parameters for {@link transcribe}. `model` comes from `sdk.transcribe({ name })`. */ type TranscribeParams = { /** The STT model to transcribe with. */model: TranscriptionModelContract; /** The audio to transcribe (inlined base64 bytes + media type). */ audio: AudioInput; /** BCP-47 language hint. */ language?: string; /** Optional priming prompt (spelling/style hints). */ prompt?: string; /** Provider response-format override (e.g. `"verbose_json"`). */ format?: string; /** Cancellation handle. */ signal?: AbortSignal; /** Observability routing — same `observe` seam as agents. */ observe?: FlowObserveOption; /** Groups this call into a session for flat cost/trace queries. */ sessionId?: string; /** Report node name (defaults to `"transcription"`). */ name?: string; /** Provider-specific options forwarded verbatim to the adapter. */ options?: Record; }; /** Success payload of a {@link transcribe} run. */ type TranscriptionData = { /** The full transcript text. */text: string; /** Timestamped segments when the provider returned them. */ segments?: TranscriptionSegment[]; }; /** The report node a {@link transcribe} run produces (`type: "transcription"`). */ type TranscriptionReport = BaseReport & { type: "transcription"; /** Identity of the STT model this run used. */ model: { name: string; provider: string; }; /** Input audio duration in seconds, when the provider reported it. */ durationSeconds?: number; }; /** Result envelope of {@link transcribe} — the uniform `{ data, error, usage, report }`. */ type TranscriptionResult = ExecuteResult & { type: "transcription"; report: TranscriptionReport; }; /** * Transcribe audio to text — the speech-to-text verb of the * output-modality track (Theme I), inverse of `ai.speech()`. Wraps a * {@link TranscriptionModelContract} (from `openai.transcribe(...)`) in * the uniform result contract: * * - **Never throws.** Provider failures surface as a typed `AIError` on * `result.error`. * - **Cost-truth.** `result.usage.cost` is filled per-minute * (`whisper-1`) or per-token (`gpt-4o-transcribe`). * - **Observable.** The completed {@link TranscriptionReport} routes to * any registered `Observer` via the `observe` seam. * * @example * const openai = new OpenAISDK({ apiKey }); * const { data, error } = await ai.transcribe({ * model: openai.transcribe({ name: "whisper-1" }), * audio: { base64, mediaType: "audio/mpeg", filename: "voicemail.mp3" }, * language: "en", * }); * if (!error) console.log(data.text); */ declare function transcribe(params: TranscribeParams): Promise; //#endregion export { TranscribeParams, TranscriptionData, TranscriptionReport, TranscriptionResult, transcribe }; //# sourceMappingURL=transcribe.d.mts.map