1<?php 2 3namespace dokuwiki\plugin\aichat\Model; 4 5/** 6 * Interface for all models 7 * 8 * Model classes should inherit from AbstractModel, to avoid handling the statistics themselves. 9 */ 10interface ModelInterface 11{ 12 /** 13 * Initialize the model 14 * 15 * @param string $name The name of the model as used by the LLM provider 16 * @param array $config The plugin configuration 17 * @throws \Exception when the model cannot be initialized 18 */ 19 public function __construct(string $name, array $config); 20 21 /** 22 * Get the full model name as used in the configuration 23 */ 24 public function __toString(): string; 25 26 /** 27 * The name as used by the LLM provider 28 * 29 * @return string 30 */ 31 public function getModelName(); 32 33 /** 34 * Reset the usage statistics 35 * 36 * Usually not needed when only handling one operation per request, but useful in CLI 37 */ 38 public function resetUsageStats(); 39 40 /** 41 * Get the usage statistics for this instance 42 * 43 * @return string[] 44 */ 45 public function getUsageStats(); 46 47 /** 48 * Maximum number of tokens the model can handle as input. 49 * 50 * This is the absolute limit, including any context, prompts, questions etc. 51 */ 52 public function getMaxInputTokenLength(): int; 53 54 /** 55 * The price for 1,000,000 input tokens in USD 56 */ 57 public function getInputTokenPrice(): float; 58} 59