diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-16 18:22:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-16 18:22:26 +0100 |
commit | fb2061da48525edab9cd993205bb5e30c386aa1a (patch) | |
tree | 1e740bd6955dfd27b9a4d773df07234ed9e5c75e /g4f/providers/base_provider.py | |
parent | Merge pull request #1694 from ComRSMaster/main (diff) | |
parent | Add conversation support for Bing (diff) | |
download | gpt4free-0.2.5.0.tar gpt4free-0.2.5.0.tar.gz gpt4free-0.2.5.0.tar.bz2 gpt4free-0.2.5.0.tar.lz gpt4free-0.2.5.0.tar.xz gpt4free-0.2.5.0.tar.zst gpt4free-0.2.5.0.zip |
Diffstat (limited to 'g4f/providers/base_provider.py')
-rw-r--r-- | g4f/providers/base_provider.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/g4f/providers/base_provider.py b/g4f/providers/base_provider.py index 32a0c01b..c8397193 100644 --- a/g4f/providers/base_provider.py +++ b/g4f/providers/base_provider.py @@ -70,7 +70,14 @@ class AbstractProvider(BaseProvider): loop.run_in_executor(executor, create_func), timeout=kwargs.get("timeout") ) - + + def get_parameters(cls) -> dict: + return signature( + cls.create_async_generator if issubclass(cls, AsyncGeneratorProvider) else + cls.create_async if issubclass(cls, AsyncProvider) else + cls.create_completion + ).parameters + @classmethod @property def params(cls) -> str: @@ -83,17 +90,12 @@ class AbstractProvider(BaseProvider): Returns: str: A string listing the supported parameters. """ - sig = signature( - cls.create_async_generator if issubclass(cls, AsyncGeneratorProvider) else - cls.create_async if issubclass(cls, AsyncProvider) else - cls.create_completion - ) def get_type_name(annotation: type) -> str: return annotation.__name__ if hasattr(annotation, "__name__") else str(annotation) args = "" - for name, param in sig.parameters.items(): + for name, param in cls.get_parameters(): if name in ("self", "kwargs") or (name == "stream" and not cls.supports_stream): continue args += f"\n {name}" |