diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-11-20 19:58:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 19:58:16 +0100 |
commit | ffb4b0d162cc29b1caa4539d854de37206804225 (patch) | |
tree | ea565c46ed908d2a6b4ef3fef1f100e68428aec3 /g4f/Provider/Airforce.py | |
parent | Update api.py (diff) | |
download | gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.gz gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.bz2 gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.lz gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.xz gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.tar.zst gpt4free-ffb4b0d162cc29b1caa4539d854de37206804225.zip |
Diffstat (limited to 'g4f/Provider/Airforce.py')
-rw-r--r-- | g4f/Provider/Airforce.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/g4f/Provider/Airforce.py b/g4f/Provider/Airforce.py index 54bb543b..f5bcfefa 100644 --- a/g4f/Provider/Airforce.py +++ b/g4f/Provider/Airforce.py @@ -20,7 +20,7 @@ class Airforce(AsyncGeneratorProvider, ProviderModelMixin): working = True supports_system_message = True supports_message_history = True - + @classmethod def fetch_completions_models(cls): response = requests.get('https://api.airforce/models', verify=False) @@ -34,19 +34,20 @@ class Airforce(AsyncGeneratorProvider, ProviderModelMixin): response.raise_for_status() return response.json() - completions_models = fetch_completions_models.__func__(None) - imagine_models = fetch_imagine_models.__func__(None) - default_model = "gpt-4o-mini" default_image_model = "flux" additional_models_imagine = ["stable-diffusion-xl-base", "stable-diffusion-xl-lightning", "Flux-1.1-Pro"] - text_models = completions_models - image_models = [*imagine_models, *additional_models_imagine] - models = [ - *text_models, - *image_models, - ] - + + @classmethod + def get_models(cls): + if not cls.models: + cls.image_models = [*cls.fetch_imagine_models(), *cls.additional_models_imagine] + cls.models = [ + *cls.fetch_completions_models(), + *cls.image_models + ] + return cls.models + model_aliases = { ### completions ### # openchat @@ -100,7 +101,6 @@ class Airforce(AsyncGeneratorProvider, ProviderModelMixin): **kwargs ) -> AsyncResult: model = cls.get_model(model) - if model in cls.image_models: return cls._generate_image(model, messages, proxy, seed, size) else: |