1<?php
2
3namespace dokuwiki\plugin\aichat\Model\Mistral;
4
5use dokuwiki\plugin\aichat\Model\EmbeddingInterface;
6
7class EmbeddingModel extends AbstractMistralModel implements EmbeddingInterface
8{
9    /** @inheritdoc */
10    public function getEmbedding($text): array
11    {
12        $data = [
13            'model' => $this->getModelName(),
14            'input' => [$text],
15            "encoding_format" => "float",
16        ];
17        $response = $this->request('embeddings', $data);
18
19        return $response['data'][0]['embedding'];
20    }
21}
22