PHP code example of wontonee / laravel-qdrant-sdk

1. Go to this page and download the library: Download wontonee/laravel-qdrant-sdk 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/ */

    

wontonee / laravel-qdrant-sdk example snippets


use Wontonee\LarQ\Qdrant\Collections\CreateCollection;

$vectorParams = [
    'size' => 3,
    'distance' => 'Cosine',
];
$response = (new CreateCollection())->handle('my_collection', $vectorParams);

use Wontonee\LarQ\Qdrant\Points\UpsertPoints;

$points = [
    [
        'id' => 1,
        'vector' => [0.1, 0.2, 0.3],
        'payload' => ['label' => 'A'],
    ],
];
$response = (new UpsertPoints())->handle('my_collection', $points);

use Wontonee\LarQ\Qdrant\Points\ScrollPoints;
$response = (new ScrollPoints())->handle('my_collection', 10);

use Wontonee\LarQ\Qdrant\Collections\ListCollections;
$response = (new ListCollections())->handle();

use Wontonee\LarQ\Traits\HasVectors;

class Product extends Model {
    use HasVectors;
    // Optionally override vectorText(), vectorPayload(), etc.
}
sh
   php artisan vendor:publish --provider="Wontonee\LarQ\Providers\LarQServiceProvider" --tag=larq-config