Skip to content

Commit 33fa2a6

Browse files
committed
Add bundle configuration for Qdrant async
1 parent 5e715fa commit 33fa2a6

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

src/ai-bundle/config/options.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@
607607
->stringNode('collection_name')->cannotBeEmpty()->end()
608608
->integerNode('dimensions')->end()
609609
->stringNode('distance')->end()
610+
->booleanNode('async')->defaultTrue()->end()
610611
->end()
611612
->end()
612613
->end()

src/ai-bundle/src/AiBundle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,10 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
11021102
$arguments[5] = $store['distance'];
11031103
}
11041104

1105+
if (\array_key_exists('async', $store)) {
1106+
$arguments[6] = $store['async'];
1107+
}
1108+
11051109
$definition = new Definition(QdrantStore::class);
11061110
$definition
11071111
->addTag('ai.store')

src/ai-bundle/tests/DependencyInjection/AiBundleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,6 +2942,7 @@ private function getFullConfig(): array
29422942
'collection_name' => 'foo',
29432943
'dimensions' => 768,
29442944
'distance' => 'Cosine',
2945+
'async' => true,
29452946
],
29462947
],
29472948
'redis' => [

src/store/src/Bridge/Qdrant/Store.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ public function setup(array $options = []): void
5959

6060
public function add(VectorDocument ...$documents): void
6161
{
62-
$this->request('PUT', \sprintf('collections/%s/points', $this->collectionName), [
63-
'points' => array_map($this->convertToIndexableArray(...), $documents),
64-
],
65-
!$this->async ? ['wait' => 'true'] : []);
62+
$this->request(
63+
'PUT',
64+
\sprintf('collections/%s/points', $this->collectionName),
65+
[
66+
'points' => array_map($this->convertToIndexableArray(...), $documents),
67+
],
68+
!$this->async ? ['wait' => 'true'] : []
69+
);
6670
}
6771

6872
/**

src/store/tests/Bridge/Qdrant/StoreTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function testStoreCanAddSynchronously()
189189
'id' => (string) $document->id,
190190
'payload' => (array) $document->metadata,
191191
'vector' => $document->vector->getData(),
192-
]
192+
],
193193
],
194194
],
195195
], [
@@ -202,7 +202,6 @@ public function testStoreCanAddSynchronously()
202202
$store->add($document);
203203

204204
$this->assertSame(1, $httpClient->getRequestsCount());
205-
$this->assertSame(1, $httpClient->getRequestsCount());
206205
}
207206

208207
public function testStoreCannotQueryOnInvalidResponse()

0 commit comments

Comments
 (0)