diff options
author | kqlio67 <kqlio67@users.noreply.github.com> | 2024-10-30 15:25:55 +0100 |
---|---|---|
committer | kqlio67 <kqlio67@users.noreply.github.com> | 2024-10-30 15:25:55 +0100 |
commit | e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac (patch) | |
tree | 5a06635657ff1f8d2ab2156898ff0bb1fff025f4 /g4f/models.py | |
parent | feat(g4f/models.py): add versioning support for model retrieval (diff) | |
download | gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.tar gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.tar.gz gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.tar.bz2 gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.tar.lz gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.tar.xz gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.tar.zst gpt4free-e6627d8d30fe7dfcf2a111b444f2abb5c4ead1ac.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/models.py | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/g4f/models.py b/g4f/models.py index 2378079b..bea09f28 100644 --- a/g4f/models.py +++ b/g4f/models.py @@ -891,17 +891,6 @@ any_dark = Model( ) - -class ModelVersions: - # Global Prefixes for All Models - GLOBAL_PREFIXES = [":latest"] - - # Specific Prefixes for Particular Models - MODEL_SPECIFIC_PREFIXES = { - #frozenset(["gpt-3.5-turbo", "gpt-4"]): [":custom1", ":custom2"] - #frozenset(["gpt-3.5-turbo"]): [":custom"], - } - class ModelUtils: """ Utility class for mapping string identifiers to Model instances. @@ -1174,35 +1163,4 @@ class ModelUtils: 'any-dark': any_dark, } - @classmethod - def get_model(cls, model_name: str) -> Model: - # Checking for specific prefixes - for model_set, specific_prefixes in ModelVersions.MODEL_SPECIFIC_PREFIXES.items(): - for prefix in specific_prefixes: - if model_name.endswith(prefix): - base_name = model_name[:-len(prefix)] - if base_name in model_set: - return cls.convert.get(base_name, None) - - # Check for global prefixes - for prefix in ModelVersions.GLOBAL_PREFIXES: - if model_name.endswith(prefix): - base_name = model_name[:-len(prefix)] - return cls.convert.get(base_name, None) - - # Check without prefix - if model_name in cls.convert: - return cls.convert[model_name] - - raise KeyError(f"Model {model_name} not found") - - @classmethod - def get_available_versions(cls, model_name: str) -> list[str]: - # Obtaining prefixes for a specific model - prefixes = ModelVersions.GLOBAL_PREFIXES.copy() - for model_set, specific_prefixes in ModelVersions.MODEL_SPECIFIC_PREFIXES.items(): - if model_name in model_set: - prefixes.extend(specific_prefixes) - return prefixes - _all_models = list(ModelUtils.convert.keys()) |