summaryrefslogtreecommitdiffstats
path: root/g4f/__init__.py
diff options
context:
space:
mode:
authorabc <98614666+xtekky@users.noreply.github.com>2023-10-21 01:52:19 +0200
committerabc <98614666+xtekky@users.noreply.github.com>2023-10-21 01:52:19 +0200
commitae8dae82cffb07eeeecc5b07ffc9b502e92bfe62 (patch)
tree6b24ca9b43ad4ace9347dbce2a66c000b9e12e28 /g4f/__init__.py
parent~ | g4f v-0.1.7.0 (diff)
downloadgpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.tar
gpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.tar.gz
gpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.tar.bz2
gpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.tar.lz
gpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.tar.xz
gpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.tar.zst
gpt4free-ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62.zip
Diffstat (limited to '')
-rw-r--r--g4f/__init__.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/g4f/__init__.py b/g4f/__init__.py
index 50fdbb52..8ac369b3 100644
--- a/g4f/__init__.py
+++ b/g4f/__init__.py
@@ -5,7 +5,7 @@ from .Provider import BaseProvider, RetryProvider
from .typing import Messages, CreateResult, Union, List
from .debug import logging
-version = '0.1.7.1'
+version = '0.1.7.2'
version_check = True
def check_pypi_version() -> None:
@@ -22,7 +22,8 @@ def check_pypi_version() -> None:
def get_model_and_provider(model : Union[Model, str],
provider : Union[type[BaseProvider], None],
stream : bool,
- ignored : List[str] = None) -> tuple[Model, type[BaseProvider]]:
+ ignored : List[str] = None,
+ ignore_working: bool = False) -> tuple[Model, type[BaseProvider]]:
if isinstance(model, str):
if model in ModelUtils.convert:
@@ -39,7 +40,7 @@ def get_model_and_provider(model : Union[Model, str],
if not provider:
raise RuntimeError(f'No provider found for model: {model}')
- if not provider.working:
+ if not provider.working and not ignore_working:
raise RuntimeError(f'{provider.__name__} is not working')
if not provider.supports_stream and stream:
@@ -59,9 +60,10 @@ class ChatCompletion:
provider : Union[type[BaseProvider], None] = None,
stream : bool = False,
auth : Union[str, None] = None,
- ignored : List[str] = None, **kwargs) -> Union[CreateResult, str]:
+ ignored : List[str] = None,
+ ignore_working: bool = False, **kwargs) -> Union[CreateResult, str]:
- model, provider = get_model_and_provider(model, provider, stream, ignored)
+ model, provider = get_model_and_provider(model, provider, stream, ignored, ignore_working)
if provider.needs_auth and not auth:
raise ValueError(