@@ -178,24 +178,29 @@ export class OpenAILanguageModelProvider implements ILanguageModelProvider {
178
178
}
179
179
180
180
private _newLLM ( options : { [ name : string ] : any } ) {
181
- const { baseURL, apiKey, project, organization } = options ;
182
- const configService = this . configService ;
183
-
184
- const apiType = configService . get < 'openai' | 'azure' > ( 'openai.apiType' ) ;
181
+ const config = this . configService ;
182
+ const {
183
+ baseURL = config . get ( 'openai.baseURL' ) ,
184
+ apiKey = config . get ( 'openai.apiKey' ) ,
185
+ project = config . get ( 'openai.project' ) ,
186
+ organization = config . get ( 'openai.organization' ) ,
187
+ deployment = organization ,
188
+ apiType = config . get < 'openai' | 'azure' > ( 'openai.apiType' ) ,
189
+ } = options ;
185
190
186
191
if ( apiType === 'azure' ) {
187
192
return new AzureOpenAI ( {
188
- baseURL : baseURL || configService . get ( 'openai.baseURL' ) ,
189
- apiKey : apiKey || configService . get ( 'openai.apiKey' ) ,
190
- deployment : organization || configService . get ( 'openai.organization' ) ,
193
+ baseURL : baseURL ,
194
+ apiKey : apiKey ,
195
+ deployment : deployment ,
191
196
} ) ;
192
197
}
193
198
194
199
return new OpenAI ( {
195
- baseURL : configService . get ( 'openai. baseURL' ) ,
196
- project : project || configService . get ( 'openai.project' ) ,
197
- apiKey : apiKey || configService . get ( 'openai.apiKey' ) ,
198
- organization : organization || configService . get ( 'openai.organization' ) ,
200
+ baseURL : baseURL ,
201
+ project : project ,
202
+ apiKey : apiKey ,
203
+ organization : organization ,
199
204
} ) ;
200
205
}
201
206
0 commit comments