*/ abstract public function stream(string $prompt, string|null $model = null): Generator; /** * Returns a configuration value or throws when required. */ protected function config(string $key, mixed $default = null, bool $required = false): mixed { $value = Seo::option("ai.providers.{$this->providerId}.config.{$key}", $default); if ($required === true && ($value === null || $value === '')) { throw new InvalidArgumentException( "Missing required \"{$key}\" configuration for driver " . static::class . '.' ); } return $value; } }