$config */ public function __construct( private readonly string $provider, private readonly array $config, ) {} public function complete(AiRequest $request): AiResponse { Sleep::for((int) ($this->config['delay'] ?? 0))->seconds(); $answer = $request->task === 'edit' ? ['reply' => 'Fake AI: I made the main colour darker.', 'theme' => ['colors' => ['primary' => '#3B2A20']]] : SamplePlan::forName($this->storeName($request->prompt)); return new AiResponse( text: (string) json_encode($answer), provider: $this->provider, model: $request->model, inputTokens: 0, outputTokens: 0, ); } private function storeName(string $prompt): string { return preg_match('/^Store name: (.+)$/m', $prompt, $match) === 1 ? trim($match[1]) : 'Sample Store'; } }