class ModelMaps: PROMPTS_THAT_NEED_DOMAIN_KNOWLEDGE = ["Version 1", "Version 1 PaLM 2"] COLORS_EXPENSE_REPORT = { 'GPT_4': '#32CD32', # Lime Green 'GPT_3_5': '#008000', # Green 'GPT_3_5_INSTRUCT': '#3CB371', # Medium Sea Green 'GPT_4_TURBO': '#228B22', # Forest Green 'GPT_4_32K': '#006400', # Dark Green 'PALM2_TB_1': '#87CEEB', # Sky Blue 'PALM2_TB_2': '#1E90FF', # Dodger Blue 'PALM2_TU_1': '#0000FF', # Blue 'GEMINI_PRO': '#1E00FF', # 'AZURE_GPT_4': '#800080', # Purple 'AZURE_GPT_4_TURBO': '#9370DB', # Medium Purple 'AZURE_GPT_4_32K': '#8A2BE2', # Blue Violet 'AZURE_GPT_3_5_INSTRUCT': '#9400D3', # Dark Violet 'AZURE_GPT_3_5': '#9932CC', # Dark Orchid 'MISTRAL_TINY': '#FFA07A', # Light Salmon 'MISTRAL_SMALL': '#FF8C00', # Dark Orange 'MISTRAL_MEDIUM': '#FF4500', # Orange Red 'LOCAL_MIXTRAL_8X7B_INSTRUCT_V01': '#000000', # Black 'LOCAL_MISTRAL_7B_INSTRUCT_V02': '#4a4a4a', # Gray 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF': '#bababa', # Gray } MODELS_OPENAI = ["GPT 4", "GPT 4 32k", "GPT 4 Turbo 1106-preview", "GPT 3.5", "GPT 3.5 Instruct", "Azure GPT 4", "Azure GPT 4 32k", "Azure GPT 4 Turbo 1106-preview", "Azure GPT 3.5", "Azure GPT 3.5 Instruct",] MODELS_GOOGLE = ["PaLM 2 text-bison@001", "PaLM 2 text-bison@002", "PaLM 2 text-unicorn@001", "Gemini Pro"] MODELS_MISTRAL = ["Mistral Tiny", "Mistral Small", "Mistral Medium",] MODELS_LOCAL = ["LOCAL Mixtral 8x7B Instruct v0.1", "LOCAL Mistral 7B Instruct v0.2", "LOCAL CPU Mistral 7B Instruct v0.2 GGUF",] MODELS_GUI_DEFAULT = "Azure GPT 3.5 Instruct" # "GPT 4 Turbo 1106-preview" version_mapping_cost = { 'GPT 4 32k': 'GPT_4_32K', 'GPT 4': 'GPT_4', 'GPT 4 Turbo 1106-preview': 'GPT_4_TURBO', 'GPT 3.5 Instruct': 'GPT_3_5_INSTRUCT', 'GPT 3.5': 'GPT_3_5', 'Azure GPT 4 32k': 'AZURE_GPT_4_32K', 'Azure GPT 4': 'AZURE_GPT_4', 'Azure GPT 4 Turbo 1106-preview': 'AZURE_GPT_4_TURBO', 'Azure GPT 3.5 Instruct': 'AZURE_GPT_3_5_INSTRUCT', 'Azure GPT 3.5': 'AZURE_GPT_3_5', 'Gemini Pro': 'GEMINI_PRO', 'PaLM 2 text-unicorn@001': 'PALM2_TU_1', 'PaLM 2 text-bison@001': 'PALM2_TB_1', 'PaLM 2 text-bison@002': 'PALM2_TB_2', 'Mistral Medium': 'MISTRAL_MEDIUM', 'Mistral Small': 'MISTRAL_SMALL', 'Mistral Tiny': 'MISTRAL_TINY', 'LOCAL Mixtral 8x7B Instruct v0.1': 'LOCAL_MIXTRAL_8X7B_INSTRUCT_V01', 'LOCAL Mistral 7B Instruct v0.2': 'LOCAL_MISTRAL_7B_INSTRUCT_V02', 'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF', } @classmethod def get_version_has_key(cls, key, has_key_openai, has_key_azure_openai, has_key_google_application_credentials, has_key_mistral): # Define the mapping for 'has_key' values version_has_key = { 'GPT 4 Turbo 1106-preview': has_key_openai, 'GPT 4': has_key_openai, 'GPT 4 32k': has_key_openai, 'GPT 3.5': has_key_openai, 'GPT 3.5 Instruct': has_key_openai, 'Azure GPT 3.5': has_key_azure_openai, 'Azure GPT 3.5 Instruct': has_key_azure_openai, 'Azure GPT 4': has_key_azure_openai, 'Azure GPT 4 Turbo 1106-preview': has_key_azure_openai, 'Azure GPT 4 32k': has_key_azure_openai, 'PaLM 2 text-bison@001': has_key_google_application_credentials, 'PaLM 2 text-bison@002': has_key_google_application_credentials, 'PaLM 2 text-unicorn@001': has_key_google_application_credentials, 'Gemini Pro': has_key_google_application_credentials, 'Mistral Tiny': has_key_mistral, 'Mistral Small': has_key_mistral, 'Mistral Medium': has_key_mistral, 'LOCAL Mixtral 8x7B Instruct v0.1': True, 'LOCAL Mistral 7B Instruct v0.2': True, 'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': True, } return version_has_key.get(key) @classmethod def get_version_mapping_is_azure(cls, key): version_mapping_is_azure = { "GPT 4 Turbo 1106-preview": False, 'GPT 4': False, 'GPT 4 32k': False, 'GPT 3.5': False, 'GPT 3.5 Instruct': False, 'Azure GPT 3.5': True, 'Azure GPT 3.5 Instruct': True, 'Azure GPT 4': True, 'Azure GPT 4 Turbo 1106-preview': True, 'Azure GPT 4 32k': True, 'PaLM 2 text-bison@001': False, 'PaLM 2 text-bison@002': False, 'PaLM 2 text-unicorn@001': False, 'Gemini Pro': False, 'Mistral Tiny': False, 'Mistral Small': False, 'Mistral Medium': False, 'LOCAL Mixtral 8x7B Instruct v0.1': False, 'LOCAL Mistral 7B Instruct v0.2': False, 'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': False, } return version_mapping_is_azure.get(key) @classmethod def get_API_name(cls, key): ### OpenAI if key == 'GPT_3_5': return 'gpt-3.5-turbo-1106' elif key == 'GPT_3_5_INSTRUCT': return 'gpt-3.5-turbo-instruct' elif key == 'GPT_4': return 'gpt-4' elif key == 'GPT_4_32K': return 'gpt-4-32k' elif key == 'GPT_4_TURBO': return 'gpt-4-1106-preview' ### Azure elif key == 'AZURE_GPT_3_5': return 'gpt-35-turbo-1106' elif key == 'AZURE_GPT_3_5_INSTRUCT': return 'gpt-35-turbo-instruct' elif key == 'AZURE_GPT_4': return "gpt-4" elif key == 'AZURE_GPT_4_TURBO': return "gpt-4-1106-preview" elif key == 'AZURE_GPT_4_32K': return "gpt-4-32k" ### Google elif key == 'PALM2_TB_1': return "text-bison@001" elif key == 'PALM2_TB_2': return "text-bison@002" elif key == 'PALM2_TU_1': return "text-unicorn@001" elif key == 'GEMINI_PRO': return "gemini-pro" ### Mistral elif key == 'MISTRAL_TINY': return "mistral-tiny" elif key == 'MISTRAL_SMALL': return 'mistral-small' elif key == 'MISTRAL_MEDIUM': return 'mistral-medium' ### Mistral LOCAL elif key == 'LOCAL_MIXTRAL_8X7B_INSTRUCT_V01': return 'Mixtral-8x7B-Instruct-v0.1' elif key == 'LOCAL_MISTRAL_7B_INSTRUCT_V02': return 'Mistral-7B-Instruct-v0.2' ### Mistral LOCAL CPU elif key == 'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF': return 'Mistral-7B-Instruct-v0.2-GGUF' else: raise ValueError(f"Invalid model name {key}. See model_maps.py") @classmethod def get_models_gui_list(cls): return cls.MODELS_LOCAL + cls.MODELS_GOOGLE + cls.MODELS_OPENAI + cls.MODELS_MISTRAL @classmethod def get_version_mapping_cost(cls, key): return cls.version_mapping_cost.get(key, None) @classmethod def get_all_mapping_cost(cls): return cls.version_mapping_cost