xref: /plugin/aichat/Model/Groq/ChatModel.php (revision 2e22aefbcc83da0bc9ab21a2175b8ada4ba79826)
1074b7701SAndreas Gohr<?php
2074b7701SAndreas Gohr
3074b7701SAndreas Gohrnamespace dokuwiki\plugin\aichat\Model\Groq;
4074b7701SAndreas Gohr
5*2e22aefbSAndreas Gohruse dokuwiki\plugin\aichat\Model\Generic\AbstractGenericModel;
6074b7701SAndreas Gohr
7*2e22aefbSAndreas Gohrclass ChatModel extends AbstractGenericModel
8074b7701SAndreas Gohr{
9*2e22aefbSAndreas Gohr    protected $apiurl = 'https://api.groq.com/openai/v1/';
10074b7701SAndreas Gohr
11074b7701SAndreas Gohr    /** @inheritdoc */
12*2e22aefbSAndreas Gohr    function loadUnknownModelInfo(): array
13074b7701SAndreas Gohr    {
14*2e22aefbSAndreas Gohr        $info = parent::loadUnknownModelInfo();
15074b7701SAndreas Gohr
16*2e22aefbSAndreas Gohr        $model = $this->sendAPIRequest('GET', $this->apiurl . 'models/' . $this->modelName, '');
17*2e22aefbSAndreas Gohr        if (isset($model['context_window'])) {
18*2e22aefbSAndreas Gohr            $info['inputTokens'] = $model['context_window'];
19074b7701SAndreas Gohr        }
20*2e22aefbSAndreas Gohr        return $info;
21074b7701SAndreas Gohr    }
22074b7701SAndreas Gohr}
23