-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support uploading files #9
Conversation
Should we abstract this into a higher-level API along the lines of the following? $value= $ai->api('/audio/transcriptions')->upload($file, ['model' => 'whisper-1']); |
Maybe (like with Unsure how to implement at the moment... |
How about this: // Using transfer
$response $ai->api('/audio/transcriptions')
->open(['model' => 'whisper-1']);
->transfer('file', $file->in(), $file->filename)
->finish()
;
// Using streaming
$uploads= $ai->api('/audio/transcriptions')->open(['model' => 'whisper-1']);
$stream= $uploads->stream('file', $file->filename);
while ($in->available()) {
$stream->write($in->read());
}
$response= $uploads->finish(); This mimicks the (underlying) |
Integration tests for transcription:
|
This can be used for file uploads or to transcribe audio, for example:
See also