diff options
Diffstat (limited to 'g4f/providers')
-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}" |