From 8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 15 Mar 2024 11:46:06 +0100 Subject: Add Pyinstaller support, Use curl_cffi in You provider --- g4f/providers/base_provider.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'g4f/providers') 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}" -- cgit v1.2.3