Skip to content

Commit

Permalink
store embedding meta data on start
Browse files Browse the repository at this point in the history
This way errors during the a new embedding run will not trigger a clear
index on retry
  • Loading branch information
splitbrain committed Jul 22, 2024
1 parent 8502e30 commit 22a3672
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,14 @@ protected function createEmbeddings($clear)
$clear = true;
}

$data['embed ran at'] = dformat();
$data['embed used'] = (string) $this->helper->getEmbeddingModel();
$this->helper->setRunData($data);

$start = time();
$this->helper->getEmbeddings()->createNewIndex($skipRE, $matchRE, $clear);
$this->notice('Peak memory used: {memory}', ['memory' => filesize_h(memory_get_peak_usage(true))]);
$this->notice('Spent time: {time}min', ['time' => round((time() - $start) / 60, 2)]);


$data['embed ran at'] = dformat();
$data['embed used'] = (string) $this->helper->getEmbeddingModel();
$this->helper->setRunData($data);
}

/**
Expand Down

0 comments on commit 22a3672

Please sign in to comment.