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