diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-01-23 12:17:16 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-01-23 12:17:16 +0100 |
commit | e4f743881c915ba250b859d01ef78c7b90a96bf5 (patch) | |
tree | 22e1897967212a209751880cd6f9e3bac82bb9d9 /g4f/__init__.py | |
parent | Check for comments in copilot (diff) | |
download | gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.tar gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.tar.gz gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.tar.bz2 gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.tar.lz gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.tar.xz gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.tar.zst gpt4free-e4f743881c915ba250b859d01ef78c7b90a96bf5.zip |
Diffstat (limited to 'g4f/__init__.py')
-rw-r--r-- | g4f/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/g4f/__init__.py b/g4f/__init__.py index 2b0e5b46..996acf6c 100644 --- a/g4f/__init__.py +++ b/g4f/__init__.py @@ -45,12 +45,13 @@ def get_model_and_provider(model : Union[Model, str], else: raise ProviderNotFoundError(f'Provider not found: {provider}') + if isinstance(model, str): + if model in ModelUtils.convert: + model = ModelUtils.convert[model] + if not provider: if isinstance(model, str): - if model in ModelUtils.convert: - model = ModelUtils.convert[model] - else: - raise ModelNotFoundError(f'Model not found: {model}') + raise ModelNotFoundError(f'Model not found: {model}') provider = model.best_provider if not provider: |