xref: /plugin/aichat/Model/ModelInterface.php (revision dce0dee5ef27bcbbc5570fc278f3e75f426c19c5)
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     * The name as used by the LLM provider
23     *
24     * @return string
25     */
26    public function getModelName();
27
28    /**
29     * Reset the usage statistics
30     *
31     * Usually not needed when only handling one operation per request, but useful in CLI
32     */
33    public function resetUsageStats();
34
35    /**
36     * Get the usage statistics for this instance
37     *
38     * @return string[]
39     */
40    public function getUsageStats();
41
42    /**
43     * Maximum number of tokens the model can handle as input.
44     *
45     * This is the absolute limit, including any context, prompts, questions etc.
46     */
47    public function getMaxInputTokenLength(): int;
48
49    /**
50     * The price for 1,000,000 input tokens in USD
51     */
52    public function getInputTokenPrice(): float;
53
54}
55