From 683108d3a51c0acc18540131540dfcff03ef8ef6 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 20:10:38 +0700 Subject: [PATCH 01/10] Removed model_turbo --- pr_agent/algo/utils.py | 1 - pr_agent/settings/configuration.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index c8a793350..fbdf2bb8a 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -35,7 +35,6 @@ class Range(BaseModel): class ModelType(str, Enum): REGULAR = "regular" - TURBO = "turbo" class PRReviewHeader(str, Enum): diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 32c6d71ce..286c91193 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -1,7 +1,6 @@ [config] # models model="gpt-4-turbo-2024-04-09" -model_turbo="gpt-4o-2024-11-20" fallback_models=["gpt-4o-2024-08-06"] # CLI git_provider="github" From a4d9a65fc694c6b198d4693a700b969b8a2f1377 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 20:23:36 +0700 Subject: [PATCH 02/10] Add model_week --- pr_agent/algo/utils.py | 2 +- pr_agent/settings/configuration.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pr_agent/algo/utils.py b/pr_agent/algo/utils.py index fbdf2bb8a..371a5df90 100644 --- a/pr_agent/algo/utils.py +++ b/pr_agent/algo/utils.py @@ -35,7 +35,7 @@ class Range(BaseModel): class ModelType(str, Enum): REGULAR = "regular" - + WEAK = "weak" class PRReviewHeader(str, Enum): REGULAR = "## PR Reviewer Guide" diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index 286c91193..da5dfbdfe 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -1,6 +1,7 @@ [config] # models -model="gpt-4-turbo-2024-04-09" +model_week="gpt-4o-mini-2024-07-18" +model="gpt-4o-2024-11-20" fallback_models=["gpt-4o-2024-08-06"] # CLI git_provider="github" From dec2859fc43ff3890b27a8dc878b647b012f140c Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 21:10:26 +0700 Subject: [PATCH 03/10] Set default model to weak model --- pr_agent/algo/pr_processing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index 114e24a09..447a1322e 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -333,7 +333,7 @@ def generate_full_patch(convert_hunks_to_line_numbers, file_dict, max_tokens_mod return total_tokens, patches, remaining_files_list_new, files_in_patch_list -async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelType.REGULAR): +async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelType.WEAK): all_models = _get_all_models(model_type) all_deployments = _get_all_deployments(all_models) # try each (model, deployment_id) pair until one is successful, otherwise raise exception @@ -353,9 +353,9 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT raise Exception(f"Failed to generate prediction with any model of {all_models}") -def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]: - if model_type == ModelType.TURBO: - model = get_settings().config.model_turbo +def _get_all_models(model_type: ModelType = ModelType.WEAK) -> List[str]: + if model_type == ModelType.WEAK: + model = get_settings().config.model_week else: model = get_settings().config.model fallback_models = get_settings().config.fallback_models From 936894e4d1f0e83fabbad77cc35df2cf6f5be944 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 21:51:09 +0700 Subject: [PATCH 04/10] Use regular model for pr review and code suggestion flows --- pr_agent/tools/pr_code_suggestions.py | 4 ++-- pr_agent/tools/pr_reviewer.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pr_agent/tools/pr_code_suggestions.py b/pr_agent/tools/pr_code_suggestions.py index 9f34718a2..5fdd96399 100644 --- a/pr_agent/tools/pr_code_suggestions.py +++ b/pr_agent/tools/pr_code_suggestions.py @@ -111,9 +111,9 @@ async def run(self): self.git_provider.publish_comment("Preparing suggestions...", is_temporary=True) if not self.is_extended: - data = await retry_with_fallback_models(self._prepare_prediction) + data = await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.REGULAR) else: - data = await retry_with_fallback_models(self._prepare_prediction_extended) + data = await retry_with_fallback_models(self._prepare_prediction_extended, model_type=ModelType.REGULAR) if not data: data = {"code_suggestions": []} diff --git a/pr_agent/tools/pr_reviewer.py b/pr_agent/tools/pr_reviewer.py index c49155e43..de41a92ff 100644 --- a/pr_agent/tools/pr_reviewer.py +++ b/pr_agent/tools/pr_reviewer.py @@ -148,7 +148,7 @@ async def run(self) -> None: if get_settings().config.publish_output and not get_settings().config.get('is_auto_command', False): self.git_provider.publish_comment("Preparing review...", is_temporary=True) - await retry_with_fallback_models(self._prepare_prediction) + await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.REGULAR) if not self.prediction: self.git_provider.remove_initial_comment() return None From fc5dda0957a0512b8e56d98e2263d05907466a80 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 21:51:29 +0700 Subject: [PATCH 05/10] Use weak model for the rest flows --- pr_agent/tools/pr_description.py | 2 +- pr_agent/tools/pr_help_message.py | 2 +- pr_agent/tools/pr_line_questions.py | 2 +- pr_agent/tools/pr_questions.py | 2 +- pr_agent/tools/pr_update_changelog.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pr_agent/tools/pr_description.py b/pr_agent/tools/pr_description.py index 0b4e19cd5..357e94703 100644 --- a/pr_agent/tools/pr_description.py +++ b/pr_agent/tools/pr_description.py @@ -99,7 +99,7 @@ async def run(self): # ticket extraction if exists await extract_and_cache_pr_tickets(self.git_provider, self.vars) - await retry_with_fallback_models(self._prepare_prediction, ModelType.TURBO) + await retry_with_fallback_models(self._prepare_prediction, ModelType.WEAK) if self.prediction: self._prepare_data() diff --git a/pr_agent/tools/pr_help_message.py b/pr_agent/tools/pr_help_message.py index 3b0ed5a18..c3ec2c1d7 100644 --- a/pr_agent/tools/pr_help_message.py +++ b/pr_agent/tools/pr_help_message.py @@ -114,7 +114,7 @@ async def run(self): self.vars['snippets'] = docs_prompt.strip() # run the AI model - response = await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.REGULAR) + response = await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.WEAK) response_yaml = load_yaml(response) response_str = response_yaml.get('response') relevant_sections = response_yaml.get('relevant_sections') diff --git a/pr_agent/tools/pr_line_questions.py b/pr_agent/tools/pr_line_questions.py index 50bf41838..4ef5b9a7a 100644 --- a/pr_agent/tools/pr_line_questions.py +++ b/pr_agent/tools/pr_line_questions.py @@ -79,7 +79,7 @@ async def run(self): line_end=line_end, side=side) if self.patch_with_lines: - response = await retry_with_fallback_models(self._get_prediction, model_type=ModelType.TURBO) + response = await retry_with_fallback_models(self._get_prediction, model_type=ModelType.WEAK) get_logger().info('Preparing answer...') if comment_id: diff --git a/pr_agent/tools/pr_questions.py b/pr_agent/tools/pr_questions.py index 8112510ea..1ab496dc8 100644 --- a/pr_agent/tools/pr_questions.py +++ b/pr_agent/tools/pr_questions.py @@ -63,7 +63,7 @@ async def run(self): if img_path: get_logger().debug(f"Image path identified", artifact=img_path) - await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.TURBO) + await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.WEAK) pr_comment = self._prepare_pr_answer() get_logger().debug(f"PR output", artifact=pr_comment) diff --git a/pr_agent/tools/pr_update_changelog.py b/pr_agent/tools/pr_update_changelog.py index 521364309..b18a966cd 100644 --- a/pr_agent/tools/pr_update_changelog.py +++ b/pr_agent/tools/pr_update_changelog.py @@ -73,7 +73,7 @@ async def run(self): if get_settings().config.publish_output: self.git_provider.publish_comment("Preparing changelog updates...", is_temporary=True) - await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.TURBO) + await retry_with_fallback_models(self._prepare_prediction, model_type=ModelType.WEAK) new_file_content, answer = self._prepare_changelog_update() From 3c31048afc2f97156fd36a1a9b065c586f2e6f26 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 22:00:37 +0700 Subject: [PATCH 06/10] Update model in git provider --- pr_agent/git_providers/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/git_providers/utils.py b/pr_agent/git_providers/utils.py index 1f780ae93..9f4974d40 100644 --- a/pr_agent/git_providers/utils.py +++ b/pr_agent/git_providers/utils.py @@ -99,5 +99,5 @@ def set_claude_model(): """ model_claude = "bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0" get_settings().set('config.model', model_claude) - get_settings().set('config.model_turbo', model_claude) + get_settings().set('config.model_week', model_claude) get_settings().set('config.fallback_models', [model_claude]) From 88a93bdcd765d4efb72b50f9ee5048a9da4a208c Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 22:01:00 +0700 Subject: [PATCH 07/10] Update weak model document --- docs/docs/usage-guide/changing_a_model.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/docs/usage-guide/changing_a_model.md b/docs/docs/usage-guide/changing_a_model.md index d5f6ae03f..ec7bef31f 100644 --- a/docs/docs/usage-guide/changing_a_model.md +++ b/docs/docs/usage-guide/changing_a_model.md @@ -5,7 +5,7 @@ To use a different model than the default (GPT-4), you need to edit in the [conf ``` [config] model = "..." -model_turbo = "..." +model_week = "..." fallback_models = ["..."] ``` @@ -28,7 +28,7 @@ and set in your configuration file: ``` [config] model="" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) -model_turbo="" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) +model_week="" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) fallback_models=["..."] # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) ``` @@ -52,7 +52,7 @@ MAX_TOKENS={ [config] # in configuration.toml model = "ollama/llama2" -model_turbo = "ollama/llama2" +model_week = "ollama/llama2" fallback_models=["ollama/llama2"] [ollama] # in .secrets.toml @@ -76,7 +76,7 @@ MAX_TOKENS={ } [config] # in configuration.toml model = "huggingface/meta-llama/Llama-2-7b-chat-hf" -model_turbo = "huggingface/meta-llama/Llama-2-7b-chat-hf" +model_week = "huggingface/meta-llama/Llama-2-7b-chat-hf" fallback_models=["huggingface/meta-llama/Llama-2-7b-chat-hf"] [huggingface] # in .secrets.toml @@ -91,7 +91,7 @@ To use Llama2 model with Replicate, for example, set: ``` [config] # in configuration.toml model = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1" -model_turbo = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1" +model_week = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1" fallback_models=["replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1"] [replicate] # in .secrets.toml key = ... @@ -107,7 +107,7 @@ To use Llama3 model with Groq, for example, set: ``` [config] # in configuration.toml model = "llama3-70b-8192" -model_turbo = "llama3-70b-8192" +model_week = "llama3-70b-8192" fallback_models = ["groq/llama3-70b-8192"] [groq] # in .secrets.toml key = ... # your Groq api key @@ -121,7 +121,7 @@ To use Google's Vertex AI platform and its associated models (chat-bison/codecha ``` [config] # in configuration.toml model = "vertex_ai/codechat-bison" -model_turbo = "vertex_ai/codechat-bison" +model_week = "vertex_ai/codechat-bison" fallback_models="vertex_ai/codechat-bison" [vertexai] # in .secrets.toml @@ -140,7 +140,7 @@ To use [Google AI Studio](https://aistudio.google.com/) models, set the relevant ```toml [config] # in configuration.toml model="google_ai_studio/gemini-1.5-flash" -model_turbo="google_ai_studio/gemini-1.5-flash" +model_week="google_ai_studio/gemini-1.5-flash" fallback_models=["google_ai_studio/gemini-1.5-flash"] [google_ai_studio] # in .secrets.toml @@ -156,7 +156,7 @@ To use Anthropic models, set the relevant models in the configuration section of ``` [config] model="anthropic/claude-3-opus-20240229" -model_turbo="anthropic/claude-3-opus-20240229" +model_week="anthropic/claude-3-opus-20240229" fallback_models=["anthropic/claude-3-opus-20240229"] ``` @@ -173,7 +173,7 @@ To use Amazon Bedrock and its foundational models, add the below configuration: ``` [config] # in configuration.toml model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" -model_turbo="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" +model_week="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" fallback_models=["bedrock/anthropic.claude-v2:1"] ``` @@ -195,7 +195,7 @@ If the relevant model doesn't appear [here](https://github.com/Codium-ai/pr-agen ``` [config] model="custom_model_name" -model_turbo="custom_model_name" +model_week="custom_model_name" fallback_models=["custom_model_name"] ``` (2) Set the maximal tokens for the model: From e3d779c30dafd804d3d1617ab3e60f4776d8e6f1 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Sun, 8 Dec 2024 22:09:48 +0700 Subject: [PATCH 08/10] Fix typo model_weak --- docs/docs/usage-guide/changing_a_model.md | 22 +++++++++++----------- pr_agent/algo/pr_processing.py | 2 +- pr_agent/git_providers/utils.py | 2 +- pr_agent/settings/configuration.toml | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/docs/usage-guide/changing_a_model.md b/docs/docs/usage-guide/changing_a_model.md index ec7bef31f..57e0787eb 100644 --- a/docs/docs/usage-guide/changing_a_model.md +++ b/docs/docs/usage-guide/changing_a_model.md @@ -5,7 +5,7 @@ To use a different model than the default (GPT-4), you need to edit in the [conf ``` [config] model = "..." -model_week = "..." +model_weak = "..." fallback_models = ["..."] ``` @@ -28,7 +28,7 @@ and set in your configuration file: ``` [config] model="" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) -model_week="" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) +model_weak="" # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) fallback_models=["..."] # the OpenAI model you've deployed on Azure (e.g. gpt-3.5-turbo) ``` @@ -52,7 +52,7 @@ MAX_TOKENS={ [config] # in configuration.toml model = "ollama/llama2" -model_week = "ollama/llama2" +model_weak = "ollama/llama2" fallback_models=["ollama/llama2"] [ollama] # in .secrets.toml @@ -76,7 +76,7 @@ MAX_TOKENS={ } [config] # in configuration.toml model = "huggingface/meta-llama/Llama-2-7b-chat-hf" -model_week = "huggingface/meta-llama/Llama-2-7b-chat-hf" +model_weak = "huggingface/meta-llama/Llama-2-7b-chat-hf" fallback_models=["huggingface/meta-llama/Llama-2-7b-chat-hf"] [huggingface] # in .secrets.toml @@ -91,7 +91,7 @@ To use Llama2 model with Replicate, for example, set: ``` [config] # in configuration.toml model = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1" -model_week = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1" +model_weak = "replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1" fallback_models=["replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1"] [replicate] # in .secrets.toml key = ... @@ -107,7 +107,7 @@ To use Llama3 model with Groq, for example, set: ``` [config] # in configuration.toml model = "llama3-70b-8192" -model_week = "llama3-70b-8192" +model_weak = "llama3-70b-8192" fallback_models = ["groq/llama3-70b-8192"] [groq] # in .secrets.toml key = ... # your Groq api key @@ -121,7 +121,7 @@ To use Google's Vertex AI platform and its associated models (chat-bison/codecha ``` [config] # in configuration.toml model = "vertex_ai/codechat-bison" -model_week = "vertex_ai/codechat-bison" +model_weak = "vertex_ai/codechat-bison" fallback_models="vertex_ai/codechat-bison" [vertexai] # in .secrets.toml @@ -140,7 +140,7 @@ To use [Google AI Studio](https://aistudio.google.com/) models, set the relevant ```toml [config] # in configuration.toml model="google_ai_studio/gemini-1.5-flash" -model_week="google_ai_studio/gemini-1.5-flash" +model_weak="google_ai_studio/gemini-1.5-flash" fallback_models=["google_ai_studio/gemini-1.5-flash"] [google_ai_studio] # in .secrets.toml @@ -156,7 +156,7 @@ To use Anthropic models, set the relevant models in the configuration section of ``` [config] model="anthropic/claude-3-opus-20240229" -model_week="anthropic/claude-3-opus-20240229" +model_weak="anthropic/claude-3-opus-20240229" fallback_models=["anthropic/claude-3-opus-20240229"] ``` @@ -173,7 +173,7 @@ To use Amazon Bedrock and its foundational models, add the below configuration: ``` [config] # in configuration.toml model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" -model_week="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" +model_weak="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" fallback_models=["bedrock/anthropic.claude-v2:1"] ``` @@ -195,7 +195,7 @@ If the relevant model doesn't appear [here](https://github.com/Codium-ai/pr-agen ``` [config] model="custom_model_name" -model_week="custom_model_name" +model_weak="custom_model_name" fallback_models=["custom_model_name"] ``` (2) Set the maximal tokens for the model: diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index 447a1322e..d3df09f81 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -355,7 +355,7 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT def _get_all_models(model_type: ModelType = ModelType.WEAK) -> List[str]: if model_type == ModelType.WEAK: - model = get_settings().config.model_week + model = get_settings().config.model_weak else: model = get_settings().config.model fallback_models = get_settings().config.fallback_models diff --git a/pr_agent/git_providers/utils.py b/pr_agent/git_providers/utils.py index 9f4974d40..6038e8610 100644 --- a/pr_agent/git_providers/utils.py +++ b/pr_agent/git_providers/utils.py @@ -99,5 +99,5 @@ def set_claude_model(): """ model_claude = "bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0" get_settings().set('config.model', model_claude) - get_settings().set('config.model_week', model_claude) + get_settings().set('config.model_weak', model_claude) get_settings().set('config.fallback_models', [model_claude]) diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index da5dfbdfe..e4a0ac8ab 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -1,6 +1,6 @@ [config] # models -model_week="gpt-4o-mini-2024-07-18" +model_weak="gpt-4o-mini-2024-07-18" model="gpt-4o-2024-11-20" fallback_models=["gpt-4o-2024-08-06"] # CLI From 6352e6e3bfcccf5a4e75f68a7f9e1714eb56bedd Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Mon, 9 Dec 2024 22:24:44 +0700 Subject: [PATCH 09/10] Change default model to regular model --- pr_agent/algo/pr_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index d3df09f81..bbe363e13 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -353,7 +353,7 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT raise Exception(f"Failed to generate prediction with any model of {all_models}") -def _get_all_models(model_type: ModelType = ModelType.WEAK) -> List[str]: +def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]: if model_type == ModelType.WEAK: model = get_settings().config.model_weak else: From f9a7b18073b68aa46b9c58ecd82b62e5fadc40d8 Mon Sep 17 00:00:00 2001 From: Trung Dinh Date: Mon, 9 Dec 2024 22:36:07 +0700 Subject: [PATCH 10/10] Improve condition to pick up weak model --- pr_agent/algo/pr_processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/algo/pr_processing.py b/pr_agent/algo/pr_processing.py index bbe363e13..b37c3001b 100644 --- a/pr_agent/algo/pr_processing.py +++ b/pr_agent/algo/pr_processing.py @@ -354,7 +354,7 @@ async def retry_with_fallback_models(f: Callable, model_type: ModelType = ModelT def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]: - if model_type == ModelType.WEAK: + if get_settings().config.get('model_weak') and model_type == ModelType.WEAK: model = get_settings().config.model_weak else: model = get_settings().config.model