File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed
tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 271
271
return $ model ;
272
272
}
273
273
274
+ array_walk_recursive ($ options , static function (mixed &$ value ): void {
275
+ if (\is_bool ($ value )) {
276
+ $ value = $ value ? 'true ' : 'false ' ;
277
+ }
278
+ });
279
+
274
280
return $ model .'? ' .http_build_query ($ options );
275
281
})
276
282
->end ()
698
704
return $ model ;
699
705
}
700
706
707
+ array_walk_recursive ($ options , static function (mixed &$ value ): void {
708
+ if (\is_bool ($ value )) {
709
+ $ value = $ value ? 'true ' : 'false ' ;
710
+ }
711
+ });
712
+
701
713
return $ model .'? ' .http_build_query ($ options );
702
714
})
703
715
->end ()
Original file line number Diff line number Diff line change @@ -2583,6 +2583,58 @@ public function testVectorizerConfigurationWithColonNotation(string $model)
2583
2583
$ this ->assertSame ($ model , $ definition ->getArgument (1 ));
2584
2584
}
2585
2585
2586
+ public function testAgentModelBooleanOptionsArePreserved ()
2587
+ {
2588
+ $ container = $ this ->buildContainer ([
2589
+ 'ai ' => [
2590
+ 'agent ' => [
2591
+ 'test ' => [
2592
+ 'model ' => [
2593
+ 'name ' => 'qwen3 ' ,
2594
+ 'options ' => [
2595
+ 'stream ' => false ,
2596
+ 'think ' => true ,
2597
+ 'nested ' => [
2598
+ 'bool ' => false ,
2599
+ ],
2600
+ ],
2601
+ ],
2602
+ ],
2603
+ ],
2604
+ ],
2605
+ ]);
2606
+
2607
+ $ agentDefinition = $ container ->getDefinition ('ai.agent.test ' );
2608
+
2609
+ $ this ->assertSame ('qwen3?stream=false&think=true&nested%5Bbool%5D=false ' , $ agentDefinition ->getArgument (1 ));
2610
+ }
2611
+
2612
+ public function testVectorizerModelBooleanOptionsArePreserved ()
2613
+ {
2614
+ $ container = $ this ->buildContainer ([
2615
+ 'ai ' => [
2616
+ 'vectorizer ' => [
2617
+ 'test ' => [
2618
+ 'model ' => [
2619
+ 'name ' => 'text-embedding-3-small ' ,
2620
+ 'options ' => [
2621
+ 'normalize ' => false ,
2622
+ 'cache ' => true ,
2623
+ 'nested ' => [
2624
+ 'bool ' => false ,
2625
+ ],
2626
+ ],
2627
+ ],
2628
+ ],
2629
+ ],
2630
+ ],
2631
+ ]);
2632
+
2633
+ $ vectorizerDefinition = $ container ->getDefinition ('ai.vectorizer.test ' );
2634
+
2635
+ $ this ->assertSame ('text-embedding-3-small?normalize=false&cache=true&nested%5Bbool%5D=false ' , $ vectorizerDefinition ->getArgument (1 ));
2636
+ }
2637
+
2586
2638
private function buildContainer (array $ configuration ): ContainerBuilder
2587
2639
{
2588
2640
$ container = new ContainerBuilder ();
You can’t perform that action at this time.
0 commit comments