Skip to content

Commit dd10a02

Browse files
committed
conf
1 parent 70fe268 commit dd10a02

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

examples/.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ MILVUS_HOST=http://127.0.0.1:19530
118118
MILVUS_API_KEY=root:Milvus
119119
MILVUS_DATABASE=symfony
120120

121-
# Weaviate
122-
WEAVIATE_HOST=http://127.0.0.1:8080
123-
WEAVIATE_API_KEY=symfony
124-
125121
# Cerebras
126122
CEREBRAS_API_KEY=
127123

@@ -132,3 +128,7 @@ CHROMADB_PORT=8001
132128
CLICKHOUSE_HOST=http://symfony:symfony@127.0.0.1:8123
133129
CLICKHOUSE_DATABASE=symfony
134130
CLICKHOUSE_TABLE=symfony
131+
132+
# Weaviate (store)
133+
WEAVIATE_HOST=http://127.0.0.1:8080
134+
WEAVIATE_API_KEY=symfony

src/ai-bundle/config/options.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@
352352
->end()
353353
->end()
354354
->end()
355+
->arrayNode('weaviate')
356+
->normalizeKeys(false)
357+
->useAttributeAsKey('name')
358+
->arrayPrototype()
359+
->children()
360+
->scalarNode('endpoint')->cannotBeEmpty()->end()
361+
->scalarNode('api_key')->isRequired()->end()
362+
->scalarNode('collection')->isRequired()->end()
363+
->end()
364+
->end()
365+
->end()
355366
->end()
356367
->end()
357368
->arrayNode('indexer')

src/ai-bundle/src/AiBundle.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
use Symfony\AI\Store\Bridge\Qdrant\Store as QdrantStore;
6060
use Symfony\AI\Store\Bridge\SurrealDb\Store as SurrealDbStore;
6161
use Symfony\AI\Store\Bridge\Typesense\Store as TypesenseStore;
62+
use Symfony\AI\Store\Bridge\Weaviate\Store as WeaviateStore;
6263
use Symfony\AI\Store\Document\Vectorizer;
6364
use Symfony\AI\Store\Indexer;
6465
use Symfony\AI\Store\StoreInterface;
@@ -918,6 +919,24 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
918919
$container->setDefinition('ai.store.'.$type.'.'.$name, $definition);
919920
}
920921
}
922+
923+
if ('weaviate' === $type) {
924+
foreach ($stores as $name => $store) {
925+
$arguments = [
926+
new Reference('http_client'),
927+
$store['endpoint'],
928+
$store['api_key'],
929+
$store['collection'],
930+
];
931+
932+
$definition = new Definition(WeaviateStore::class);
933+
$definition
934+
->addTag('ai.store')
935+
->setArguments($arguments);
936+
937+
$container->setDefinition('ai.store.'.$type.'.'.$name, $definition);
938+
}
939+
}
921940
}
922941

923942
/**

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,13 @@ private function getFullConfig(): array
489489
'dimensions' => 768,
490490
],
491491
],
492+
'weaviate' => [
493+
'my_weaviate_store' => [
494+
'endpoint' => 'http://localhost:8080',
495+
'api_key' => 'bar',
496+
'collection' => 'my_weaviate_collection',
497+
],
498+
],
492499
],
493500
'indexer' => [
494501
'my_text_indexer' => [

0 commit comments

Comments
 (0)