summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-23 12:18:32 +0100
committerGitHub <noreply@github.com>2024-01-23 12:18:32 +0100
commit984c3e1f891b1242954413d7abf81d0a45aa1110 (patch)
tree1f1bee0d403b70866b2bf5f71cfc5a0fb2fe4efd /g4f
parentAdded CodeLlama and misc models from DeepInfra (#1506) (diff)
parentFix: Model sometimes not converted #1507 (diff)
downloadgpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.tar
gpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.tar.gz
gpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.tar.bz2
gpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.tar.lz
gpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.tar.xz
gpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.tar.zst
gpt4free-984c3e1f891b1242954413d7abf81d0a45aa1110.zip
Diffstat (limited to '')
-rw-r--r--g4f/__init__.py9
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: