class ElevenLabsProvider extends Provider implements AudioProvider, TranscriptionProvider

Traits

Properties

protected AudioGateway $audioGateway from  HasAudioGateway
protected TranscriptionGateway $transcriptionGateway from  HasTranscriptionGateway

Methods

__construct(array $config, Dispatcher $events)

Create an ElevenLabs provider instance.

string
name()

Get the name of the underlying AI provider.

from  Provider
string
driver()

Get the name of the underlying AI driver.

from  Provider
array
providerCredentials()

Get the credentials for the underlying AI provider.

from  Provider
array
additionalConfiguration()

Get the provider connection configuration other than the driver, key, and name.

from  Provider
withHeaders(array $headers)

Get a provider instance that sends the given HTTP headers with each request.

from  Provider
mixed
dispatchingFailure(Closure $call, Closure $failed)

Run the given gateway call, dispatching the event built from its exception before rethrowing.

from  Provider
static array
formatProviderAndModelList(Provider|Lab|array|string $providers, string|null $model = null)

Format the given provider / model list.

from  Provider
static array
providerAndModelPairs(Provider|Lab|array|string $providers, string|null $model = null)

Get provider and model pairs without discarding on-demand instances.

from  Provider
array
__serialize()

Get the serializable representation of the provider.

from  Provider
void
__unserialize(array $data)

Restore the provider from its serialized representation.

from  Provider
string
__toString()

Convert the provider to its string representation.

from  Provider
audio(string $text, string $voice = 'default-female', string|null $instructions = null, string|null $model = null, int $timeout = 30, array $providerOptions = [])

Generate audio from the given text.

transcribe(TranscribableAudio $audio, string|null $language = null, bool $diarize = false, string|null $model = null, int|null $timeout = null, array $providerOptions = [])

Transcribe the given audio to text.

audioGateway()

Get the provider's audio gateway.

useAudioGateway(AudioGateway $gateway)

Set the provider's audio gateway.

transcriptionGateway()

Get the provider's transcription gateway.

useTranscriptionGateway(TranscriptionGateway $gateway)

Set the provider's transcription gateway.

string
defaultAudioModel()

Get the name of the default audio (TTS) model.

string
defaultTranscriptionModel()

Get the name of the default transcription (STT) model.

Details

at line 28
__construct(array $config, Dispatcher $events)

Create an ElevenLabs provider instance.

Parameters

array $config
Dispatcher $events

in Provider at line 34
string name()

Get the name of the underlying AI provider.

Return Value

string

in Provider at line 42
string driver()

Get the name of the underlying AI driver.

Return Value

string

in Provider at line 50
array providerCredentials()

Get the credentials for the underlying AI provider.

Return Value

array

in Provider at line 60
array additionalConfiguration()

Get the provider connection configuration other than the driver, key, and name.

Return Value

array

in Provider at line 72
Provider withHeaders(array $headers)

internal  
 

Get a provider instance that sends the given HTTP headers with each request.

Parameters

array $headers

Return Value

Provider

in Provider at line 92
protected mixed dispatchingFailure(Closure $call, Closure $failed)

Run the given gateway call, dispatching the event built from its exception before rethrowing.

Parameters

Closure $call
Closure $failed

Return Value

mixed

in Provider at line 114
static array formatProviderAndModelList(Provider|Lab|array|string $providers, string|null $model = null)

Format the given provider / model list.

Parameters

Provider|Lab|array|string $providers
string|null $model

Return Value

array

in Provider at line 132
static array providerAndModelPairs(Provider|Lab|array|string $providers, string|null $model = null)

internal  
 

Get provider and model pairs without discarding on-demand instances.

Parameters

Provider|Lab|array|string $providers
string|null $model

Return Value

array

in Provider at line 164
array __serialize()

Get the serializable representation of the provider.

Return Value

array

in Provider at line 174
void __unserialize(array $data)

Restore the provider from its serialized representation.

Parameters

array $data

Return Value

void

in Provider at line 190
string __toString()

Convert the provider to its string representation.

Return Value

string

in GeneratesAudio at line 23
AudioResponse audio(string $text, string $voice = 'default-female', string|null $instructions = null, string|null $model = null, int $timeout = 30, array $providerOptions = [])

Generate audio from the given text.

Parameters

string $text
string $voice
string|null $instructions
string|null $model
int $timeout
array $providerOptions

Return Value

AudioResponse

TranscriptionResponse transcribe(TranscribableAudio $audio, string|null $language = null, bool $diarize = false, string|null $model = null, int|null $timeout = null, array $providerOptions = [])

Transcribe the given audio to text.

Parameters

TranscribableAudio $audio
string|null $language
bool $diarize
string|null $model
int|null $timeout
array $providerOptions

Return Value

TranscriptionResponse

at line 37
AudioGateway audioGateway()

Get the provider's audio gateway.

Return Value

AudioGateway

in HasAudioGateway at line 27
HasAudioGateway useAudioGateway(AudioGateway $gateway)

Set the provider's audio gateway.

Changing a shared provider's gateway affects subsequent operations.

Parameters

AudioGateway $gateway

Return Value

HasAudioGateway

at line 45
TranscriptionGateway transcriptionGateway()

Get the provider's transcription gateway.

Return Value

TranscriptionGateway

HasTranscriptionGateway useTranscriptionGateway(TranscriptionGateway $gateway)

Set the provider's transcription gateway.

Changing a shared provider's gateway affects subsequent operations.

Parameters

TranscriptionGateway $gateway

Return Value

HasTranscriptionGateway

at line 53
string defaultAudioModel()

Get the name of the default audio (TTS) model.

Return Value

string

at line 61
string defaultTranscriptionModel()

Get the name of the default transcription (STT) model.

Return Value

string