xref: /plugin/aichat/Model/EmbeddingInterface.php (revision 4373d2bf7fcddc76e5ba367d903e3d0d86697dff)
1294a9eafSAndreas Gohr<?php
2294a9eafSAndreas Gohr
3294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model;
4294a9eafSAndreas Gohr
5294a9eafSAndreas Gohr/**
6294a9eafSAndreas Gohr * Defines an embedding model
7294a9eafSAndreas Gohr */
8*4373d2bfSAndreas Gohrinterface EmbeddingInterface extends ModelInterface
9294a9eafSAndreas Gohr{
10294a9eafSAndreas Gohr    /**
11294a9eafSAndreas Gohr     * Maximum size of chunks this model could handle
12294a9eafSAndreas Gohr     *
13294a9eafSAndreas Gohr     * Generally the maximum is defined by the same method in the ChatModel because chunks
14294a9eafSAndreas Gohr     * need to fit into the chat request.
15294a9eafSAndreas Gohr     *
16294a9eafSAndreas Gohr     * @return int
17294a9eafSAndreas Gohr     */
18294a9eafSAndreas Gohr    public function getMaxEmbeddingTokenLength();
19294a9eafSAndreas Gohr
20294a9eafSAndreas Gohr    /**
21294a9eafSAndreas Gohr     * Get the dimensions of the embedding vectors
22294a9eafSAndreas Gohr     *
23294a9eafSAndreas Gohr     * @return int
24294a9eafSAndreas Gohr     */
25294a9eafSAndreas Gohr    public function getDimensions();
26294a9eafSAndreas Gohr
27294a9eafSAndreas Gohr    /**
28294a9eafSAndreas Gohr     * Get the embedding vectors for a given text
29294a9eafSAndreas Gohr     *
30294a9eafSAndreas Gohr     * @param string $text
31294a9eafSAndreas Gohr     * @return float[]
32294a9eafSAndreas Gohr     * @throws \Exception
33294a9eafSAndreas Gohr     */
34294a9eafSAndreas Gohr    public function getEmbedding($text);
35294a9eafSAndreas Gohr}
36