File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,15 @@ export function getModel(
18
18
model : string ;
19
19
llmModel : LanguageModelV1 ;
20
20
} {
21
- if ( useEconomyModel ) return getEconomyModel ( userAi ) ;
21
+ if ( useEconomyModel ) return selectEconomyModel ( userAi ) ;
22
+ return selectModel ( userAi ) ;
23
+ }
22
24
25
+ function selectModel ( userAi : UserAIFields ) : {
26
+ provider : string ;
27
+ model : string ;
28
+ llmModel : LanguageModelV1 ;
29
+ } {
23
30
const defaultProvider = getDefaultProvider ( ) ;
24
31
const aiApiKey = userAi . aiApiKey ;
25
32
let aiProvider : string ;
@@ -136,19 +143,19 @@ export function getModel(
136
143
* - Bulk processing emails
137
144
* - Any task with large context windows where cost efficiency matters
138
145
*/
139
- function getEconomyModel ( userAi : UserAIFields ) {
146
+ function selectEconomyModel ( userAi : UserAIFields ) {
140
147
if ( env . ECONOMY_LLM_PROVIDER && env . ECONOMY_LLM_MODEL ) {
141
148
const apiKey = getProviderApiKey ( env . ECONOMY_LLM_PROVIDER ) ;
142
- if ( ! apiKey ) return getModel ( userAi ) ;
149
+ if ( ! apiKey ) return selectModel ( userAi ) ;
143
150
144
- return getModel ( {
151
+ return selectModel ( {
145
152
aiProvider : env . ECONOMY_LLM_PROVIDER ,
146
153
aiModel : env . ECONOMY_LLM_MODEL ,
147
154
aiApiKey : apiKey ,
148
155
} ) ;
149
156
}
150
157
151
- return getModel ( userAi ) ;
158
+ return selectModel ( userAi ) ;
152
159
}
153
160
154
161
function getProviderApiKey (
You can’t perform that action at this time.
0 commit comments