refactor(request_llms): 重构硅基智能模型配置

- 更新 siliconflow_models 列表,添加新模型并调整模型顺序
- 优化模型信息更新逻辑,使用循环替代重复代码
- 区分 DeepSeek-R1 系列模型,添加 enable_reasoning 字段
- 移除未使用的模型信息字段,简化配置结构
This commit is contained in:
Samon Yu 2025-02-15 18:38:51 +08:00
parent f3f5f5f95d
commit 4ce1a66f70
1 changed files with 44 additions and 386 deletions

View File

@ -1257,24 +1257,27 @@ for model in [m for m in AVAIL_LLM_MODELS if m.startswith("openrouter-")]:
# -=-=-=-=-=-=- 硅基智能SiliconFlow在线API -=-=-=-=-=-=-
siliconflow_models = [
"deepseek-ai/DeepSeek-R1","deepseek-ai/DeepSeek-V3",
"deepseek-ai/DeepSeek-R1-Distill-Llama-70B","deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-32B","deepseek-ai/DeepSeek-R1-Distill-Qwen-14B","deepseek-ai/DeepSeek-R1-Distill-Qwen-7B","deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
"deepseek-ai/DeepSeek-R1", "Pro/deepseek-ai/DeepSeek-R1", "deepseek-ai/DeepSeek-V3", "Pro/deepseek-ai/DeepSeek-V3",
"deepseek-ai/DeepSeek-R1-Distill-Llama-70B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
"deepseek-ai/DeepSeek-R1-Distill-Llama-8B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
"Pro/deepseek-ai/DeepSeek-R1-Distill-Llama-8B","Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B","Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
"meta-llama/Llama-3.3-70B-Instruct",
"deepseek-ai/DeepSeek-V2.5",
"meta-llama/Llama-3.3-70B-Instruct","AIDC-AI/Marco-o1","deepseek-ai/DeepSeek-V2.5",
"Qwen/Qwen2.5-72B-Instruct-128K","Qwen/Qwen2.5-72B-Instruct","Qwen/Qwen2.5-32B-Instruct","Qwen/Qwen2.5-14B-Instruct","Qwen/Qwen2.5-7B-Instruct",
"Qwen/Qwen2.5-Coder-32B-Instruct","Qwen/Qwen2.5-Coder-7B-Instruct",
"Qwen/QwQ-32B-Preview",
"Qwen/Qwen2-7B-Instruct","Qwen/Qwen2-1.5B-Instruct","Qwen/QwQ-32B-Preview",
"TeleAI/TeleChat2",
"01-ai/Yi-1.5-34B-Chat-16K","01-ai/Yi-1.5-9B-Chat-16K","01-ai/Yi-1.5-6B-Chat",
"THUDM/glm-4-9b-chat",
"Vendor-A/Qwen/Qwen2.5-72B-Instruct",
"google/gemma-2-27b-it","google/gemma-2-9b-it","Pro/google/gemma-2-9b-it",
"THUDM/glm-4-9b-chat","Vendor-A/Qwen/Qwen2.5-72B-Instruct",
"internlm/internlm2_5-7b-chat","internlm/internlm2_5-20b-chat",
"nvidia/Llama-3.1-Nemotron-70B-Instruct",
"meta-llama/Meta-Llama-3.1-405B-Instruct","meta-llama/Meta-Llama-3.1-70B-Instruct","meta-llama/Meta-Llama-3.1-8B-Instruct",
"google/gemma-2-27b-it","google/gemma-2-9b-it",
"Pro/Qwen/Qwen2.5-7B-Instruct","Pro/Qwen/Qwen2-7B-Instruct","Pro/Qwen/Qwen2-1.5B-Instruct",
"THUDM/glm-4-9b-chat","Pro/THUDM/chatglm3-6b","Pro/THUDM/glm-4-9b-chat",
"meta-llama/Meta-Llama-3.1-405B-Instruct","meta-llama/Meta-Llama-3.1-70B-Instruct","meta-llama/Meta-Llama-3.1-8B-Instruct"
"Pro/THUDM/chatglm3-6b","Pro/THUDM/glm-4-9b-chat",
"Pro/meta-llama/Meta-Llama-3.1-8B-Instruct",
"Pro/google/gemma-2-9b-it",
]
if any(item in siliconflow_models for item in AVAIL_LLM_MODELS):
try:
siliconflow_noui, siliconflow_ui = get_predict_function(
@ -1282,381 +1285,36 @@ if any(item in siliconflow_models for item in AVAIL_LLM_MODELS):
max_output_token=4096,
disable_proxy=False,
)
model_info.update(
{
"deepseek-ai/DeepSeek-R1": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"deepseek-ai/DeepSeek-V3": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"deepseek-ai/DeepSeek-R1-Distill-Llama-70B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"eepseek-ai/DeepSeek-R1-Distill-Qwen-32B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"deepseek-ai/DeepSeek-R1-Distill-Qwen-14B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"deepseek-ai/DeepSeek-R1-Distill-Llama-8B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"deepseek-ai/DeepSeek-R1-Distill-Qwen-7B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"Pro/deepseek-ai/DeepSeek-R1-Distill-Llama-8B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
"meta-llama/Llama-3.3-70B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"deepseek-ai/DeepSeek-V2.5": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-72B-Instruct-128K": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-72B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-32B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-14B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-7B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-Coder-32B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/Qwen2.5-Coder-7B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Qwen/QwQ-32B-Preview": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"TeleAI/TeleChat2": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"01-ai/Yi-1.5-34B-Chat-16K": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"01-ai/Yi-1.5-9B-Chat-16K": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"01-ai/Yi-1.5-6B-Chat": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"THUDM/glm-4-9b-chat": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Vendor-A/Qwen/Qwen2.5-72B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"internlm/internlm2_5-7b-chat": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"internlm/internlm2_5-20b-chat": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"meta-llama/Meta-Llama-3.1-405B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"meta-llama/Meta-Llama-3.1-70B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"meta-llama/Meta-Llama-3.1-8B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"google/gemma-2-27b-it": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"google/gemma-2-9b-it": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Pro/Qwen/Qwen2.5-7B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Pro/Qwen/Qwen2-7B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Pro/Qwen/Qwen2-1.5B-Instruct": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Pro/THUDM/chatglm3-6b": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Pro/THUDM/glm-4-9b-chat": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
"Pro/google/gemma-2-9b-it": {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
}
)
for item in (set(siliconflow_models) & set(AVAIL_LLM_MODELS)):
if "DeepSeek-R1" in item:
model_info.update(
{
item: {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
"enable_reasoning": True,
},
}
)
else:
model_info.update(
{
item: {
"fn_with_ui": siliconflow_ui,
"fn_without_ui": siliconflow_noui,
"endpoint": siliconflow_endpoint,
"can_multi_thread": True,
"max_token": 8000,
"tokenizer": tokenizer_gpt35,
"token_cnt": get_token_num_gpt35,
},
}
)
except:
logger.error(trimmed_format_exc())