From 5756586cde6ed6da147119113fb5a5fd640d5f83 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 14 Jan 2024 07:45:41 +0100 Subject: Refactor code with AI Add doctypes to many functions Add file upload for text files Add alternative url to FreeChatgpt Add webp to allowed image types --- g4f/models.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'g4f/models.py') diff --git a/g4f/models.py b/g4f/models.py index 03deebf8..dd6e0a2c 100644 --- a/g4f/models.py +++ b/g4f/models.py @@ -31,12 +31,21 @@ from .Provider import ( @dataclass(unsafe_hash=True) class Model: + """ + Represents a machine learning model configuration. + + Attributes: + name (str): Name of the model. + base_provider (str): Default provider for the model. + best_provider (ProviderType): The preferred provider for the model, typically with retry logic. + """ name: str base_provider: str best_provider: ProviderType = None @staticmethod def __all__() -> list[str]: + """Returns a list of all model names.""" return _all_models default = Model( @@ -298,6 +307,12 @@ pi = Model( ) class ModelUtils: + """ + Utility class for mapping string identifiers to Model instances. + + Attributes: + convert (dict[str, Model]): Dictionary mapping model string identifiers to Model instances. + """ convert: dict[str, Model] = { # gpt-3.5 'gpt-3.5-turbo' : gpt_35_turbo, -- cgit v1.2.3