From fd5c33efb8ade99df4b360938ffc7c7b08d1582f Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sat, 23 Sep 2023 17:10:25 +0200 Subject: TypeError: issubclass() arg 1 must be a class --- g4f/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'g4f') diff --git a/g4f/__init__.py b/g4f/__init__.py index c0f70d8a..d6388fb5 100644 --- a/g4f/__init__.py +++ b/g4f/__init__.py @@ -64,7 +64,8 @@ class ChatCompletion: model, provider = get_model_and_provider(model, provider, False) - if not issubclass(provider, AsyncProvider) and not issubclass(type(provider), AsyncProvider): + provider_type = provider if isinstance(provider, type) else type(provider) + if not issubclass(provider_type, AsyncProvider): raise Exception(f"Provider: {provider.__name__} doesn't support create_async") return await provider.create_async(model.name, messages, **kwargs) -- cgit v1.2.3