1294a9eafSAndreas Gohr<?php 2294a9eafSAndreas Gohr 3294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model\OpenAI; 4294a9eafSAndreas Gohr 52e22aefbSAndreas Gohruse dokuwiki\plugin\aichat\Model\Generic\AbstractGenericModel; 6294a9eafSAndreas Gohr 7294a9eafSAndreas Gohr/** 8294a9eafSAndreas Gohr * Abstract OpenAI Model 9294a9eafSAndreas Gohr * 10294a9eafSAndreas Gohr * This class provides a basic interface to the OpenAI API 11294a9eafSAndreas Gohr */ 122e22aefbSAndreas Gohrabstract class AbstractOpenAIModel extends AbstractGenericModel 13294a9eafSAndreas Gohr{ 142e22aefbSAndreas Gohr protected $apiurl = 'https://api.openai.com/v1/'; 152e22aefbSAndreas Gohr 16*7c3b69cbSAndreas Gohr protected function getHttpClient() 17294a9eafSAndreas Gohr { 18*7c3b69cbSAndreas Gohr $http = parent::getHttpClient(); 19*7c3b69cbSAndreas Gohr $orgKey = $this->getFromConf('org', ''); 202e22aefbSAndreas Gohr if ($orgKey) { 212e22aefbSAndreas Gohr $this->http->headers['OpenAI-Organization'] = $orgKey; 22294a9eafSAndreas Gohr } 23*7c3b69cbSAndreas Gohr 24*7c3b69cbSAndreas Gohr return $http; 25294a9eafSAndreas Gohr } 26294a9eafSAndreas Gohr} 27