UNPKG

orate

Version:
39 lines (36 loc) 1.81 kB
import { SpeechCreateParams } from 'openai/resources/audio/speech'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; declare class AzureOpenAI { private ttsProvider?; private sttProvider?; private apiKey; private apiVersion; constructor(options?: { apiKey: string; ttsEndpoint: string; sttEndpoint: string; apiVersion: string; }); private createProvider; /** * Creates a text-to-speech synthesis function using OpenAI TTS * @param {string} model - The model (Resource ID) to use for synthesis. * @param {SpeechCreateParams["voice"]} voice - The voice to use for synthesis. Defaults to 'alloy' * @param {Omit<SpeechCreateParams, 'model' | 'voice' | 'input'>} properties - Additional properties for the synthesis request * @returns {Function} Async function that takes text and returns synthesized audio */ tts(model: string, voice: SpeechCreateParams['voice'], properties?: Omit<SpeechCreateParams, 'model' | 'voice' | 'input'>): { generate: (prompt: string) => Promise<File>; }; /** * Creates a speech-to-text transcription function using OpenAI Whisper * @param {TranscriptionCreateParams["model"]} model - The model to use for transcription. Defaults to 'whisper-1' * @param {Omit<TranscriptionCreateParams, 'model' | 'file' | 'stream'>} properties - Additional properties for the transcription request * @returns {Function} Async function that takes audio and returns transcribed text */ stt(model: string, properties?: Omit<TranscriptionCreateParams, 'model' | 'file' | 'stream'>): { generate: (audio: File) => Promise<string>; stream: (audio: File) => Promise<ReadableStream>; }; } export { AzureOpenAI };