import { Effect } from "effect"; import { ImageSource } from "@effect-uai/core/Image"; import { HttpClientRequest } from "effect/http"; import * as AiError from "@effect-uai/core/AiError"; import { AudioFormat, AudioSource } from "@effect-uai/core/Audio"; declare namespace codec_d_exports { export { OpenAIResponseFormat, audioToBlob, bodyMultipart, containerToResponseFormat, defaultFileName, httpStatusError, imageToBlob, realizedFormat, transportFailure }; } declare const audioToBlob: (audio: AudioSource) => Effect.Effect; /** Same contract as {@link audioToBlob}: inline variants only. */ declare const imageToBlob: (image: ImageSource) => Effect.Effect; /** * Derive a default filename from a MIME type, e.g. `"audio/mpeg"` → * `"audio.mp3"`. Falls back to `"audio"` (no extension) when the MIME * isn't recognized. Callers can override via the request's `fileName` * field. */ declare const defaultFileName: (mimeType: string) => string; type OpenAIResponseFormat = "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"; /** * Map an `AudioFormat.container` to OpenAI TTS's `response_format` enum. * `ogg` and `webm` are unsupported by OpenAI TTS. * * Note: OpenAI's `pcm` is fixed at 24 kHz, signed 16-bit, mono. The * caller's `sampleRate` is ignored — we report the realized format in * the returned `AudioBlob.format`. */ declare const containerToResponseFormat: (container: AudioFormat["container"]) => Effect.Effect; /** * Pure inverse: report the on-wire `AudioFormat` that OpenAI actually * returns for each `response_format`. Used to populate * `AudioBlob.format` on the response. */ declare const realizedFormat: (rf: OpenAIResponseFormat) => AudioFormat; /** * Map an HTTP status code from an OpenAI endpoint to the appropriate * `AiError` variant. Shared by both transcriber and synthesizer. */ declare const httpStatusError: (status: number, body: string) => AiError.AiError; declare const transportFailure: (cause: unknown) => AiError.AiError; /** Core's helper, with our transport error. Never pass `FormData` to the client. */ declare const bodyMultipart: (form: FormData) => Effect.Effect<(request: HttpClientRequest.HttpClientRequest) => HttpClientRequest.HttpClientRequest, AiError.AiError>; //#endregion export { OpenAIResponseFormat, audioToBlob, bodyMultipart, containerToResponseFormat, defaultFileName, httpStatusError, imageToBlob, realizedFormat, codec_d_exports as t, transportFailure }; //# sourceMappingURL=codec.d.mts.map