88use PhpLlm \LlmChain \LanguageModel ;
99use PhpLlm \LlmChain \OpenAI \Model \Embeddings ;
1010use 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 ;
1414use PhpLlm \LlmChain \Store \Azure \SearchStore as AzureSearchStore ;
1515use PhpLlm \LlmChain \Store \ChromaDb \Store as ChromaDbStore ;
1616use PhpLlm \LlmChain \Store \StoreInterface ;
@@ -37,11 +37,11 @@ public function load(array $configs, ContainerBuilder $container): void
3737 $ configuration = new Configuration ();
3838 $ config = $ this ->processConfiguration ($ configuration , $ configs );
3939
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 );
4242 }
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 );
4545 }
4646
4747 foreach ($ config ['llms ' ] as $ llmName => $ llm ) {
@@ -81,29 +81,29 @@ public function load(array $configs, ContainerBuilder $container): void
8181 }
8282
8383 /**
84- * @param array<string, mixed> $runtime
84+ * @param array<string, mixed> $platform
8585 */
86- private function processRuntimeConfig (string $ name , array $ runtime , ContainerBuilder $ container ): void
86+ private function processPlatformConfig (string $ name , array $ platform , ContainerBuilder $ container ): void
8787 {
88- if ('openai ' === $ runtime ['type ' ]) {
89- $ definition = new ChildDefinition (OpenAIRuntime ::class);
88+ if ('openai ' === $ platform ['type ' ]) {
89+ $ definition = new ChildDefinition (OpenAIPlatform ::class);
9090 $ definition
91- ->replaceArgument ('$apiKey ' , $ runtime ['api_key ' ]);
91+ ->replaceArgument ('$apiKey ' , $ platform ['api_key ' ]);
9292
93- $ container ->setDefinition ('llm_chain.runtime . ' .$ name , $ definition );
93+ $ container ->setDefinition ('llm_chain.platform . ' .$ name , $ definition );
9494
9595 return ;
9696 }
9797
98- if ('azure ' === $ runtime ['type ' ]) {
99- $ definition = new ChildDefinition (AzureRuntime ::class);
98+ if ('azure ' === $ platform ['type ' ]) {
99+ $ definition = new ChildDefinition (AzurePlatform ::class);
100100 $ 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 ' ]);
105105
106- $ container ->setDefinition ('llm_chain.runtime . ' .$ name , $ definition );
106+ $ container ->setDefinition ('llm_chain.platform . ' .$ name , $ definition );
107107 }
108108 }
109109
@@ -112,10 +112,10 @@ private function processRuntimeConfig(string $name, array $runtime, ContainerBui
112112 */
113113 private function processLlmConfig (string $ name , array $ llm , ContainerBuilder $ container ): void
114114 {
115- $ runtime = isset ($ llm ['runtime ' ]) ? 'llm_chain.runtime . ' .$ llm ['runtime ' ] : Runtime ::class;
115+ $ platform = isset ($ llm ['platform ' ]) ? 'llm_chain.platform . ' .$ llm ['platform ' ] : Platform ::class;
116116
117117 $ definition = new ChildDefinition (Gpt::class);
118- $ definition ->replaceArgument ('$runtime ' , new Reference ($ runtime ));
118+ $ definition ->replaceArgument ('$platform ' , new Reference ($ platform ));
119119
120120 $ container ->setDefinition ('llm_chain.llm. ' .$ name , $ definition );
121121
@@ -134,10 +134,10 @@ private function processLlmConfig(string $name, array $llm, ContainerBuilder $co
134134 */
135135 private function processEmbeddingsConfig (string $ name , array $ embeddings , ContainerBuilder $ container ): void
136136 {
137- $ runtime = isset ($ embeddings ['runtime ' ]) ? 'llm_chain.runtime . ' .$ embeddings ['runtime ' ] : Runtime ::class;
137+ $ platform = isset ($ embeddings ['platform ' ]) ? 'llm_chain.platform . ' .$ embeddings ['platform ' ] : Platform ::class;
138138
139139 $ definition = new ChildDefinition (Embeddings::class);
140- $ definition ->replaceArgument ('$runtime ' , new Reference ($ runtime ));
140+ $ definition ->replaceArgument ('$platform ' , new Reference ($ platform ));
141141
142142 $ container ->setDefinition ('llm_chain.embeddings. ' .$ name , $ definition );
143143 }
0 commit comments