mgbam commited on
Commit
d4adf5c
·
verified ·
1 Parent(s): 2989aca

Update models.py

Browse files
Files changed (1) hide show
  1. models.py +42 -51
models.py CHANGED
@@ -1,5 +1,4 @@
1
  # models.py
2
-
3
  from dataclasses import dataclass
4
  from typing import List, Optional
5
 
@@ -9,11 +8,10 @@ class ModelInfo:
9
  Represents metadata for an inference model.
10
 
11
  Attributes:
12
- name: Humanreadable name of the model.
13
- id: Unique model identifier (HF or routed provider).
14
  description: Short description of the model's capabilities.
15
- default_provider: Preferred inference provider
16
- ("auto", "groq", "openai", "gemini", "fireworks").
17
  """
18
  name: str
19
  id: str
@@ -24,90 +22,83 @@ class ModelInfo:
24
  # Registry of supported models
25
  AVAILABLE_MODELS: List[ModelInfo] = [
26
  ModelInfo(
27
- name="Moonshot KimiK2",
28
- id="moonshotai/KimiK2Instruct",
29
- description="Moonshot AI KimiK2Instruct model for code generation and general tasks",
30
  default_provider="groq"
31
  ),
32
  ModelInfo(
33
  name="DeepSeek V3",
34
- id="deepseekai/DeepSeekV30324",
35
- description="DeepSeek V3 model for code generation"
36
  ),
37
  ModelInfo(
38
  name="DeepSeek R1",
39
- id="deepseekai/DeepSeekR10528",
40
- description="DeepSeek R1 model for code generation"
41
  ),
42
  ModelInfo(
43
- name="ERNIE4.5VL",
44
- id="baidu/ERNIE4.5VL424BA47BBasePT",
45
- description="ERNIE4.5VL model for multimodal code generation with image support"
46
  ),
47
  ModelInfo(
48
  name="MiniMax M1",
49
- id="MiniMaxAI/MiniMaxM180k",
50
- description="MiniMax M1 model for code generation and general tasks"
51
- ),
52
- ModelInfo(
53
- name="Qwen3‑235B‑A22B",
54
- id="Qwen/Qwen3‑235B‑A22B",
55
- description="Qwen3‑235B‑A22B model for code generation and general tasks"
56
- ),
57
- ModelInfo(
58
- name="Qwen3‑235B‑A22B‑Instruct‑2507",
59
- id="Qwen/Qwen3‑235B‑A22B‑Instruct‑2507",
60
- description="Qwen3‑235B‑A22B‑Instruct‑2507 model for code generation and general tasks"
61
  ),
62
  ModelInfo(
63
- name="Qwen3‑Coder‑480B‑A35B",
64
- id="Qwen/Qwen3‑Coder‑480B‑A35B‑Instruct",
65
- description="Qwen3‑Coder‑480B‑A35B‑Instruct model for advanced code generation"
66
  ),
67
  ModelInfo(
68
- name="Qwen3‑32B",
69
- id="Qwen/Qwen3‑32B",
70
- description="Qwen3‑32B model for large‑scale code and general tasks"
71
  ),
72
  ModelInfo(
73
- name="SmolLM3‑3B",
74
- id="HuggingFaceTB/SmolLM3‑3B",
75
- description="SmolLM3‑3B model for code generation and general tasks"
76
  ),
77
  ModelInfo(
78
- name="GLM‑4.1V‑9B‑Thinking",
79
- id="THUDM/GLM‑4.1V‑9B‑Thinking",
80
- description="GLM‑4.1V‑9B‑Thinking model for multimodal code generation with image support"
81
- ),
82
- ModelInfo(
83
- name="OpenAI GPT‑4",
84
- id="openai/gpt‑4",
85
- description="OpenAI GPT‑4 via HF Inference Providers",
86
  default_provider="openai"
87
  ),
88
  ModelInfo(
89
  name="Gemini Pro",
90
  id="gemini/pro",
91
- description="Google Gemini Pro via HF Inference Providers",
92
  default_provider="gemini"
93
  ),
94
  ModelInfo(
95
  name="Fireworks AI",
96
- id="fireworksai/fireworksv1",
97
- description="Fireworks AI via HF Inference Providers",
98
  default_provider="fireworks"
99
  ),
 
 
 
 
 
100
  ]
101
 
 
102
  def find_model(identifier: str) -> Optional[ModelInfo]:
103
  """
