@@ -30,15 +30,19 @@ class ModelType(Enum):
3030 GPT_4_TURBO = "gpt-4-turbo"
3131 GPT_4O = "gpt-4o"
3232 GLM_4 = "glm-4"
33+ GLM_4_OPEN_SOURCE = "glm-4-open-source"
3334 GLM_4V = 'glm-4v'
3435 GLM_3_TURBO = "glm-3-turbo"
3536
3637 STUB = "stub"
3738
3839 LLAMA_2 = "llama-2"
40+ LLAMA_3 = "llama-3"
3941 VICUNA = "vicuna"
4042 VICUNA_16K = "vicuna-16k"
4143
44+ QWEN_2 = "qwen-2"
45+
4246 # Legacy anthropic models
4347 # NOTE: anthropic lagecy models only Claude 2.1 has system prompt support
4448 CLAUDE_2_1 = "claude-2.1"
@@ -87,6 +91,9 @@ def is_open_source(self) -> bool:
8791 r"""Returns whether this type of models is open-source."""
8892 return self in {
8993 ModelType .LLAMA_2 ,
94+ ModelType .LLAMA_3 ,
95+ ModelType .QWEN_2 ,
96+ ModelType .GLM_4_OPEN_SOURCE ,
9097 ModelType .VICUNA ,
9198 ModelType .VICUNA_16K ,
9299 }
@@ -135,7 +142,7 @@ def token_limit(self) -> int:
135142 return 128000
136143 elif self is ModelType .GPT_4O :
137144 return 128000
138- elif self == ModelType .GLM_4 :
145+ elif self == ModelType .GLM_4_OPEN_SOURCE :
139146 return 8192
140147 elif self == ModelType .GLM_3_TURBO :
141148 return 8192
@@ -145,6 +152,12 @@ def token_limit(self) -> int:
145152 return 4096
146153 elif self is ModelType .LLAMA_2 :
147154 return 4096
155+ elif self is ModelType .LLAMA_3 :
156+ return 8192
157+ elif self is ModelType .QWEN_2 :
158+ return 128000
159+ elif self is ModelType .GLM_4 :
160+ return 8192
148161 elif self is ModelType .VICUNA :
149162 # reference: https://lmsys.org/blog/2023-03-30-vicuna/
150163 return 2048
@@ -184,6 +197,20 @@ def validate_model_name(self, model_name: str) -> bool:
184197 self .value in model_name .lower ()
185198 or "llama2" in model_name .lower ()
186199 )
200+ elif self is ModelType .LLAMA_3 :
201+ return (
202+ self .value in model_name .lower ()
203+ or "llama3" in model_name .lower ()
204+ )
205+ elif self is ModelType .QWEN_2 :
206+ return (
207+ self .value in model_name .lower ()
208+ or "qwen2" in model_name .lower ()
209+ )
210+ elif self is ModelType .GLM_4_OPEN_SOURCE :
211+ return (
212+ 'glm-4' in model_name .lower () or "glm4" in model_name .lower ()
213+ )
187214 else :
188215 return self .value in model_name .lower ()
189216
0 commit comments