ExBifrost.Api.Audio (ex_bifrost v0.1.0)

Copy Markdown View Source

API calls for all endpoints tagged Audio.

Summary

Functions

Create speech Generates audio from the input text. Returns audio data or streams via SSE.

Create transcription Transcribes audio into text in the input language.

Functions

create_speech(connection, speech_request, opts \\ [])

@spec create_speech(Tesla.Env.client(), ExBifrost.Model.SpeechRequest.t(), keyword()) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, String.t()}
  | {:error, Tesla.Env.t()}

Create speech Generates audio from the input text. Returns audio data or streams via SSE.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • speech_request (SpeechRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, String.t} on success
  • {:error, Tesla.Env.t} on failure

create_transcription(connection, model, file, opts \\ [])

@spec create_transcription(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, ExBifrost.Model.BifrostError.t()}
  | {:ok, ExBifrost.Model.TranscriptionResponse.t()}
  | {:error, Tesla.Env.t()}

Create transcription Transcribes audio into text in the input language.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • model (String.t): Model in provider/model format
  • file (String.t): Audio file to transcribe
  • opts (keyword): Optional parameters
    • :fallbacks ([String.t]):
    • :stream (boolean()):
    • :language (String.t):
    • :prompt (String.t):
    • :response_format (String.t):
    • :file_format (String.t):

Returns

  • {:ok, ExBifrost.Model.TranscriptionResponse.t} on success
  • {:error, Tesla.Env.t} on failure