104
- Lookup a model by its human name (case‑insensitive) or identifier.
105
 
 
 
106
  Returns:
107
  The matching ModelInfo or None if not found.
108
  """
109
- identifier_lower = identifier.lower()
110
  for m in AVAILABLE_MODELS:
111
- if m.id == identifier or m.name.lower() == identifier_lower:
112
  return m
113
- return None
 
1
  # models.py
 
2
  from dataclasses import dataclass
3
  from typing import List, Optional
4
 
 
8
  Represents metadata for an inference model.
9
 
10
  Attributes:
11
+ name: Human-readable name of the model.
12
+ id: Unique model identifier (HF/externally routed).
13
  description: Short description of the model's capabilities.
14
+ default_provider: Preferred inference provider ("auto", "groq", "openai", "gemini", "fireworks").
 
15
  """
16
  name: str
17
  id: str
 
22
  # Registry of supported models
23
  AVAILABLE_MODELS: List[ModelInfo] = [
24
  ModelInfo(
25
+ name="Moonshot Kimi-K2",
26
+ id="moonshotai/Kimi-K2-Instruct",
27
+ description="Moonshot AI Kimi-K2-Instruct model for code generation and general tasks",
28
  default_provider="groq"
29
  ),
30
  ModelInfo(
31
  name="DeepSeek V3",
32
+ id="deepseek-ai/DeepSeek-V3-0324",
33
+ description="DeepSeek V3 model for code generation",
34
  ),
35
  ModelInfo(
36
  name="DeepSeek R1",
37
+ id="deepseek-ai/DeepSeek-R1-0528",
38
+ description="DeepSeek R1 model for code generation",
39
  ),
40
  ModelInfo(
41
+ name="ERNIE-4.5-VL",
42
+ id="baidu/ERNIE-4.5-VL-424B-A47B-Base-PT",
43
+ description="ERNIE-4.5-VL model for multimodal code generation with image support",
44
  ),
45
  ModelInfo(
46
  name="MiniMax M1",
47
+ id="MiniMaxAI/MiniMax-M1-80k",
48
+ description="MiniMax M1 model for code generation and general tasks",
 
 
 
 
 
 
 
 
 
 
49
  ),
50
  ModelInfo(
51
+ name="Qwen3-235B-A22B",
52
+ id="Qwen/Qwen3-235B-A22B",
53
+ description="Qwen3-235B-A22B model for code generation and general tasks",
54
  ),
55
  ModelInfo(
56
+ name="SmolLM3-3B",
57
+ id="HuggingFaceTB/SmolLM3-3B",
58
+ description="SmolLM3-3B model for code generation and general tasks",
59
  ),
60
  ModelInfo(
61
+ name="GLM-4.1V-9B-Thinking",
62
+ id="THUDM/GLM-4.1V-9B-Thinking",
63
+ description="GLM-4.1V-9B-Thinking model for multimodal code generation with image support",
64
  ),
65
  ModelInfo(
66
+ name="OpenAI GPT-4",
67
+ id="openai/gpt-4",
68
+ description="OpenAI GPT-4 model via Inference Providers",
 
 
 
 
 
69
  default_provider="openai"
70
  ),
71
  ModelInfo(
72
  name="Gemini Pro",
73
  id="gemini/pro",
74
+ description="Google Gemini Pro model via Inference Providers",
75
  default_provider="gemini"
76
  ),
77
  ModelInfo(
78
  name="Fireworks AI",
79
+ id="fireworks-ai/fireworks-v1",
80
+ description="Fireworks AI model via Inference Providers",
81
  default_provider="fireworks"
82
  ),
83
+ ModelInfo(
84
+ name="Qwen3-32B",
85
+ id="Qwen/Qwen3-32B",
86
+ description="Qwen3-32B model for high-capacity code and text generation",
87
+ ),
88
  ]
89
 
90
+
91
  def find_model(identifier: str) -> Optional[ModelInfo]:
92
  """
93
+ Lookup a model by its human name or identifier.
94
 
95
+ Args:
96
+ identifier: ModelInfo.name (case-insensitive) or ModelInfo.id
97
  Returns:
98
  The matching ModelInfo or None if not found.
99
  """
100
+ key = identifier.lower()
101
  for m in AVAILABLE_MODELS:
102
+ if m.id == identifier or m.name.lower() == key:
103
  return m
104
+ return None