File tree Expand file tree Collapse file tree 9 files changed +17
-8
lines changed Expand file tree Collapse file tree 9 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 29
29
country was very peaceful and prosperous. The people lived happily ever after.
30
30
TEXT );
31
31
32
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
32
+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 13
13
use Psr \Log \LoggerInterface ;
14
14
use Symfony \AI \Platform \Metadata \Metadata ;
15
15
use Symfony \AI \Platform \Metadata \TokenUsage ;
16
+ use Symfony \AI \Platform \Result \ResultPromise ;
16
17
use Symfony \Component \Console \Logger \ConsoleLogger ;
17
18
use Symfony \Component \Console \Output \ConsoleOutput ;
18
19
use Symfony \Component \Dotenv \Dotenv ;
@@ -71,3 +72,11 @@ function print_token_usage(Metadata $metadata): void
71
72
echo 'Remaining tokens: ' .$ tokenUsage ->remainingTokens .\PHP_EOL ;
72
73
echo 'Utilized tokens: ' .$ tokenUsage ->totalTokens .\PHP_EOL ;
73
74
}
75
+
76
+ function print_vectors (ResultPromise $ result ): void
77
+ {
78
+ assert ([] !== $ result ->asVectors ());
79
+ assert (array_key_exists (0 , $ result ->asVectors ()));
80
+
81
+ echo 'Dimensions: ' .$ result ->asVectors ()[0 ]->getDimensions ().\PHP_EOL ;
82
+ }
Original file line number Diff line number Diff line change 23
23
country was very peaceful and prosperous. The people lived happily ever after.
24
24
TEXT );
25
25
26
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26
+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 22
22
'task ' => Task::FEATURE_EXTRACTION ,
23
23
]);
24
24
25
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
25
+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 28
28
29
29
echo 'Waiting for the responses ... ' .\PHP_EOL ;
30
30
foreach ($ results as $ result ) {
31
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
31
+ print_vectors ( $ result) ;
32
32
}
Original file line number Diff line number Diff line change 24
24
salt. The goal was to prevent deficiencies and promote better health in the population.
25
25
TEXT );
26
26
27
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
27
+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 23
23
country was very peaceful and prosperous. The people lived happily ever after.
24
24
TEXT );
25
25
26
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26
+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 23
23
country was very peaceful and prosperous. The people lived happily ever after.
24
24
TEXT );
25
25
26
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26
+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 23
23
country was very peaceful and prosperous. The people lived happily ever after.
24
24
TEXT );
25
25
26
- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26
+ print_vectors ( $ result) ;
You can’t perform that action at this time.
0 commit comments