26
26
/**
27
27
* @var InputProcessor[]
28
28
*/
29
- private array $ inputProcessor ;
29
+ private array $ inputProcessors ;
30
30
31
31
/**
32
32
* @var OutputProcessor[]
33
33
*/
34
- private array $ outputProcessor ;
34
+ private array $ outputProcessors ;
35
35
36
36
/**
37
- * @param InputProcessor[] $inputProcessor
38
- * @param OutputProcessor[] $outputProcessor
37
+ * @param InputProcessor[] $inputProcessors
38
+ * @param OutputProcessor[] $outputProcessors
39
39
*/
40
40
public function __construct (
41
41
private PlatformInterface $ platform ,
42
42
private LanguageModel $ llm ,
43
- iterable $ inputProcessor = [],
44
- iterable $ outputProcessor = [],
43
+ iterable $ inputProcessors = [],
44
+ iterable $ outputProcessors = [],
45
45
private LoggerInterface $ logger = new NullLogger (),
46
46
) {
47
- $ this ->inputProcessor = $ this ->initializeProcessors ($ inputProcessor , InputProcessor::class);
48
- $ this ->outputProcessor = $ this ->initializeProcessors ($ outputProcessor , OutputProcessor::class);
47
+ $ this ->inputProcessors = $ this ->initializeProcessors ($ inputProcessors , InputProcessor::class);
48
+ $ this ->outputProcessors = $ this ->initializeProcessors ($ outputProcessors , OutputProcessor::class);
49
49
}
50
50
51
51
/**
@@ -54,7 +54,7 @@ public function __construct(
54
54
public function call (MessageBagInterface $ messages , array $ options = []): ResponseInterface
55
55
{
56
56
$ input = new Input ($ this ->llm , $ messages , $ options );
57
- array_map (fn (InputProcessor $ processor ) => $ processor ->processInput ($ input ), $ this ->inputProcessor );
57
+ array_map (fn (InputProcessor $ processor ) => $ processor ->processInput ($ input ), $ this ->inputProcessors );
58
58
59
59
$ llm = $ input ->llm ;
60
60
$ messages = $ input ->messages ;
@@ -82,13 +82,14 @@ public function call(MessageBagInterface $messages, array $options = []): Respon
82
82
}
83
83
84
84
$ output = new Output ($ llm , $ response , $ messages , $ options );
85
- array_map (fn (OutputProcessor $ processor ) => $ processor ->processOutput ($ output ), $ this ->outputProcessor );
85
+ array_map (fn (OutputProcessor $ processor ) => $ processor ->processOutput ($ output ), $ this ->outputProcessors );
86
86
87
87
return $ output ->response ;
88
88
}
89
89
90
90
/**
91
91
* @param InputProcessor[]|OutputProcessor[] $processors
92
+ * @param class-string $interface
92
93
*
93
94
* @return InputProcessor[]|OutputProcessor[]
94
95
*/
0 commit comments