Spaces:
Running
Running
File size: 11,296 Bytes
e91ac58 c47d7dd e91ac58 67f7ed6 e91ac58 c47d7dd e91ac58 567930d e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd 67f7ed6 e91ac58 567930d e91ac58 c47d7dd e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 c47d7dd 67f7ed6 e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 567930d e91ac58 567930d e91ac58 c47d7dd e91ac58 806953a e91ac58 c47d7dd e91ac58 67f7ed6 e91ac58 c47d7dd e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 806953a e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 567930d e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 567930d e91ac58 c47d7dd e91ac58 567930d e91ac58 c47d7dd e91ac58 c47d7dd 67f7ed6 e91ac58 67f7ed6 e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 c47d7dd e91ac58 c47d7dd 67f7ed6 c47d7dd e91ac58 ae215ea e91ac58 567930d e91ac58 567930d e91ac58 567930d e91ac58 c47d7dd e91ac58 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
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_4_TURBO_2024_04_09': '#32CD32', # Lime Green
'GPT_4o_2024_05_13': '#3CB371', # Lime Green gpt-4o-2024-05-13
'GPT_3_5_INSTRUCT': '#3CB371', # Medium Sea Green
'GPT_4_TURBO_1106': '#228B22', # Forest Green
'GPT_4_TURBO_0125': '#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_1106': '#9370DB', # Medium Purple
# 'AZURE_GPT_4_TURBO_0125': '#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
'OPEN_MISTRAL_7B': '#FFA07A', # Light Salmon
'OPEN_MIXTRAL_8X7B': '#FF8C00', # Dark Orange
'MISTRAL_SMALL': '#FF6347', # Tomato
'MISTRAL_MEDIUM': '#FF4500', # Orange Red
'MISTRAL_LARGE': '#800000', # Maroon
'LOCAL_MIXTRAL_8X7B_INSTRUCT_V01': '#000000', # Black
'LOCAL_MISTRAL_7B_INSTRUCT_V02': '#4a4a4a', # Gray
'LOCAL_CPU_MISTRAL_7B_INSTRUCT_V02_GGUF': '#bababa', # Gray
'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': '#bababa', # Gray
}
MODELS_OPENAI = ["GPT 4",
"GPT 4 32k",
"GPT 4o 2024-05-13", #GPT_4o_2024_05_13
"GPT 4 Turbo 2024-04-09",#GPT_4_TURBO_2024_04_09
"GPT 4 Turbo 0125-preview",
"GPT 4 Turbo 1106-preview",
"GPT 3.5 Turbo",
"GPT 3.5 Instruct",
"Azure GPT 4",
# "Azure GPT 4 32k",
# "Azure GPT 4 Turbo 0125-preview",
# "Azure GPT 4 Turbo 1106-preview",
# "Azure GPT 3.5 Turbo",
# "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 Small",
"Mistral Medium",
"Mistral Large",
"Open Mixtral 8x7B",
"Open Mistral 7B",
]
MODELS_LOCAL = ["LOCAL Mixtral 8x7B Instruct v0.1",
"LOCAL Mistral 7B Instruct v0.2",
"LOCAL CPU Mistral 7B Instruct v0.2 GGUF",
'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05']
MODELS_GUI_DEFAULT = "Azure GPT 4" # "GPT 4 Turbo 1106-preview"
version_mapping_cost = {
'GPT 4 32k': 'GPT_4_32K',
'GPT 4': 'GPT_4',
"GPT 4o 2024-05-13": 'GPT_4o_2024_05_13',
"GPT 4 Turbo 2024-04-09": 'GPT_4_TURBO_2024_04_09',
'GPT 4 Turbo 0125-preview': 'GPT_4_TURBO_0125',
'GPT 4 Turbo 1106-preview': 'GPT_4_TURBO_1106',
'GPT 3.5 Instruct': 'GPT_3_5_INSTRUCT',
'GPT 3.5 Turbo': 'GPT_3_5',
# 'Azure GPT 4 32k': 'AZURE_GPT_4_32K',
'Azure GPT 4': 'AZURE_GPT_4',
# 'Azure GPT 4 Turbo 0125-preview': 'AZURE_GPT_4_TURBO_0125',
# 'Azure GPT 4 Turbo 1106-preview': 'AZURE_GPT_4_TURBO_1106',
# 'Azure GPT 3.5 Instruct': 'AZURE_GPT_3_5_INSTRUCT',
# 'Azure GPT 3.5 Turbo': '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 Large': 'MISTRAL_LARGE',
'Mistral Medium': 'MISTRAL_MEDIUM',
'Mistral Small': 'MISTRAL_SMALL',
'Open Mixtral 8x7B': 'OPEN_MIXTRAL_8X7B',
'Open Mistral 7B': 'OPEN_MISTRAL_7B',
'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',
'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05',
}
@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 2024-04-09": has_key_openai,
'GPT 4 Turbo 1106-preview': has_key_openai,
'GPT 4 Turbo 0125-preview': has_key_openai,
'GPT 4': has_key_openai,
"GPT 4o 2024-05-13": has_key_openai,
'GPT 4 32k': has_key_openai,
'GPT 3.5 Turbo': has_key_openai,
'GPT 3.5 Instruct': has_key_openai,
# 'Azure GPT 3.5 Turbo': 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 Turbo 0125-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 Small': has_key_mistral,
'Mistral Medium': has_key_mistral,
'Mistral Large': has_key_mistral,
'Open Mixtral 8x7B': has_key_mistral,
'Open Mistral 7B': 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,
'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': True
}
return version_has_key.get(key)
@classmethod
def get_version_mapping_is_azure(cls, key):
version_mapping_is_azure = {
"GPT 4o 2024-05-13": False,
"GPT 4 Turbo 2024-04-09": False,
"GPT 4 Turbo 1106-preview": False,
"GPT 4 Turbo 0125-preview": False,
'GPT 4': False,
'GPT 4 32k': False,
'GPT 3.5 Turbo': False,
'GPT 3.5 Instruct': False,
# 'Azure GPT 3.5 Turbo': True,
# 'Azure GPT 3.5 Instruct': True,
'Azure GPT 4': True,
# 'Azure GPT 4 Turbo 1106-preview': True,
# 'Azure GPT 4 Turbo 0125-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 Small': False,
'Mistral Medium': False,
'Mistral Large': False,
'Open Mixtral 8x7B': False,
'Open Mistral 7B': False,
'LOCAL Mixtral 8x7B Instruct v0.1': False,
'LOCAL Mistral 7B Instruct v0.2': False,
'LOCAL CPU Mistral 7B Instruct v0.2 GGUF': False,
'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05': 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-0125' #'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_4o_2024_05_13':
return 'gpt-4o-2024-05-13'
elif key == 'GPT_4_TURBO_2024_04_09':
return 'gpt-4-turbo-2024-04-09'
elif key == 'GPT_4_TURBO_1106':
return 'gpt-4-1106-preview'
elif key == 'GPT_4_TURBO_0125':
return 'gpt-4-0125-preview'
### Azure
# elif key == 'AZURE_GPT_3_5':
# return 'gpt-35-turbo-0125'
# 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_1106':
# return "gpt-4-1106-preview"
# elif key == 'AZURE_GPT_4_TURBO_0125':
# return 'gpt-4-0125-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-1.0-pro"
### Mistral
elif key == 'OPEN_MISTRAL_7B':
return "open-mistral-7b"
elif key == 'OPEN_MIXTRAL_8X7B':
return 'open-mixtral-8x7b'
elif key == 'MISTRAL_SMALL':
return 'mistral-small-latest'
elif key == 'MISTRAL_MEDIUM':
return 'mistral-medium-latest'
elif key == 'MISTRAL_LARGE':
return 'mistral-large-latest'
### 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'
### LOCAL custom fine-tuned
elif key == 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05':
return 'phyloforfun/mistral-7b-instruct-v2-bnb-4bit__HLT_MICH_Angiospermae_SLTPvC_v1-0_medium_OCR-C25-L25-E50-R05'
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 |