class PendingAudioGeneration

Traits

Properties

protected array<string, string>|SerializableClosure $headers from  ResolvesProviderOptions
protected array<string, mixed>|SerializableClosure $providerOptions from  ResolvesProviderOptions
protected string $voice
protected string|null $instructions
protected int $timeout

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

withHeaders(array|Closure $headers)

Specify HTTP headers for the request. Closures may only capture serializable values.

withProviderOptions(array|Closure $options)

Specify provider-specific options for the request.

array
resolveProviderOptionsAndHeaders(Provider $provider)

Resolve the request body options and HTTP headers for the given provider.

array
queuedProviderOptions()

Get the serializable provider options recorded by queued fakes.

__construct(string $text)

Create a pending audio generation.

voice(BackedEnum|string $voice)

Specify a specific voice for the generated audio.

male()

Indicate that the voice should be male.

female()

Indicate that the voice should be female.

instructions(string $instructions)

Provide free-form instructions guiding how the audio should sound.

timeout(int $seconds = 30)

Specify the timeout (in seconds) for the audio generation.

generate(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Generate the audio.

queue(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Queue the generation of the audio.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

ResolvesProviderOptions withHeaders(array|Closure $headers)

Specify HTTP headers for the request. Closures may only capture serializable values.

Parameters

array|Closure $headers

Return Value

ResolvesProviderOptions

ResolvesProviderOptions withProviderOptions(array|Closure $options)

Specify provider-specific options for the request.

Parameters

array|Closure $options

Return Value

ResolvesProviderOptions

protected array resolveProviderOptionsAndHeaders(Provider $provider)

Resolve the request body options and HTTP headers for the given provider.

Unlike upstream, accept the contract so custom provider implementations need not extend the base class.

Parameters

Provider $provider

Return Value

array

protected array queuedProviderOptions()

Get the serializable provider options recorded by queued fakes.

Return Value

array

at line 37
__construct(string $text)

Create a pending audio generation.

Parameters

string $text

at line 48
PendingAudioGeneration voice(BackedEnum|string $voice)

Specify a specific voice for the generated audio.

Parameters

BackedEnum|string $voice

Return Value

PendingAudioGeneration

at line 58
PendingAudioGeneration male()

Indicate that the voice should be male.

Return Value

PendingAudioGeneration

at line 68
PendingAudioGeneration female()

Indicate that the voice should be female.

Return Value

PendingAudioGeneration

at line 78
PendingAudioGeneration instructions(string $instructions)

Provide free-form instructions guiding how the audio should sound.

Parameters

string $instructions

Return Value

PendingAudioGeneration

at line 88
PendingAudioGeneration timeout(int $seconds = 30)

Specify the timeout (in seconds) for the audio generation.

Parameters

int $seconds

Return Value

PendingAudioGeneration

at line 100
AudioResponse generate(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Generate the audio.

Parameters

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

Return Value

AudioResponse

Exceptions

FailoverableException

at line 142
QueuedAudioResponse queue(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Queue the generation of the audio.

Parameters

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

Return Value

QueuedAudioResponse