AiProviderDriver: one generic interface (generate(prompt, options) ->
AiGenerationResult) rather than per-capability interfaces, since text
(OpenAI chat completions), image (StabilityAI stable-image), and
speech (ElevenLabs TTS) generation all reduce to prompt-in/content-out.
Drivers throw AiGenerationException on failure; AiProviderManager
resolves the right driver from an AiProvider record's `provider`
column and guards on is_active. Real request/response shapes per each
provider's API, verified with Http::fake() — no live API keys
available yet to smoke test against the real services.
AssetStorage: stores generated content under
video-projects/{id}/{type}/v{n}.{ext}, versioned per (project, type[,
step]) slot so retries don't clobber earlier output, plus
contents/url/delete and pruneOldVersions for cleanup.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support\AiProviders;
|
||||
|
||||
final class AiGenerationResult
|
||||
{
|
||||
/**
|
||||
* @param string $content Text or raw binary bytes, depending on $contentType.
|
||||
* @param array<string, mixed> $raw The provider's decoded response, for debugging/metadata.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $content,
|
||||
public readonly string $contentType,
|
||||
public readonly array $raw = [],
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user