@@ -5,6 +5,7 @@ use Symfony\Component\Console\Command\Command;
5
5
use Symfony \Component \Console \Helper \Table ;
6
6
use Symfony \Component \Console \Input \InputArgument ;
7
7
use Symfony \Component \Console \Input \InputInterface ;
8
+ use Symfony \Component \Console \Input \InputOption ;
8
9
use Symfony \Component \Console \Output \OutputInterface ;
9
10
use Symfony \Component \Console \SingleCommandApplication ;
10
11
use Symfony \Component \Console \Style \SymfonyStyle ;
@@ -17,6 +18,7 @@ require_once __DIR__.'/vendor/autoload.php';
17
18
$ app = (new SingleCommandApplication ('LLM Chain Example Runner ' ))
18
19
->setDescription ('Runs all LLM Chain examples in folder examples/ ' )
19
20
->addArgument ('subdirectory ' , InputArgument::OPTIONAL , 'Subdirectory to run examples from, e.g. "anthropic" or "huggingface". ' )
21
+ ->addOption ('filter ' , 'f ' , InputOption::VALUE_REQUIRED , 'Filter examples by name, e.g. "audio" or "toolcall". ' )
20
22
->setCode (function (InputInterface $ input , OutputInterface $ output ) {
21
23
$ io = new SymfonyStyle ($ input , $ output );
22
24
$ io ->title ('LLM Chain Examples ' );
@@ -31,9 +33,14 @@ $app = (new SingleCommandApplication('LLM Chain Example Runner'))
31
33
}
32
34
}
33
35
36
+ $ filter = '*.php ' ;
37
+ if (null !== $ additionalFilter = $ input ->getOption ('filter ' )) {
38
+ $ filter = sprintf ('*%s*.php ' , $ additionalFilter );
39
+ }
40
+
34
41
$ examples = (new Finder ())
35
42
->in ($ directory )
36
- ->name (' *.php ' )
43
+ ->name ($ filter )
37
44
->sortByName ()
38
45
->files ();
39
46
0 commit comments