xref: /plugin/aichat/Model/EmbeddingInterface.php (revision 294a9eaf76b94a3f99dceca7f1750a7898de3dd9)
1*294a9eafSAndreas Gohr<?php
2*294a9eafSAndreas Gohr
3*294a9eafSAndreas Gohrnamespace dokuwiki\plugin\aichat\Model;
4*294a9eafSAndreas Gohr
5*294a9eafSAndreas Gohr/**
6*294a9eafSAndreas Gohr * Defines an embedding model
7*294a9eafSAndreas Gohr */
8*294a9eafSAndreas Gohrinterface EmbeddingInterface
9*294a9eafSAndreas Gohr{
10*294a9eafSAndreas Gohr    /**
11*294a9eafSAndreas Gohr     * Maximum size of chunks this model could handle
12*294a9eafSAndreas Gohr     *
13*294a9eafSAndreas Gohr     * Generally the maximum is defined by the same method in the ChatModel because chunks
14*294a9eafSAndreas Gohr     * need to fit into the chat request.
15*294a9eafSAndreas Gohr     *
16*294a9eafSAndreas Gohr     * @return int
17*294a9eafSAndreas Gohr     */
18*294a9eafSAndreas Gohr    public function getMaxEmbeddingTokenLength();
19*294a9eafSAndreas Gohr
20*294a9eafSAndreas Gohr    /**
21*294a9eafSAndreas Gohr     * Get the dimensions of the embedding vectors
22*294a9eafSAndreas Gohr     *
23*294a9eafSAndreas Gohr     * @return int
24*294a9eafSAndreas Gohr     */
25*294a9eafSAndreas Gohr    public function getDimensions();
26*294a9eafSAndreas Gohr
27*294a9eafSAndreas Gohr    /**
28*294a9eafSAndreas Gohr     * Get the embedding vectors for a given text
29*294a9eafSAndreas Gohr     *
30*294a9eafSAndreas Gohr     * @param string $text
31*294a9eafSAndreas Gohr     * @return float[]
32*294a9eafSAndreas Gohr     * @throws \Exception
33*294a9eafSAndreas Gohr     */
34*294a9eafSAndreas Gohr    public function getEmbedding($text);
35*294a9eafSAndreas Gohr}
36