xref: /plugin/aichat/Model/OpenAI/AbstractOpenAIModel.php (revision 2e22aefbcc83da0bc9ab21a2175b8ada4ba79826)
1<?php
2
3namespace dokuwiki\plugin\aichat\Model\OpenAI;
4
5use dokuwiki\plugin\aichat\Model\Generic\AbstractGenericModel;
6
7/**
8 * Abstract OpenAI Model
9 *
10 * This class provides a basic interface to the OpenAI API
11 */
12abstract class AbstractOpenAIModel extends AbstractGenericModel
13{
14    protected $apiurl = 'https://api.openai.com/v1/';
15
16    /** @inheritdoc */
17    public function __construct(string $name, array $config)
18    {
19        parent::__construct($name, $config);
20
21        $orgKey = $this->getFromConf($config, 'org', '');
22
23        if ($orgKey) {
24            $this->http->headers['OpenAI-Organization'] = $orgKey;
25        }
26    }
27}
28