summaryrefslogtreecommitdiffstats
path: root/g4f/providers
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-11-22 01:50:48 +0100
committerGitHub <noreply@github.com>2024-11-22 01:50:48 +0100
commite8bd24a25bb8737c4f6ef8ba656e74a58e74336a (patch)
treeaa45d15f59adaf85c8f4154f44ccbc17afb0a0bd /g4f/providers
parentImprove slim docker image example, clean up OpenaiChat provider (#2397) (diff)
downloadgpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.tar
gpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.tar.gz
gpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.tar.bz2
gpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.tar.lz
gpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.tar.xz
gpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.tar.zst
gpt4free-e8bd24a25bb8737c4f6ef8ba656e74a58e74336a.zip
Diffstat (limited to '')
-rw-r--r--g4f/providers/base_provider.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/g4f/providers/base_provider.py b/g4f/providers/base_provider.py
index e2c2f46a..80a9e09d 100644
--- a/g4f/providers/base_provider.py
+++ b/g4f/providers/base_provider.py
@@ -66,11 +66,12 @@ class AbstractProvider(BaseProvider):
@classmethod
def get_parameters(cls) -> dict[str, Parameter]:
- return signature(
+ return {name: parameter for name, parameter in signature(
cls.create_async_generator if issubclass(cls, AsyncGeneratorProvider) else
cls.create_async if issubclass(cls, AsyncProvider) else
cls.create_completion
- ).parameters
+ ).parameters.items() if name not in ["kwargs", "model", "messages"]
+ and (name != "stream" or cls.supports_stream)}
@classmethod
@property
@@ -90,8 +91,6 @@ class AbstractProvider(BaseProvider):
args = ""
for name, param in cls.get_parameters().items():
- if name in ("self", "kwargs") or (name == "stream" and not cls.supports_stream):
- continue
args += f"\n {name}"
args += f": {get_type_name(param.annotation)}" if param.annotation is not Parameter.empty else ""
default_value = f'"{param.default}"' if isinstance(param.default, str) else param.default