Skip to content

Commit 2471687

Browse files
authored
Merge pull request #501 from bytestream/patch-2
Refactor to create collection in a separate method
2 parents 937c356 + 1d6e21b commit 2471687

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/RAG/VectorStore/QdrantVectorStore.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,7 @@ protected function initialize(): void
5454
return;
5555
}
5656

57-
$this->httpClient->request(
58-
HttpRequest::put(
59-
uri: '',
60-
body: [
61-
'vectors' => [
62-
'size' => $this->dimension,
63-
'distance' => 'Cosine',
64-
],
65-
],
66-
)
67-
);
57+
$this->createCollection();
6858
}
6959

7060
/**
@@ -182,4 +172,19 @@ public function similaritySearch(array $embedding): iterable
182172
return $document;
183173
}, $response['result']['points']);
184174
}
175+
176+
protected function createCollection(): void
177+
{
178+
$this->httpClient->request(
179+
HttpRequest::put(
180+
uri: '',
181+
body: [
182+
'vectors' => [
183+
'size' => $this->dimension,
184+
'distance' => 'Cosine',
185+
],
186+
],
187+
)
188+
);
189+
}
185190
}

0 commit comments

Comments
 (0)