summaryrefslogtreecommitdiffstats
path: root/g4f/__init__.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-08 22:02:52 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-08 22:02:52 +0100
commitc1b992c3460cb0069127524a9b987a8af475ec14 (patch)
tree5a8797a0a4e887837a374e0097a62ecf8a9c91a5 /g4f/__init__.py
parentFix key error in set_cookies (diff)
downloadgpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.tar
gpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.tar.gz
gpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.tar.bz2
gpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.tar.lz
gpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.tar.xz
gpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.tar.zst
gpt4free-c1b992c3460cb0069127524a9b987a8af475ec14.zip
Diffstat (limited to 'g4f/__init__.py')
-rw-r--r--g4f/__init__.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/g4f/__init__.py b/g4f/__init__.py
index 173a1688..d76d70b5 100644
--- a/g4f/__init__.py
+++ b/g4f/__init__.py
@@ -91,7 +91,7 @@ class ChatCompletion:
auth : Union[str, None] = None,
ignored : list[str] = None,
ignore_working: bool = False,
- ignore_stream_and_auth: bool = False,
+ ignore_stream: bool = False,
patch_provider: callable = None,
**kwargs) -> Union[CreateResult, str]:
"""
@@ -105,7 +105,7 @@ class ChatCompletion:
auth (Union[str, None], optional): Authentication token or credentials, if required.
ignored (list[str], optional): List of provider names to be ignored.
ignore_working (bool, optional): If True, ignores the working status of the provider.
- ignore_stream_and_auth (bool, optional): If True, ignores the stream and authentication requirement checks.
+ ignore_stream (bool, optional): If True, ignores the stream and authentication requirement checks.
patch_provider (callable, optional): Function to modify the provider.
**kwargs: Additional keyword arguments.
@@ -118,10 +118,11 @@ class ChatCompletion:
ProviderNotWorkingError: If the provider is not operational.
StreamNotSupportedError: If streaming is requested but not supported by the provider.
"""
- model, provider = get_model_and_provider(model, provider, stream, ignored, ignore_working, ignore_stream_and_auth)
-
- if not ignore_stream_and_auth and provider.needs_auth and not auth:
- raise AuthenticationRequiredError(f'{provider.__name__} requires authentication (use auth=\'cookie or token or jwt ...\' param)')
+ model, provider = get_model_and_provider(
+ model, provider, stream,
+ ignored, ignore_working,
+ ignore_stream or kwargs.get("ignore_stream_and_auth")
+ )
if auth:
kwargs['auth'] = auth