From c617b18d12c2f9d82ce7c73aae46d353b83f625a Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 1 Jan 2024 17:48:57 +0100 Subject: Add support for all models Add AbstractProvider class Add ProviderType type Add get_last_provider function Add version module and VersionUtils Display used provider in gui Fix error response in api --- g4f/Provider/__init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'g4f/Provider/__init__.py') diff --git a/g4f/Provider/__init__.py b/g4f/Provider/__init__.py index 4670d331..2ff8b837 100644 --- a/g4f/Provider/__init__.py +++ b/g4f/Provider/__init__.py @@ -1,11 +1,13 @@ from __future__ import annotations -from .base_provider import BaseProvider, AsyncProvider, AsyncGeneratorProvider -from .retry_provider import RetryProvider -from .deprecated import * -from .needs_auth import * -from .unfinished import * -from .selenium import * +from ..base_provider import BaseProvider, ProviderType +from .retry_provider import RetryProvider +from .base_provider import AsyncProvider, AsyncGeneratorProvider +from .deprecated import * +from .needs_auth import * +from .unfinished import * +from .selenium import * + from .Aura import Aura from .AiAsk import AiAsk from .Aichat import Aichat @@ -59,7 +61,7 @@ __modules__: list = [ getattr(sys.modules[__name__], provider) for provider in dir() if not provider.startswith("__") ] -__providers__: list[type[BaseProvider]] = [ +__providers__: list[ProviderType] = [ provider for provider in __modules__ if isinstance(provider, type) and issubclass(provider, BaseProvider) @@ -67,9 +69,9 @@ __providers__: list[type[BaseProvider]] = [ __all__: list[str] = [ provider.__name__ for provider in __providers__ ] -__map__: dict[str, type[BaseProvider]] = dict([ +__map__: dict[str, ProviderType] = dict([ (provider.__name__, provider) for provider in __providers__ ]) class ProviderUtils: - convert: dict[str, type[BaseProvider]] = __map__ \ No newline at end of file + convert: dict[str, ProviderType] = __map__ \ No newline at end of file -- cgit v1.2.3