PHP code example of rhaima96 / laravel-vector-metrics
1. Go to this page and download the library: Download rhaima96/laravel-vector-metrics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rhaima96 / laravel-vector-metrics example snippets
Schema::create('documents', function (Blueprint $table) {
$table->id();
$table->vector('embedding', 1536);
// MariaDB: VECTOR INDEX ... M=16 DISTANCE=euclidean
// Postgres: USING hnsw (embedding vector_l2_ops)
$table->vectorIndexUsing('embedding', 'euclidean', m: 16);
});