2222class TextChatCompletionsModel (str , Enum ):
2323 GPT_4 = "gpt-4"
2424 GPT_4_O = "gpt-4o"
25+ GPT_4_O_MINI = "gpt-4o-mini"
2526 GPT_4_LATEST = "gpt-4-turbo-latest"
2627 GPT_3_5 = "gpt-3.5-turbo"
2728 GPT_3_5_LATEST = "gpt-3.5-turbo-latest"
@@ -35,7 +36,7 @@ def __str__(self):
3536
3637class TextChatConfiguration (ApiProcessorSchema ):
3738 model : TextChatCompletionsModel = Field (
38- default = TextChatCompletionsModel .GPT_3_5 ,
39+ default = TextChatCompletionsModel .GPT_4_O_MINI ,
3940 description = "ID of the model to use. Currently, only `gpt-3.5-turbo` and `gpt-4` are supported." ,
4041 json_schema_extra = {"widget" : "customselect" },
4142 )
@@ -88,11 +89,6 @@ class TextChatConfiguration(ApiProcessorSchema):
8889 default = True ,
8990 description = "Use Azure if available. Will fallback to OpenAI when unchecked" ,
9091 )
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- )
9692 chat_history_in_doc_search : int = Field (
9793 title = "Chat history in doc search" ,
9894 default = 0 ,
@@ -289,19 +285,26 @@ def process(self) -> dict:
289285 elif model == "gpt-4-turbo-latest" :
290286 model = "gpt-4-0125-preview"
291287
288+ # Check if azure is available
289+ provider_config = None
292290 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 :
293301 if model == "gpt-3.5-turbo" :
294302 model = "gpt-35-turbo"
295303 elif model == "gpt-3.5-turbo-16k" :
296304 model = "gpt-35-turbo-16k"
297305 elif model == "gpt-3.5-turbo-latest" :
298306 model = "gpt-35-turbo-1106"
299307
300- provider_config = self .get_provider_config (
301- provider_slug = "azure" ,
302- processor_slug = "*" ,
303- model_slug = model ,
304- )
305308 openai_client = AzureOpenAI (
306309 api_key = provider_config .api_key ,
307310 api_version = provider_config .api_version ,
0 commit comments