1<?php 2 3namespace dokuwiki\plugin\aichat\Model\Gemini; 4 5use dokuwiki\plugin\aichat\Model\EmbeddingInterface; 6 7class EmbeddingModel extends AbstractGeminiModel implements EmbeddingInterface 8{ 9 10 public function getEmbedding($text): array 11 { 12 13 $data = [ 14 'model' => $this->getModelName(), 15 'content' => [ 16 'parts' => [ 17 ['text' => $text] 18 ] 19 ] 20 ]; 21 22 $response = $this->request($this->getModelName(), 'embedContent', $data); 23 24 return $response['embedding']['values']; 25 } 26} 27