22
22
class TextChatCompletionsModel (str , Enum ):
23
23
GPT_4 = "gpt-4"
24
24
GPT_4_O = "gpt-4o"
25
+ GPT_4_O_MINI = "gpt-4o-mini"
25
26
GPT_4_LATEST = "gpt-4-turbo-latest"
26
27
GPT_3_5 = "gpt-3.5-turbo"
27
28
GPT_3_5_LATEST = "gpt-3.5-turbo-latest"
@@ -35,7 +36,7 @@ def __str__(self):
35
36
36
37
class TextChatConfiguration (ApiProcessorSchema ):
37
38
model : TextChatCompletionsModel = Field (
38
- default = TextChatCompletionsModel .GPT_3_5 ,
39
+ default = TextChatCompletionsModel .GPT_4_O_MINI ,
39
40
description = "ID of the model to use. Currently, only `gpt-3.5-turbo` and `gpt-4` are supported." ,
40
41
json_schema_extra = {"widget" : "customselect" },
41
42
)
@@ -88,11 +89,6 @@ class TextChatConfiguration(ApiProcessorSchema):
88
89
default = True ,
89
90
description = "Use Azure if available. Will fallback to OpenAI when unchecked" ,
90
91
)
91
- use_localai_if_available : bool = Field (
92
- title = "Use LocalAI if available" ,
93
- default = False ,
94
- description = "Use LocalAI if available. Will fallback to OpenAI or Azure OpenAI when unchecked" ,
95
- )
96
92
chat_history_in_doc_search : int = Field (
97
93
title = "Chat history in doc search" ,
98
94
default = 0 ,
@@ -289,19 +285,26 @@ def process(self) -> dict:
289
285
elif model == "gpt-4-turbo-latest" :
290
286
model = "gpt-4-0125-preview"
291
287
288
+ # Check if azure is available
289
+ provider_config = None
292
290
if self ._config .use_azure_if_available :
291
+ try :
292
+ provider_config = self .get_provider_config (
293
+ provider_slug = "azure" ,
294
+ processor_slug = "*" ,
295
+ model_slug = model ,
296
+ )
297
+ except Exception :
298
+ pass
299
+
300
+ if self ._config .use_azure_if_available and provider_config :
293
301
if model == "gpt-3.5-turbo" :
294
302
model = "gpt-35-turbo"
295
303
elif model == "gpt-3.5-turbo-16k" :
296
304
model = "gpt-35-turbo-16k"
297
305
elif model == "gpt-3.5-turbo-latest" :
298
306
model = "gpt-35-turbo-1106"
299
307
300
- provider_config = self .get_provider_config (
301
- provider_slug = "azure" ,
302
- processor_slug = "*" ,
303
- model_slug = model ,
304
- )
305
308
openai_client = AzureOpenAI (
306
309
api_key = provider_config .api_key ,
307
310
api_version = provider_config .api_version ,
0 commit comments