1*cfd76f4aSAndreas Gohr<?php 2*cfd76f4aSAndreas Gohr 3*cfd76f4aSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model\Mistral; 4*cfd76f4aSAndreas Gohr 5*cfd76f4aSAndreas Gohruse dokuwiki\plugin\aichat\Model\ChatInterface; 6*cfd76f4aSAndreas Gohr 7*cfd76f4aSAndreas Gohrclass ChatModel extends AbstractMistralModel implements ChatInterface 8*cfd76f4aSAndreas Gohr{ 9*cfd76f4aSAndreas Gohr /** @inheritdoc */ 10*cfd76f4aSAndreas Gohr public function getAnswer(array $messages): string 11*cfd76f4aSAndreas Gohr { 12*cfd76f4aSAndreas Gohr $data = [ 13*cfd76f4aSAndreas Gohr 'messages' => $messages, 14*cfd76f4aSAndreas Gohr 'model' => $this->getModelName(), 15*cfd76f4aSAndreas Gohr 'max_tokens' => null, 16*cfd76f4aSAndreas Gohr 'stream' => false, 17*cfd76f4aSAndreas Gohr 'temperature' => 0.0, 18*cfd76f4aSAndreas Gohr ]; 19*cfd76f4aSAndreas Gohr $response = $this->request('chat/completions', $data); 20*cfd76f4aSAndreas Gohr return $response['choices'][0]['message']['content']; 21*cfd76f4aSAndreas Gohr } 22*cfd76f4aSAndreas Gohr} 23