diff options
author | abc <98614666+xtekky@users.noreply.github.com> | 2023-07-16 21:31:51 +0200 |
---|---|---|
committer | abc <98614666+xtekky@users.noreply.github.com> | 2023-07-16 21:31:51 +0200 |
commit | e9467297369dd4f429c084bd1d034f3b1b63e7c2 (patch) | |
tree | a8ef4184e60e226baf2dab207225ce8f52502c38 /g4f/__init__.py | |
parent | minor fixes (diff) | |
download | gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.tar gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.tar.gz gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.tar.bz2 gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.tar.lz gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.tar.xz gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.tar.zst gpt4free-e9467297369dd4f429c084bd1d034f3b1b63e7c2.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/g4f/__init__.py b/g4f/__init__.py index a0b4bac6..09b24b55 100644 --- a/g4f/__init__.py +++ b/g4f/__init__.py @@ -2,11 +2,14 @@ import sys from . import Provider from g4f.models import Model, ModelUtils +logging = False class ChatCompletion: @staticmethod def create(model: Model.model or str, messages: list, provider: Provider.Provider = None, stream: bool = False, auth: str = False, **kwargs): kwargs['auth'] = auth + if provider and provider.working == False: + return f'{provider.__name__} is not working' if provider and provider.needs_auth and not auth: print( @@ -27,7 +30,7 @@ class ChatCompletion: f"ValueError: {engine.__name__} does not support 'stream' argument", file=sys.stderr) sys.exit(1) - print(f'Using {engine.__name__} provider') + if logging: print(f'Using {engine.__name__} provider') return (engine._create_completion(model.name, messages, stream, **kwargs) if stream else ''.join(engine._create_completion(model.name, messages, stream, **kwargs))) |