Lines Matching refs:vector
139 public function getSimilarChunks($vector, $lang = '', $limit = 4)
141 $cluster = $this->getCluster($vector, $lang);
155 [json_encode($vector, JSON_THROW_ON_ERROR), $cluster, $this->similarityThreshold, $limit]
196 * @param string $query JSON encoded vector array
197 * @param string $embedding JSON encoded vector array
213 * @param float[] $queryVector The normalized vector of the search phrase
214 * @param float[] $embedding The normalized vector of the chunk
329 $vector = json_decode((string) $record['embedding'], true, 512, JSON_THROW_ON_ERROR);
330 $cluster = $this->getCluster($vector, $this->useLanguageClusters ? $record['lang'] : '');
342 * Get the nearest cluster for the given vector
344 * @param float[] $vector
347 protected function getCluster($vector, $lang)
361 $result = $this->db->queryRecord($query, [json_encode($vector, JSON_THROW_ON_ERROR)]);
392 $vector = json_decode((string) $row['embedding'], true, 512, JSON_THROW_ON_ERROR);
393 $vector = implode("\t", $vector);
397 file_put_contents($vectorfile, $vector . "\n", FILE_APPEND);