diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-03-15 11:46:06 +0100 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-03-15 11:46:06 +0100 |
commit | 8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0 (patch) | |
tree | ea190c7017d8e8982e63a502da0a828d5ba42f94 /g4f/providers | |
parent | Add export / import conversations (diff) | |
download | gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.tar gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.tar.gz gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.tar.bz2 gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.tar.lz gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.tar.xz gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.tar.zst gpt4free-8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0.zip |
Diffstat (limited to '')
-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}" |