1294a9eafSAndreas Gohr<?php 2294a9eafSAndreas Gohr 3294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model; 4294a9eafSAndreas Gohr 5294a9eafSAndreas Gohr/** 6294a9eafSAndreas Gohr * Defines a chat completion model 7294a9eafSAndreas Gohr */ 8*4373d2bfSAndreas Gohrinterface ChatInterface extends ModelInterface 9294a9eafSAndreas Gohr{ 10294a9eafSAndreas Gohr /** 11294a9eafSAndreas Gohr * Maximum number of tokens to use when creating context info. Should be smaller than the absolute 12294a9eafSAndreas Gohr * token limit of the model, so that prompts and questions can be added. 13294a9eafSAndreas Gohr * 14294a9eafSAndreas Gohr * @return int 15294a9eafSAndreas Gohr */ 16294a9eafSAndreas Gohr public function getMaxContextTokenLength(); 17294a9eafSAndreas Gohr 18294a9eafSAndreas Gohr /** 19294a9eafSAndreas Gohr * Maximum number of tokens to use as context when rephrasing a question. Should be smaller than the 20294a9eafSAndreas Gohr * absolute token limit of the model, so that prompts and questions can be added. 21294a9eafSAndreas Gohr * 22294a9eafSAndreas Gohr * @return int 23294a9eafSAndreas Gohr */ 24294a9eafSAndreas Gohr public function getMaxRephrasingTokenLength(); 25294a9eafSAndreas Gohr 26294a9eafSAndreas Gohr /** 27294a9eafSAndreas Gohr * Maximum size of chunks to be created for this model 28294a9eafSAndreas Gohr * 29294a9eafSAndreas Gohr * Should be a size small enough to fit at least a few chunks into the context token limit. 30294a9eafSAndreas Gohr * 31294a9eafSAndreas Gohr * @return int 32294a9eafSAndreas Gohr */ 33294a9eafSAndreas Gohr public function getMaxEmbeddingTokenLength(); 34294a9eafSAndreas Gohr 35294a9eafSAndreas Gohr /** 36294a9eafSAndreas Gohr * Answer a given question. 37294a9eafSAndreas Gohr * 38294a9eafSAndreas Gohr * Any prompt, chat history, context etc. will already be included in the $messages array. 39294a9eafSAndreas Gohr * 40294a9eafSAndreas Gohr * @param array $messages Messages in OpenAI format (with role and content) 41294a9eafSAndreas Gohr * @return string The answer 42294a9eafSAndreas Gohr * @throws \Exception 43294a9eafSAndreas Gohr */ 44294a9eafSAndreas Gohr public function getAnswer($messages); 45294a9eafSAndreas Gohr} 46