1294a9eafSAndreas Gohr<?php 2294a9eafSAndreas Gohr 3294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model; 4294a9eafSAndreas Gohr 5294a9eafSAndreas Gohr/** 6294a9eafSAndreas Gohr * Defines a chat completion model 7294a9eafSAndreas Gohr */ 84373d2bfSAndreas Gohrinterface ChatInterface extends ModelInterface 9294a9eafSAndreas Gohr{ 10294a9eafSAndreas Gohr /** 1134a1c478SAndreas Gohr * Maximum number of tokens the model can output as an answer 12294a9eafSAndreas Gohr */ 1334a1c478SAndreas Gohr public function getMaxOutputTokenLength(): int; 14294a9eafSAndreas Gohr 15294a9eafSAndreas Gohr /** 1634a1c478SAndreas Gohr * The price for 1,000,000 output tokens in USD 17294a9eafSAndreas Gohr */ 1834a1c478SAndreas Gohr public function getOutputTokenPrice(): float; 19294a9eafSAndreas Gohr 20294a9eafSAndreas Gohr /** 21294a9eafSAndreas Gohr * Answer a given question. 22294a9eafSAndreas Gohr * 23294a9eafSAndreas Gohr * Any prompt, chat history, context etc. will already be included in the $messages array. 24294a9eafSAndreas Gohr * 25294a9eafSAndreas Gohr * @param array $messages Messages in OpenAI format (with role and content) 26294a9eafSAndreas Gohr * @return string The answer 27294a9eafSAndreas Gohr * @throws \Exception 28294a9eafSAndreas Gohr */ 29*dce0dee5SAndreas Gohr public function getAnswer(array $messages): string; 30294a9eafSAndreas Gohr} 31