1. Go to this page and download the library: Download zwell/qdrant 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/ */
zwell / qdrant example snippets
use Qdrant\Endpoints\Collections;
use Qdrant\Http\GuzzleClient;
use Qdrant\Models\Request\CreateCollection;
use Qdrant\Models\Request\VectorParams;
onfig));
$createCollection = new CreateCollection();
$createCollection->addVector(new VectorParams(1024, VectorParams::DISTANCE_COSINE), 'image');
$response = $client->collections('images')->create($createCollection);
use Qdrant\Models\PointsStruct;
use Qdrant\Models\PointStruct;
use Qdrant\Models\VectorStruct;
$points = new PointsStruct();
$points->addPoint(
new PointStruct(
(int) $imageId,
new VectorStruct($data['embeddings'][0], 'image'),
[
'id' => 1,
'meta' => 'Meta data'
]
)
);
$client->collections('images')->points()->upsert($points);
use Qdrant\Models\Filter\Condition\MatchString;
use Qdrant\Models\Filter\Filter;
use Qdrant\Models\Request\SearchRequest;
use Qdrant\Models\VectorStruct;
$searchRequest = (new SearchRequest(new VectorStruct($embedding, 'elev_pitch')))
->setFilter(
(new Filter())->addMust(
new MatchString('name', 'Palm')
)
)
->setLimit(10)
->setParams([
'hnsw_ef' => 128,
'exact' => false,
])
->setWithPayload(true);
$response = $client->collections('images')->points()->search($searchRequest);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.