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