WhisperClient
in package
HTTP client for communicating with the NLP microservice Whisper endpoints.
Provides methods for transcribing audio/video files using Whisper.
Table of Contents
Properties
Methods
- __construct() : mixed
- cancelJob() : bool
- Cancel a transcription job.
- getLanguages() : array<string|int, array{code: string, name: string}>
- Get list of supported languages.
- getModels() : array<string|int, array{name: string, description: string}>
- Get list of available Whisper models.
- getResult() : array{job_id: string, text: string, language: string, duration_seconds: float}
- Get the result of a completed transcription.
- getStatus() : array{job_id: string, status: string, progress: int, message: string}
- Get the status of a transcription job.
- isAvailable() : bool
- Check if Whisper transcription is available.
- startTranscription() : string
- Start a transcription job.
Properties
$baseUrl
private
string
$baseUrl
$timeout
private
int
$timeout
= 30
Methods
__construct()
public
__construct() : mixed
cancelJob()
Cancel a transcription job.
public
cancelJob(string $jobId) : bool
Parameters
- $jobId : string
-
Job ID
Return values
bool —True if cancelled/deleted successfully
getLanguages()
Get list of supported languages.
public
getLanguages() : array<string|int, array{code: string, name: string}>
Return values
array<string|int, array{code: string, name: string}>getModels()
Get list of available Whisper models.
public
getModels() : array<string|int, array{name: string, description: string}>
Return values
array<string|int, array{name: string, description: string}>getResult()
Get the result of a completed transcription.
public
getResult(string $jobId) : array{job_id: string, text: string, language: string, duration_seconds: float}
Parameters
- $jobId : string
-
Job ID
Tags
Return values
array{job_id: string, text: string, language: string, duration_seconds: float}getStatus()
Get the status of a transcription job.
public
getStatus(string $jobId) : array{job_id: string, status: string, progress: int, message: string}
Parameters
- $jobId : string
-
Job ID
Return values
array{job_id: string, status: string, progress: int, message: string}isAvailable()
Check if Whisper transcription is available.
public
isAvailable() : bool
Return values
boolstartTranscription()
Start a transcription job.
public
startTranscription(string $filePath, string $fileName, string|null $language[, string $model = 'small' ]) : string
Parameters
- $filePath : string
-
Path to the uploaded file
- $fileName : string
-
Original filename
- $language : string|null
-
Language code (null for auto-detect)
- $model : string = 'small'
-
Whisper model name
Tags
Return values
string —Job ID for tracking