![]() Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : fdshops ( 1003) PHP Version : 8.2.21 Disable Function : NONE Directory : /home/fdshops/public_html/vendor/openai-php/client/src/Resources/ |
<?php declare(strict_types=1); namespace OpenAI\Resources; use OpenAI\Contracts\Resources\AudioContract; use OpenAI\Responses\Audio\TranscriptionResponse; use OpenAI\Responses\Audio\TranslationResponse; use OpenAI\ValueObjects\Transporter\Payload; final class Audio implements AudioContract { use Concerns\Transportable; /** * Transcribes audio into the input language. * * @see https://platform.openai.com/docs/api-reference/audio/create * * @param array<string, mixed> $parameters */ public function transcribe(array $parameters): TranscriptionResponse { $payload = Payload::upload('audio/transcriptions', $parameters); /** @var array{task: ?string, language: ?string, duration: ?float, segments: array<int, array{id: int, seek: int, start: float, end: float, text: string, tokens: array<int, int>, temperature: float, avg_logprob: float, compression_ratio: float, no_speech_prob: float, transient: bool}>, text: string}|string $result */ $result = $this->transporter->requestObject($payload); return TranscriptionResponse::from($result); } /** * Translates audio into English. * * @see https://platform.openai.com/docs/api-reference/audio/create * * @param array<string, mixed> $parameters */ public function translate(array $parameters): TranslationResponse { $payload = Payload::upload('audio/translations', $parameters); /** @var array{task: ?string, language: ?string, duration: ?float, segments: array<int, array{id: int, seek: int, start: float, end: float, text: string, tokens: array<int, int>, temperature: float, avg_logprob: float, compression_ratio: float, no_speech_prob: float, transient: bool}>, text: string}|string $result */ $result = $this->transporter->requestObject($payload); return TranslationResponse::from($result); } }