broadfield-dev commited on
Commit
ad4a63a
·
verified ·
1 Parent(s): e38b58b

Update model_logic.py

Browse files
Files changed (1) hide show
  1. model_logic.py +139 -65
model_logic.py CHANGED
@@ -38,7 +38,7 @@ API_URLS = {
38
  }
39
 
40
  # Structure: provider_key: { "default": "model_id", "models": {"Display Name": "model_id", ...} }
41
- MODELS_BY_PROVIDER = {
42
  "groq": {
43
  "default": "llama3-8b-8192",
44
  "models": {
@@ -46,75 +46,149 @@ MODELS_BY_PROVIDER = {
46
  "Llama 3 70B (Groq)": "llama3-70b-8192",
47
  "Mixtral 8x7B (Groq)": "mixtral-8x7b-32768",
48
  "Gemma 7B (Groq)": "gemma-7b-it",
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
  },
51
  "openrouter": {
52
- "default": "nousresearch/llama-3-8b-instruct", # Updated default
53
- "models": {
54
- "Nous Llama-3 8B Instruct (OpenRouter)": "nousresearch/llama-3-8b-instruct",
55
- "Mistral 7B Instruct v0.3 (OpenRouter)": "mistralai/mistral-7b-instruct-v0.3", # v0.3 is newer
56
- "Mistral 7B Instruct (Free/OpenRouter)": "mistralai/mistral-7b-instruct:free", # Keep free tier if distinct
57
- "Gemma 2 9B Instruct (OpenRouter)": "google/gemma-2-9b-it", # Gemma 2
58
  "Gemma 7B Instruct (Free/OpenRouter)": "google/gemma-7b-it:free",
59
- "Llama 3.1 8B Instruct (OpenRouter)": "meta-llama/llama-3.1-8b-instruct", # Llama 3.1
60
- "Llama 3.1 70B Instruct (OpenRouter)": "meta-llama/llama-3.1-70b-instruct",
61
- "OpenAI GPT-4o mini (OpenRouter)": "openai/gpt-4o-mini",
62
- "OpenAI GPT-4o (OpenRouter)": "openai/gpt-4o",
63
- "Claude 3.5 Sonnet (OpenRouter)": "anthropic/claude-3.5-sonnet",
64
- "Mixtral 8x7B Instruct v0.1 (OpenRouter)": "mistralai/mixtral-8x7b-instruct", # Older Mixtral
65
- "Qwen 2 72B Instruct (OpenRouter)": "qwen/qwen-2-72b-instruct",
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  },
68
- "togetherai": {
69
- "default": "meta-llama/Llama-3-8b-chat-hf",
70
- "models": {
71
- "Llama 3 8B Chat (TogetherAI)": "meta-llama/Llama-3-8b-chat-hf",
72
- "Llama 3 70B Chat (TogetherAI)": "meta-llama/Llama-3-70b-chat-hf",
73
- "Mixtral 8x7B Instruct (TogetherAI)": "mistralai/Mixtral-8x7B-Instruct-v0.1",
74
- "Gemma 7B Instruct (TogetherAI)": "google/gemma-7b-it",
75
- "Qwen1.5-72B-Chat (TogetherAI)": "qwen/Qwen1.5-72B-Chat",
76
- }
77
- },
78
- "google": {
79
- "default": "gemini-1.5-flash-latest",
80
- "models": {
81
- "Gemini 1.5 Flash (Latest)": "gemini-1.5-flash-latest",
82
- "Gemini 1.5 Pro (Latest)": "gemini-1.5-pro-latest",
83
- # "Gemini 1.0 Pro": "gemini-pro" # Older model example
84
- }
85
- },
86
- "cohere": {
87
- "default": "command-r", # command-r is generally better than light
88
- "models": {
89
- "Command R (Cohere)": "command-r",
90
- "Command R+ (Cohere)": "command-r-plus",
91
- "Command Light (Cohere)": "command-light",
92
- }
93
- },
94
- "huggingface": { # Direct HF Inference API is tricky for chat, often better via OpenRouter/TogetherAI
95
- "default": "mistralai/Mistral-7B-Instruct-v0.2", # A common TGI compatible model
96
- "models": {
97
- "Mistral 7B Instruct v0.2 (HF Inf.)": "mistralai/Mistral-7B-Instruct-v0.2",
98
- "Llama 3 8B Instruct (HF Inf.)": "meta-llama/Meta-Llama-3-8B-Instruct", # Ensure this specific ID is for TGI
99
- # "Zephyr 7B Beta (H4/HF Inf.)": "HuggingFaceH4/zephyr-7b-beta", # Older model
100
- }
101
- },
102
- "openai": {
103
- "default": "gpt-4o-mini", # New default
104
- "models": {
105
- "GPT-4o (OpenAI)": "gpt-4o",
106
- "GPT-4o mini (OpenAI)": "gpt-4o-mini",
107
- "GPT-4 Turbo (OpenAI)": "gpt-4-turbo", # Refers to latest gpt-4-turbo variant
108
- "GPT-3.5 Turbo (OpenAI)": "gpt-3.5-turbo", # Refers to latest gpt-3.5-turbo variant
109
- }
110
- },
111
- "xai": { # Assuming xAI might expand model list
112
- "default": "grok-1.5-flash", # Assuming Grok 1.5 flash is available
113
- "models": {
114
- "Grok 1.5 Flash (xAI)": "grok-1.5-flash",
115
- # "Grok-1 (xAI)": "grok-1", # Older model
116
- }
117
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
119
 
120
  def _get_api_key(provider: str, ui_api_key_override: str = None) -> str | None:
 
38
  }
39
 
40
  # Structure: provider_key: { "default": "model_id", "models": {"Display Name": "model_id", ...} }
41
+ {
42
  "groq": {
43
  "default": "llama3-8b-8192",
44
  "models": {
 
46
  "Llama 3 70B (Groq)": "llama3-70b-8192",
47
  "Mixtral 8x7B (Groq)": "mixtral-8x7b-32768",
48
  "Gemma 7B (Groq)": "gemma-7b-it",
49
+ "Gemma 2 9B (Groq)": "gemma-2-9b-it",
50
+ "Llama 3.1 8B (Groq)": "llama-3.1-8b-instruct",
51
+ "Llama 3.1 70B (Groq)": "llama-3.1-70b-instruct",
52
+ "Qwen 2 7B (Groq)": "qwen-2-7b-instruct",
53
+ "Qwen 2 72B (Groq)": "qwen-2-72b-instruct",
54
+ "Mistral 7B Instruct v0.3 (Groq)": "mistral-7b-instruct-v0.3",
55
+ "Falcon 7B (Groq)": "falcon-7b-instruct",
56
+ "Falcon 40B (Groq)": "falcon-40b-instruct",
57
+ "Grok 1.5 Flash (Groq) $": "grok-1.5-flash",
58
+ "Grok 3 (Groq) $$": "grok-3",
59
+ "DeepSeek R-1 7B (Groq)": "deepseek-r-1-7b-instruct"
60
  }
61
  },
62
  "openrouter": {
63
+ "default": "mistralai/mistral-7b-instruct:free",
64
+ "models": {
65
+ "Mistral 7B Instruct (Free/OpenRouter)": "mistralai/mistral-7b-instruct:free",
 
 
 
66
  "Gemma 7B Instruct (Free/OpenRouter)": "google/gemma-7b-it:free",
67
+ "Llama 3 8B Instruct (Free/OpenRouter)": "meta-llama/llama-3-8b-instruct:free",
68
+ "Nous Llama 3 8B Instruct (OpenRouter)": "nousresearch/llama-3-8b-instruct",
69
+ "Mistral 7B Instruct v0.3 (OpenRouter)": "mistralai/mistral-7b-instruct-v0.3",
70
+ "Gemma 2 9B Instruct (OpenRouter)": "google/gemma-2-9b-it",
71
+ "Llama 3.1 8B Instruct (OpenRouter)": "meta-llama/llama-3.1-8b-instruct",
72
+ "Qwen 2 7B Instruct (OpenRouter)": "qwen/qwen-2-7b-instruct",
73
+ "Falcon 7B Instruct (OpenRouter)": "tiiuae/falcon-7b-instruct",
74
+ "DeepSeek R-1 7B (OpenRouter)": "deepseek/r-1-7b-instruct",
75
+ "Llama 3.1 70B Instruct (OpenRouter) $": "meta-llama/llama-3.1-70b-instruct",
76
+ "Mixtral 8x7B Instruct v0.1 (OpenRouter) $": "mistralai/mixtral-8x7b-instruct",
77
+ "Qwen 2 72B Instruct (OpenRouter) $": "qwen/qwen-2-72b-instruct",
78
+ "OpenAI GPT-4o mini (OpenRouter) $$": "openai/gpt-4o-mini",
79
+ "OpenAI GPT-4o (OpenRouter) $$$": "openai/gpt-4o",
80
+ "Claude 3.5 Sonnet (OpenRouter) $$$": "anthropic/claude-3.5-sonnet"
81
+ }
82
+ },
83
+ "togetherai": {
84
+ "default": "meta-llama/Llama-3-8b-chat-hf",
85
+ "models": {
86
+ "Llama 3 8B Chat (TogetherAI)": "meta-llama/Llama-3-8b-chat-hf",
87
+ "Gemma 7B Instruct (TogetherAI)": "google/gemma-7b-it",
88
+ "Mistral 7B Instruct v0.2 (TogetherAI)": "mistralai/Mistral-7B-Instruct-v0.2",
89
+ "Qwen 2 7B Chat (TogetherAI)": "qwen/Qwen-2-7B-Chat",
90
+ "Falcon 7B Instruct (TogetherAI)": "tiiuae/falcon-7b-instruct",
91
+ "DeepSeek R-1 7B (TogetherAI)": "deepseek/r-1-7b-instruct",
92
+ "Llama 3.1 8B Instruct (TogetherAI)": "meta-llama/Llama-3.1-8b-instruct",
93
+ "Gemma 2 9B Instruct (TogetherAI)": "google/gemma-2-9b-it",
94
+ "Llama 3 70B Chat (TogetherAI) $": "meta-llama/Llama-3-70b-chat-hf",
95
+ "Mixtral 8x7B Instruct (TogetherAI) $": "mistralai/Mixtral-8x7B-Instruct-v0.1",
96
+ "Qwen 2 72B Chat (TogetherAI) $": "qwen/Qwen-2-72B-Chat",
97
+ "Falcon 40B Instruct (TogetherAI) $": "tiiuae/falcon-40b-instruct",
98
+ "Llama 3.1 70B Instruct (TogetherAI) $$": "meta-llama/Llama-3.1-70b-instruct",
99
+ "Mistral 8x22B Instruct (TogetherAI) $$": "mistralai/Mixtral-8x22B-Instruct-v0.1",
100
+ "DeepSeek R-2 72B (TogetherAI) $$": "deepseek/r-2-72b-instruct",
101
+ "CodeLlama 34B Instruct (TogetherAI) $": "codellama/CodeLlama-34b-Instruct-hf"
102
+ }
103
  },
104
+ "google": {
105
+ "default": "gemini-1.5-flash-latest",
106
+ "models": {
107
+ "Gemini 1.5 Flash (Latest)": "gemini-1.5-flash-latest",
108
+ "Gemini 1.0 Pro": "gemini-pro",
109
+ "Gemma 7B Instruct": "gemma-7b-it",
110
+ "Gemma 2 9B Instruct": "gemma-2-9b-it",
111
+ "CodeGemma 7B": "codegemma-7b",
112
+ "Gemini 1.5 Pro (Latest) $": "gemini-1.5-pro-latest",
113
+ "Gemini 1.5 Flash 8B $": "gemini-1.5-flash-8b",
114
+ "Gemini 1.0 Ultra $$": "gemini-ultra",
115
+ "Gemini 1.5 Pro Experimental $$": "gemini-1.5-pro-exp",
116
+ "Gemini 1.5 Flash Experimental $$": "gemini-1.5-flash-exp",
117
+ "Gemini 1.5 Pro Reasoning $$": "gemini-1.5-pro-reasoning",
118
+ "Gemini 1.5 Flash Reasoning $$": "gemini-1.5-flash-reasoning",
119
+ "Gemini 1.5 Pro Vision $$": "gemini-1.5-pro-vision",
120
+ "Gemini 1.5 Flash Vision $$": "gemini-1.5-flash-vision",
121
+ "CodeGemma 7B Instruct $$": "codegemma-7b-instruct"
122
+ }
123
+ },
124
+ "cohere": {
125
+ "default": "command-r",
126
+ "models": {
127
+ "Command Light (Cohere)": "command-light",
128
+ "Command (Cohere)": "command",
129
+ "Command R (Cohere)": "command-r",
130
+ "Command R+ (Cohere) $": "command-r-plus",
131
+ "Classify (Cohere) $": "classify",
132
+ "Embed English v3.0 (Cohere) $": "embed-english-v3.0",
133
+ "Embed Multilingual v3.0 (Cohere) $": "embed-multilingual-v3.0",
134
+ "Command Nightly (Cohere) $": "command-nightly",
135
+ "Command R 08-2024 (Cohere) $": "command-r-08-2024",
136
+ "Command R+ 08-2024 (Cohere) $$": "command-r-plus-08-2024",
137
+ "Embed English Light v3.0 (Cohere) $": "embed-english-light-v3.0",
138
+ "Embed Multilingual Light v3.0 (Cohere) $": "embed-multilingual-light-v3.0",
139
+ "Command R 03-2024 (Cohere) $": "command-r-03-2024",
140
+ "Command Light Nightly (Cohere) $": "command-light-nightly",
141
+ "Classify v2 (Cohere) $$": "classify-v2"
142
+ }
143
+ },
144
+ "huggingface": {
145
+ "default": "mistralai/Mistral-7B-Instruct-v0.2",
146
+ "models": {
147
+ "Mistral 7B Instruct v0.2 (HF Inf.)": "mistralai/Mistral-7B-Instruct-v0.2",
148
+ "Llama 3 8B Instruct (HF Inf.)": "meta-llama/Meta-Llama-3-8B-Instruct",
149
+ "Gemma 7B Instruct (HF Inf.)": "google/gemma-7b-it",
150
+ "Zephyr 7B Beta (HF Inf.)": "HuggingFaceH4/zephyr-7b-beta",
151
+ "Qwen 2 7B Instruct (HF Inf.)": "qwen/Qwen-2-7B-Instruct",
152
+ "Falcon 7B Instruct (HF Inf.)": "tiiuae/falcon-7b-instruct",
153
+ "Mixtral 8x7B Instruct (HF Inf.)": "mistralai/Mixtral-8x7B-Instruct-v0.1",
154
+ "Gemma 2 9B Instruct (HF Inf.)": "google/gemma-2-9b-it",
155
+ "Llama 3.1 8B Instruct (HF Inf.)": "meta-llama/Llama-3.1-8B-Instruct",
156
+ "DeepSeek R-1 7B (HF Inf.)": "deepseek/r-1-7b-instruct",
157
+ "Mistral 7B Instruct v0.3 (HF Inf.) $": "mistralai/Mistral-7B-Instruct-v0.3",
158
+ "Llama 3 70B Instruct (HF Inf.) $$": "meta-llama/Meta-Llama-3-70B-Instruct",
159
+ "Mixtral 8x22B Instruct (HF Inf.) $$": "mistralai/Mixtral-8x22B-Instruct-v0.1",
160
+ "Qwen 2 72B Instruct (HF Inf.) $$": "qwen/Qwen-2-72B-Instruct",
161
+ "Falcon 40B Instruct (HF Inf.) $$": "tiiuae/falcon-40b-instruct",
162
+ "CodeLlama 34B Instruct (HF Inf.) $": "codellama/CodeLlama-34b-Instruct-hf"
163
+ }
164
+ },
165
+ "openai": {
166
+ "default": "gpt-4o-mini",
167
+ "models": {
168
+ "GPT-3.5 Turbo (OpenAI)": "gpt-3.5-turbo",
169
+ "GPT-4o mini (OpenAI) $": "gpt-4o-mini",
170
+ "GPT-4 Turbo (OpenAI) $$": "gpt-4-turbo",
171
+ "GPT-4o (OpenAI) $$$": "gpt-4o",
172
+ "GPT-4 (OpenAI) $$$": "gpt-4",
173
+ "GPT-3.5 Turbo 0125 (OpenAI) $": "gpt-3.5-turbo-0125",
174
+ "GPT-4o 2024-05-13 (OpenAI) $$$": "gpt-4o-2024-05-13",
175
+ "GPT-4 Turbo Preview (OpenAI) $$": "gpt-4-turbo-preview",
176
+ "GPT-3.5 Turbo Instruct (OpenAI) $": "gpt-3.5-turbo-instruct",
177
+ "GPT-4 32k (OpenAI) $$$": "gpt-4-32k",
178
+ "GPT-4o mini 2024-07-18 (OpenAI) $": "gpt-4o-mini-2024-07-18",
179
+ "GPT-4 Vision Preview (OpenAI) $$$": "gpt-4-vision-preview",
180
+ "GPT-3.5 Turbo 1106 (OpenAI) $": "gpt-3.5-turbo-1106",
181
+ "GPT-4 0613 (OpenAI) $$$": "gpt-4-0613",
182
+ "GPT-4o 2024-08-08 (OpenAI) $$$": "gpt-4o-2024-08-08"
183
+ }
184
+ },
185
+ "xai": {
186
+ "default": "grok-1.5-flash",
187
+ "models": {
188
+ "Grok 1.5 Flash (xAI) $": "grok-1.5-flash",
189
+ "Grok 3 (xAI) $$": "grok-3"
190
+ }
191
+ }
192
  }
193
 
194
  def _get_api_key(provider: str, ui_api_key_override: str = None) -> str | None: