model = $model; } /** * {@inheritDoc} * * Forwards the transporter to the inner model so the test request can be sent. * * @since 1.0.0 */ public function setHttpTransporter(HttpTransporterInterface $transporter): void { $this->httpTransporter = $transporter; if ($this->model instanceof WithHttpTransporterInterface) { $this->model->setHttpTransporter($transporter); } } /** * {@inheritDoc} * * @since 1.0.0 */ public function getHttpTransporter(): HttpTransporterInterface { return $this->httpTransporter; } /** * {@inheritDoc} * * Forwards the authentication to the inner model so the test request is authenticated. * * @since 1.0.0 */ public function setRequestAuthentication(RequestAuthenticationInterface $authentication): void { $this->requestAuthentication = $authentication; if ($this->model instanceof WithRequestAuthenticationInterface) { $this->model->setRequestAuthentication($authentication); } } /** * {@inheritDoc} * * @since 1.0.0 */ public function getRequestAuthentication(): RequestAuthenticationInterface { return $this->requestAuthentication; } /** * {@inheritDoc} * * Sends a minimal (single token) text generation request to verify the credentials. * * @since 1.0.0 */ public function isConfigured(): bool { $modelConfig = ModelConfig::fromArray([ModelConfig::KEY_MAX_TOKENS => 1]); $this->model->setConfig($modelConfig); try { $this->model->generateTextResult([new Message(MessageRoleEnum::user(), [new MessagePart('a')])]); return true; } catch (Exception $e) { return false; } } }