Initial vLLM agent strategy

This commit is contained in:
2026-07-21 16:04:18 +08:00
commit d17bb21bbb
48 changed files with 3006 additions and 0 deletions

41
app/domain/gpu.py Normal file
View File

@@ -0,0 +1,41 @@
from __future__ import annotations
VLLM_GPU_ALIASES = {
"910b": ["Ascend_910-b3", "Ascend_910-b4"],
"s4000": ["Mthreads_s4000"],
"k100": ["hygon_k100-ai"],
"mrv100": ["Iluvatar_mrv-100"],
"bi100": ["Iluvatar_bi-100"],
"bi150": ["Iluvatar_bi-150"],
"c500": ["MetaX_c-500"],
"mlu370-x4": ["Cambricon_mlu-370-x4"],
"mlu370-x8": ["Cambricon_mlu-370-x8"],
"p800": ["Kunlunxin_p-800"],
"166m": ["Biren_166m"],
"biren166m": ["Biren_166m"], # backward-compatible alias from the old config.py
}
# Sunrise s2 currently uses SGLang in the old config, so vLLM-only v1 skips it.
UNSUPPORTED_VLLM_ALIASES = {"s2"}
def parse_aliases(raw: str | None, defaults: list[str]) -> list[str]:
if not raw:
return defaults
return [item.strip() for item in raw.split(",") if item.strip()]
def expand_gpu_alias(alias: str) -> list[str]:
return VLLM_GPU_ALIASES.get(alias, [])
def expand_gpu_aliases(aliases: list[str]) -> list[tuple[str, str]]:
pairs: list[tuple[str, str]] = []
for alias in aliases:
for gpu_type in expand_gpu_alias(alias):
pairs.append((alias, gpu_type))
return pairs
def is_supported_alias(alias: str) -> bool:
return alias in VLLM_GPU_ALIASES