1. Go to this page and download the library: Download vineyard/s3-vectors-laravel 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/ */
vineyard / s3-vectors-laravel example snippets
use Vineyard\S3Vectors\Facades\S3Vectors;
// Query (cached)
$hits = S3Vectors::query($vector, topK: 5); // returns ['vectors' => [['key' => '...', 'distance' => 0.12, 'metadata' => [...]], ...]]
// Get metadata by keys (cached)
$info = S3Vectors::getVectors(['vectors/key1', 'vectors/key2']);
// Put many vectors (invalidates cache for this index)
S3Vectors::putVectors([
['key' => 'vectors/key1', 'data' => ['float32' => $v1], 'metadata' => ['doc_id' => '123']],
['key' => 'vectors/key2', 'data' => ['float32' => $v2]],
]);
// Batched put (chunks to 500 by default)
S3Vectors::putVectorsBatched($bigArrayOfVectors, 500);
// Delete
S3Vectors::deleteVectors(['vectors/key1', 'vectors/key2']);
// Batched delete (chunks to 500 by default)
S3Vectors::deleteVectorsBatched($bigArrayOfVectors, 500);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.