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