summaryrefslogtreecommitdiffstats
path: root/g4f/__init__.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-27 16:09:21 +0100
committerGitHub <noreply@github.com>2024-01-27 16:09:21 +0100
commit0d83bdeef91001c7c00d69f79fccad5a78b4b94b (patch)
tree362ebeb245cc4e123914635b03f890a314a7a40d /g4f/__init__.py
parentMerge pull request #1512 from KennyPhan123/patch-1 (diff)
parentFix PerplexityLabs Provider, Improve bypass_cloudflare helper (diff)
downloadgpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar
gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.gz
gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.bz2
gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.lz
gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.xz
gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.tar.zst
gpt4free-0d83bdeef91001c7c00d69f79fccad5a78b4b94b.zip
Diffstat (limited to 'g4f/__init__.py')
-rw-r--r--g4f/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/g4f/__init__.py b/g4f/__init__.py
index 996acf6c..173a1688 100644
--- a/g4f/__init__.py
+++ b/g4f/__init__.py
@@ -3,11 +3,13 @@ from __future__ import annotations
import os
from .errors import *
-from .models import Model, ModelUtils, _all_models
+from .models import Model, ModelUtils
from .Provider import AsyncGeneratorProvider, ProviderUtils
from .typing import Messages, CreateResult, AsyncResult, Union
from . import debug, version
from .base_provider import BaseRetryProvider, ProviderType
+from .Provider.helper import get_cookies, set_cookies
+from .Provider.base_provider import ProviderModelMixin
def get_model_and_provider(model : Union[Model, str],
provider : Union[ProviderType, str, None],
@@ -76,6 +78,7 @@ def get_model_and_provider(model : Union[Model, str],
print(f'Using {provider.__name__} provider')
debug.last_provider = provider
+ debug.last_model = model
return model, provider
@@ -227,5 +230,10 @@ def get_last_provider(as_dict: bool = False) -> Union[ProviderType, dict[str, st
if isinstance(last, BaseRetryProvider):
last = last.last_provider
if last and as_dict:
- return {"name": last.__name__, "url": last.url}
+ return {
+ "name": last.__name__,
+ "url": last.url,
+ "model": debug.last_model,
+ "models": last.models if isinstance(last, ProviderModelMixin) else []
+ }
return last \ No newline at end of file