File size: 7,654 Bytes
3a6c93a 1d42ac6 3a6c93a 1d42ac6 377a6ef 1d42ac6 377a6ef 1d42ac6 377a6ef 1d42ac6 377a6ef 1d42ac6 377a6ef 1d42ac6 3a6c93a 377a6ef 1d42ac6 3a6c93a 1d42ac6 377a6ef 3a6c93a | 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 | from typing import Dict, Any
# ββ Model Registry ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MODEL_REGISTRY: Dict[str, Dict[str, Any]] = {
# ββ Original models (fixed) βββββββββββββββββββββββββββββββββββββββββ
"HuggingFaceTB/SmolLM2-360M-Instruct": {
"label": "SmolLM2 360M",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 2048,
},
"Qwen/Qwen2.5-0.5B-Instruct": {
"label": "Qwen2.5 0.5B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
"TinyLlama/TinyLlama-1.1B-Chat-v1.0": {
"label": "TinyLlama 1.1B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 2048,
},
"Qwen/Qwen2.5-1.5B-Instruct": {
"label": "Qwen2.5 1.5B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
"microsoft/Phi-3.5-mini-instruct": {
"label": "Phi-3.5 mini",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 128000,
},
"microsoft/Phi-3-mini-4k-instruct": {
"label": "Phi-3 mini 4K",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 4096,
},
"Qwen/Qwen2.5-3B-Instruct": {
"label": "Qwen2.5 3B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
"google/gemma-3-1b-it": {
"label": "Gemma-3 1B IT",
"family": "causal-lm", # fixed typo: was "casual-lm"
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
}, # fixed: missing closing brace
"openbmb/MiniCPM5-2B": {
"label": "MiniCPM5 2B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 131072,
},
"constructai/Qwenite3.5-2B": {
"label": "Qwenite 3.5 2B Β· T4 trained reasoning",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
# ββ Added 1β3B models βββββββββββββββββββββββββββββββββββββββββββββββ
"HuggingFaceTB/SmolLM2-1.7B-Instruct": {
"label": "SmolLM2 1.7B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 8192,
},
"google/gemma-2-2b-it": {
"label": "Gemma-2 2B IT",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 8192,
},
"meta-llama/Llama-3.2-1B-Instruct": {
"label": "Llama-3.2 1B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 131072,
},
"meta-llama/Llama-3.2-3B-Instruct": {
"label": "Llama-3.2 3B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 131072,
},
"stabilityai/stablelm-2-1_6b-chat": {
"label": "StableLM-2 1.6B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 4096,
},
"stabilityai/stablelm-zephyr-3b": {
"label": "StableLM Zephyr 3B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 4096,
},
"allenai/OLMo-1B-hf": {
"label": "OLMo 1B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 2048,
},
"HuggingFaceTB/SmolLM-1.7B-Instruct": {
"label": "SmolLM 1.7B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 2048,
},
"google/gemma-2b-it": {
"label": "Gemma 2B IT",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 8192,
},
"Qwen/Qwen2-1.5B-Instruct": {
"label": "Qwen2 1.5B",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
"HuggingFaceTB/SmolLM2-1.7B-Instruct-16k": {
"label": "SmolLM2 1.7B Β· 16K",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 16384,
},
"Qwen/Qwen2.5-1.5B-Instruct-GGUF": {
"label": "Qwen2.5 1.5B GGUF",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
"microsoft/Phi-3-mini-128k-instruct": {
"label": "Phi-3 mini 128K",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 128000,
},
"google/gemma-3-1b-it-GGUF": {
"label": "Gemma-3 1B IT GGUF",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 32768,
},
"meta-llama/Llama-3.2-1B-Instruct-GGUF": {
"label": "Llama-3.2 1B GGUF",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 131072,
},
"meta-llama/Llama-3.2-3B-Instruct-GGUF": {
"label": "Llama-3.2 3B GGUF",
"family": "causal-lm",
"tasks": ["chat", "code", "summarize", "translate", "agent"],
"context": 131072,
},
}
DEFAULT_MODEL = "HuggingFaceTB/SmolLM2-360M-Instruct"
# ββ Task Registry βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
TASK_REGISTRY: Dict[str, Dict[str, Any]] = {
"chat": {
"label": "π¬ Chat",
"description": "Open-ended conversation",
"system_prompt": "You are a friendly, helpful conversational assistant.",
},
"code": {
"label": "π» Code",
"description": "Generate, explain, or debug code",
"system_prompt": (
"You are a senior software engineer. Produce clean, idiomatic, "
"well-commented code. Wrap code in fenced markdown blocks."
),
},
"summarize": {
"label": "π Summarize",
"description": "Condense long text into key points",
"system_prompt": (
"Summarise the user's text in 5β7 bullet points. "
"Be concise and faithful to the source."
),
},
"translate": {
"label": "π Translate",
"description": "Translate text between languages",
"system_prompt": (
"Translate the user's text. If they don't specify a target "
"language, translate to English."
),
},
"agent": {
"label": "π€ Agent",
"description": "Autonomous tool-using agent",
"system_prompt": (
"You are an autonomous agent. Use tools when they help, "
"then give a final answer."
),
},
} |