22 lines
747 B
PHP
22 lines
747 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Support\AiProviders;
|
||
|
|
|
||
|
|
use App\Models\AiProvider;
|
||
|
|
|
||
|
|
interface AiProviderDriver
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Generate content from a prompt. What "content" means depends on the
|
||
|
|
* provider — text for a text generator, image bytes for an image
|
||
|
|
* generator, audio bytes for a speech synthesizer. $options overrides
|
||
|
|
* $provider->config for this call only (e.g. model, voice_id).
|
||
|
|
*
|
||
|
|
* @param array<string, mixed> $options
|
||
|
|
*
|
||
|
|
* @throws AiGenerationException on any failure (bad credentials,
|
||
|
|
* unreachable API, rejected prompt, unexpected response shape).
|
||
|
|
*/
|
||
|
|
public function generate(AiProvider $provider, string $prompt, array $options = []): AiGenerationResult;
|
||
|
|
}
|