class FakeTranscriptionGateway implements TranscriptionGateway

Properties

protected int $currentResponseIndex
protected bool $preventStrayGenerations

Methods

__construct(Closure|array $responses = [])

Create a transcription gateway with fake responses.

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

Generate text from the given audio.

nextResponse(TranscriptionProvider $provider, string $model, TranscriptionPrompt $prompt)

Get the next response instance.

marshalResponse(mixed $response, TranscriptionProvider $provider, string $model, TranscriptionPrompt $prompt)

Marshal the given response into a full response instance.

preventStrayTranscriptions(bool $prevent = true)

Indicate that an exception should be thrown if any transcription generation is not faked.

Details

at line 29
__construct(Closure|array $responses = [])

Create a transcription gateway with fake responses.

Parameters

Closure|array $responses

at line 39
TranscriptionResponse generateTranscription(TranscriptionProvider $provider, string $model, TranscribableAudio $audio, string|null $language = null, bool $diarize = false, int $timeout = 30, array $providerOptions = [])

Generate text from the given audio.

Parameters

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

Return Value

TranscriptionResponse

at line 56
protected TranscriptionResponse nextResponse(TranscriptionProvider $provider, string $model, TranscriptionPrompt $prompt)

Get the next response instance.

Parameters

TranscriptionProvider $provider
string $model
TranscriptionPrompt $prompt

Return Value

TranscriptionResponse

at line 76
protected TranscriptionResponse marshalResponse(mixed $response, TranscriptionProvider $provider, string $model, TranscriptionPrompt $prompt)

Marshal the given response into a full response instance.

Parameters

mixed $response
TranscriptionProvider $provider
string $model
TranscriptionPrompt $prompt

Return Value

TranscriptionResponse

at line 114
FakeTranscriptionGateway preventStrayTranscriptions(bool $prevent = true)

Indicate that an exception should be thrown if any transcription generation is not faked.

When the shared manager holds this fake gateway, the setting affects every request in the worker.

Parameters

bool $prevent

Return Value

FakeTranscriptionGateway