summaryrefslogtreecommitdiffstats
path: root/g4f/__init__.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-26 12:49:52 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-26 12:49:52 +0100
commit1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b (patch)
tree845e5d27d9f94c16215da60aaee0ad36f5a35344 /g4f/__init__.py
parentNew minimum requirements (#1515) (diff)
downloadgpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.gz
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.bz2
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.lz
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.xz
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.tar.zst
gpt4free-1eb7dc05e59433de149ec16d9b2fe19b3fa4b24b.zip
Diffstat (limited to '')
-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