8
8
use PhpLlm \LlmChain \LanguageModel ;
9
9
use PhpLlm \LlmChain \OpenAI \Model \Embeddings ;
10
10
use PhpLlm \LlmChain \OpenAI \Model \Gpt ;
11
- use PhpLlm \LlmChain \OpenAI \Runtime ;
12
- use PhpLlm \LlmChain \OpenAI \Runtime \Azure as AzureRuntime ;
13
- use PhpLlm \LlmChain \OpenAI \Runtime \OpenAI as OpenAIRuntime ;
11
+ use PhpLlm \LlmChain \OpenAI \Platform ;
12
+ use PhpLlm \LlmChain \OpenAI \Platform \Azure as AzurePlatform ;
13
+ use PhpLlm \LlmChain \OpenAI \Platform \OpenAI as OpenAIPlatform ;
14
14
use PhpLlm \LlmChain \Store \Azure \SearchStore as AzureSearchStore ;
15
15
use PhpLlm \LlmChain \Store \ChromaDb \Store as ChromaDbStore ;
16
16
use PhpLlm \LlmChain \Store \StoreInterface ;
@@ -37,11 +37,11 @@ public function load(array $configs, ContainerBuilder $container): void
37
37
$ configuration = new Configuration ();
38
38
$ config = $ this ->processConfiguration ($ configuration , $ configs );
39
39
40
- foreach ($ config ['runtimes ' ] as $ runtimeName => $ runtime ) {
41
- $ this ->processRuntimeConfig ( $ runtimeName , $ runtime , $ container );
40
+ foreach ($ config ['platforms ' ] as $ platformName => $ platform ) {
41
+ $ this ->processPlatformConfig ( $ platformName , $ platform , $ container );
42
42
}
43
- if (1 === count ($ config ['runtimes ' ]) && isset ($ runtimeName )) {
44
- $ container ->setAlias (Runtime ::class, 'llm_chain.runtime . ' .$ runtimeName );
43
+ if (1 === count ($ config ['platforms ' ]) && isset ($ platformName )) {
44
+ $ container ->setAlias (Platform ::class, 'llm_chain.platform . ' .$ platformName );
45
45
}
46
46
47
47
foreach ($ config ['llms ' ] as $ llmName => $ llm ) {
@@ -81,29 +81,29 @@ public function load(array $configs, ContainerBuilder $container): void
81
81
}
82
82
83
83
/**
84
- * @param array<string, mixed> $runtime
84
+ * @param array<string, mixed> $platform
85
85
*/
86
- private function processRuntimeConfig (string $ name , array $ runtime , ContainerBuilder $ container ): void
86
+ private function processPlatformConfig (string $ name , array $ platform , ContainerBuilder $ container ): void
87
87
{
88
- if ('openai ' === $ runtime ['type ' ]) {
89
- $ definition = new ChildDefinition (OpenAIRuntime ::class);
88
+ if ('openai ' === $ platform ['type ' ]) {
89
+ $ definition = new ChildDefinition (OpenAIPlatform ::class);
90
90
$ definition
91
- ->replaceArgument ('$apiKey ' , $ runtime ['api_key ' ]);
91
+ ->replaceArgument ('$apiKey ' , $ platform ['api_key ' ]);
92
92
93
- $ container ->setDefinition ('llm_chain.runtime . ' .$ name , $ definition );
93
+ $ container ->setDefinition ('llm_chain.platform . ' .$ name , $ definition );
94
94
95
95
return ;
96
96
}
97
97
98
- if ('azure ' === $ runtime ['type ' ]) {
99
- $ definition = new ChildDefinition (AzureRuntime ::class);
98
+ if ('azure ' === $ platform ['type ' ]) {
99
+ $ definition = new ChildDefinition (AzurePlatform ::class);
100
100
$ definition
101
- ->replaceArgument ('$baseUrl ' , $ runtime ['base_url ' ])
102
- ->replaceArgument ('$deployment ' , $ runtime ['deployment ' ])
103
- ->replaceArgument ('$key ' , $ runtime ['api_key ' ])
104
- ->replaceArgument ('$apiVersion ' , $ runtime ['version ' ]);
101
+ ->replaceArgument ('$baseUrl ' , $ platform ['base_url ' ])
102
+ ->replaceArgument ('$deployment ' , $ platform ['deployment ' ])
103
+ ->replaceArgument ('$key ' , $ platform ['api_key ' ])
104
+ ->replaceArgument ('$apiVersion ' , $ platform ['version ' ]);
105
105
106
- $ container ->setDefinition ('llm_chain.runtime . ' .$ name , $ definition );
106
+ $ container ->setDefinition ('llm_chain.platform . ' .$ name , $ definition );
107
107
}
108
108
}
109
109
@@ -112,10 +112,10 @@ private function processRuntimeConfig(string $name, array $runtime, ContainerBui
112
112
*/
113
113
private function processLlmConfig (string $ name , array $ llm , ContainerBuilder $ container ): void
114
114
{
115
- $ runtime = isset ($ llm ['runtime ' ]) ? 'llm_chain.runtime . ' .$ llm ['runtime ' ] : Runtime ::class;
115
+ $ platform = isset ($ llm ['platform ' ]) ? 'llm_chain.platform . ' .$ llm ['platform ' ] : Platform ::class;
116
116
117
117
$ definition = new ChildDefinition (Gpt::class);
118
- $ definition ->replaceArgument ('$runtime ' , new Reference ($ runtime ));
118
+ $ definition ->replaceArgument ('$platform ' , new Reference ($ platform ));
119
119
120
120
$ container ->setDefinition ('llm_chain.llm. ' .$ name , $ definition );
121
121
@@ -134,10 +134,10 @@ private function processLlmConfig(string $name, array $llm, ContainerBuilder $co
134
134
*/
135
135
private function processEmbeddingsConfig (string $ name , array $ embeddings , ContainerBuilder $ container ): void
136
136
{
137
- $ runtime = isset ($ embeddings ['runtime ' ]) ? 'llm_chain.runtime . ' .$ embeddings ['runtime ' ] : Runtime ::class;
137
+ $ platform = isset ($ embeddings ['platform ' ]) ? 'llm_chain.platform . ' .$ embeddings ['platform ' ] : Platform ::class;
138
138
139
139
$ definition = new ChildDefinition (Embeddings::class);
140
- $ definition ->replaceArgument ('$runtime ' , new Reference ($ runtime ));
140
+ $ definition ->replaceArgument ('$platform ' , new Reference ($ platform ));
141
141
142
142
$ container ->setDefinition ('llm_chain.embeddings. ' .$ name , $ definition );
143
143
}
0 commit comments