1*294a9eafSAndreas Gohr<?php 2*294a9eafSAndreas Gohr 3*294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model; 4*294a9eafSAndreas Gohr 5*294a9eafSAndreas Gohr/** 6*294a9eafSAndreas Gohr * Defines a chat completion model 7*294a9eafSAndreas Gohr */ 8*294a9eafSAndreas Gohrinterface ChatInterface 9*294a9eafSAndreas Gohr{ 10*294a9eafSAndreas Gohr /** 11*294a9eafSAndreas Gohr * Maximum number of tokens to use when creating context info. Should be smaller than the absolute 12*294a9eafSAndreas Gohr * token limit of the model, so that prompts and questions can be added. 13*294a9eafSAndreas Gohr * 14*294a9eafSAndreas Gohr * @return int 15*294a9eafSAndreas Gohr */ 16*294a9eafSAndreas Gohr public function getMaxContextTokenLength(); 17*294a9eafSAndreas Gohr 18*294a9eafSAndreas Gohr /** 19*294a9eafSAndreas Gohr * Maximum number of tokens to use as context when rephrasing a question. Should be smaller than the 20*294a9eafSAndreas Gohr * absolute token limit of the model, so that prompts and questions can be added. 21*294a9eafSAndreas Gohr * 22*294a9eafSAndreas Gohr * @return int 23*294a9eafSAndreas Gohr */ 24*294a9eafSAndreas Gohr public function getMaxRephrasingTokenLength(); 25*294a9eafSAndreas Gohr 26*294a9eafSAndreas Gohr /** 27*294a9eafSAndreas Gohr * Maximum size of chunks to be created for this model 28*294a9eafSAndreas Gohr * 29*294a9eafSAndreas Gohr * Should be a size small enough to fit at least a few chunks into the context token limit. 30*294a9eafSAndreas Gohr * 31*294a9eafSAndreas Gohr * @return int 32*294a9eafSAndreas Gohr */ 33*294a9eafSAndreas Gohr public function getMaxEmbeddingTokenLength(); 34*294a9eafSAndreas Gohr 35*294a9eafSAndreas Gohr /** 36*294a9eafSAndreas Gohr * Answer a given question. 37*294a9eafSAndreas Gohr * 38*294a9eafSAndreas Gohr * Any prompt, chat history, context etc. will already be included in the $messages array. 39*294a9eafSAndreas Gohr * 40*294a9eafSAndreas Gohr * @param array $messages Messages in OpenAI format (with role and content) 41*294a9eafSAndreas Gohr * @return string The answer 42*294a9eafSAndreas Gohr * @throws \Exception 43*294a9eafSAndreas Gohr */ 44*294a9eafSAndreas Gohr public function getAnswer($messages); 45*294a9eafSAndreas Gohr} 46