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 2929 country was very peaceful and prosperous. The people lived happily ever after.
3030 TEXT );
3131
32- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
32+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 1313use Psr \Log \LoggerInterface ;
1414use Symfony \AI \Platform \Metadata \Metadata ;
1515use Symfony \AI \Platform \Metadata \TokenUsage ;
16+ use Symfony \AI \Platform \Result \ResultPromise ;
1617use Symfony \Component \Console \Logger \ConsoleLogger ;
1718use Symfony \Component \Console \Output \ConsoleOutput ;
1819use Symfony \Component \Dotenv \Dotenv ;
@@ -71,3 +72,11 @@ function print_token_usage(Metadata $metadata): void
7172 echo 'Remaining tokens: ' .$ tokenUsage ->remainingTokens .\PHP_EOL ;
7273 echo 'Utilized tokens: ' .$ tokenUsage ->totalTokens .\PHP_EOL ;
7374}
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 2323 country was very peaceful and prosperous. The people lived happily ever after.
2424 TEXT );
2525
26- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 2222 'task ' => Task::FEATURE_EXTRACTION ,
2323]);
2424
25- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
25+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 2828
2929echo 'Waiting for the responses ... ' .\PHP_EOL ;
3030foreach ($ results as $ result ) {
31- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
31+ print_vectors ( $ result) ;
3232}
Original file line number Diff line number Diff line change 2424 salt. The goal was to prevent deficiencies and promote better health in the population.
2525 TEXT );
2626
27- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
27+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 2323 country was very peaceful and prosperous. The people lived happily ever after.
2424 TEXT );
2525
26- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 2323 country was very peaceful and prosperous. The people lived happily ever after.
2424 TEXT );
2525
26- echo ' Dimensions: ' . $ result-> asVectors ()[ 0 ]-> getDimensions ().\ PHP_EOL ;
26+ print_vectors ( $ result) ;
Original file line number Diff line number Diff line change 2323 country was very peaceful and prosperous. The people lived happily ever after.
2424 TEXT );
2525
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