1074b7701SAndreas Gohr<?php 2074b7701SAndreas Gohr 3074b7701SAndreas Gohrnamespace dokuwiki\plugin\aichat\Model\Ollama; 4074b7701SAndreas Gohr 5074b7701SAndreas Gohruse dokuwiki\plugin\aichat\Model\ChatInterface; 6074b7701SAndreas Gohr 7074b7701SAndreas Gohrclass ChatModel extends AbstractOllama implements ChatInterface 8074b7701SAndreas Gohr{ 9074b7701SAndreas Gohr /** @inheritdoc */ 10074b7701SAndreas Gohr public function getAnswer(array $messages): string 11074b7701SAndreas Gohr { 12074b7701SAndreas Gohr $data = [ 13074b7701SAndreas Gohr 'messages' => $messages, 14074b7701SAndreas Gohr 'model' => $this->getModelName(), 15074b7701SAndreas Gohr 'stream' => false, 16*4dd0657eSAndreas Gohr 'options' => [ 17*4dd0657eSAndreas Gohr 'num_ctx' => $this->getMaxInputTokenLength() 18*4dd0657eSAndreas Gohr ] 19074b7701SAndreas Gohr ]; 20074b7701SAndreas Gohr $response = $this->request('chat', $data); 21074b7701SAndreas Gohr return $response['message']['content']; 22074b7701SAndreas Gohr } 23074b7701SAndreas Gohr} 24