1294a9eafSAndreas Gohr<?php 2294a9eafSAndreas Gohr 3294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model\OpenAI; 4294a9eafSAndreas Gohr 5*2e22aefbSAndreas 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 */ 12*2e22aefbSAndreas Gohrabstract class AbstractOpenAIModel extends AbstractGenericModel 13294a9eafSAndreas Gohr{ 14*2e22aefbSAndreas Gohr protected $apiurl = 'https://api.openai.com/v1/'; 15*2e22aefbSAndreas Gohr 16294a9eafSAndreas Gohr /** @inheritdoc */ 17dce0dee5SAndreas Gohr public function __construct(string $name, array $config) 18294a9eafSAndreas Gohr { 19dce0dee5SAndreas Gohr parent::__construct($name, $config); 20294a9eafSAndreas Gohr 21*2e22aefbSAndreas Gohr $orgKey = $this->getFromConf($config, 'org', ''); 22e8451b21SAndreas Gohr 23*2e22aefbSAndreas Gohr if ($orgKey) { 24*2e22aefbSAndreas Gohr $this->http->headers['OpenAI-Organization'] = $orgKey; 25294a9eafSAndreas Gohr } 26294a9eafSAndreas Gohr } 27294a9eafSAndreas Gohr} 28