1. 修改硅基智能模型的名称格式,要求添加"siliconflow-"前缀。
2. 修改硅基智能模型的请求代码: 2.1. 根据文档,提高max_output_token和模型的max_token。 2.2. 简化模型列表,要求自己添加模型。 2.3. 添加支持推理能力的模型。
This commit is contained in:
parent
406abd4fd7
commit
c94839f581
12
config.py
12
config.py
|
|
@ -48,8 +48,8 @@ AVAIL_LLM_MODELS = ["qwen-max", "o1-mini", "o1-mini-2024-09-12", "o1", "o1-2024-
|
|||
"gemini-1.5-pro", "chatglm3", "chatglm4",
|
||||
|
||||
"deepseek-chat", "deepseek-coder", "deepseek-reasoner",
|
||||
"deepseek-ai/DeepSeek-R1","deepseek-ai/DeepSeek-V3",
|
||||
"Qwen/Qwen2.5-32B-Instruct","Qwen/Qwen2.5-14B-Instruct","Qwen/Qwen2.5-7B-Instruct",
|
||||
"siliconflow-deepseek-ai/DeepSeek-R1","siliconflow-deepseek-ai/DeepSeek-V3", "siliconflow-Qwen/QwQ-32B",
|
||||
"siliconflow-Qwen/Qwen2.5-32B-Instruct","siliconflow-Qwen/Qwen2.5-14B-Instruct"
|
||||
"volcengine-deepseek-r1-250120", "volcengine-deepseek-v3-241226",
|
||||
"dashscope-deepseek-r1", "dashscope-deepseek-v3",
|
||||
]
|
||||
|
|
@ -77,10 +77,12 @@ EMBEDDING_MODEL = "text-embedding-3-small"
|
|||
# 使用"one-api-*","vllm-*","ollama-*","openrouter-*"前缀直接使用非标准方式接入的模型,例如
|
||||
# AVAIL_LLM_MODELS = ["one-api-claude-3-sonnet-20240229(max_token=100000)", "ollama-phi3(max_token=4096)","openrouter-openai/gpt-4o-mini","openrouter-openai/chatgpt-4o-latest"]
|
||||
# --- --- --- ---
|
||||
# 硅基智能(Siliconflow) API 可以通过 https://cloud.siliconflow.cn/models 或 https://docs.siliconflow.cn/api-reference/chat-completions/chat-completions 获取模型名称,并放置在AVAIL_LLM_MODELS列表中。
|
||||
# 硅基智能(Siliconflow) API 可以通过 https://cloud.siliconflow.cn/models 或 https://docs.siliconflow.cn/api-reference/chat-completions/chat-completions 获取模型名称
|
||||
# 在模型名称前添加"siliconflow-"前缀,并放置在AVAIL_LLM_MODELS列表中。
|
||||
# AVAIL_LLM_MODELS = [
|
||||
# "deepseek-ai/DeepSeek-R1","deepseek-ai/DeepSeek-V3",
|
||||
# "Qwen/Qwen2.5-32B-Instruct","Qwen/Qwen2.5-14B-Instruct","Qwen/Qwen2.5-7B-Instruct"
|
||||
# "siliconflow-deepseek-ai/DeepSeek-R1","siliconflow-deepseek-ai/DeepSeek-V3", "siliconflow-Qwen/QwQ-32B",
|
||||
# "siliconflow-Qwen/Qwen2.5-32B-Instruct","siliconflow-Qwen/Qwen2.5-14B-Instruct","siliconflow-Qwen/Qwen2.5-7B-Instruct",
|
||||
# "siliconflow-THUDM/GLM-Z1-32B-0414"
|
||||
# ]
|
||||
# --- --- --- ---
|
||||
|
||||
|
|
|
|||
|
|
@ -1343,65 +1343,41 @@ for model in [m for m in AVAIL_LLM_MODELS if m.startswith("openrouter-")]:
|
|||
|
||||
|
||||
# -=-=-=-=-=-=- 硅基智能SiliconFlow在线API -=-=-=-=-=-=-
|
||||
siliconflow_models = [
|
||||
"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","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/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",
|
||||
"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",
|
||||
"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",
|
||||
# 支持推理的模型系列,非完整模型名称
|
||||
inference_model_series = [
|
||||
"THUDM/GLM-Z1", "deepseek-ai/DeepSeek-R1", "Qwen/QwQ-32B"
|
||||
]
|
||||
for model in [m for m in AVAIL_LLM_MODELS if m.startswith("siliconflow-")]:
|
||||
# 模型名称的格式为:
|
||||
# "siliconflow-<model_name>"
|
||||
# 其中:
|
||||
# "siliconflow-" 是前缀(必要),在实际请求中,会将其去掉。
|
||||
# "deepseek-ai/DeepSeek-R1" 是硅基智能提供的模型名(必要)。
|
||||
|
||||
if any(item in siliconflow_models for item in AVAIL_LLM_MODELS):
|
||||
try:
|
||||
siliconflow_noui, siliconflow_ui = get_predict_function(
|
||||
api_key_conf_name="SILICONFLOW_API_KEY",
|
||||
max_output_token=4096,
|
||||
max_output_token=8192,
|
||||
disable_proxy=False,
|
||||
# 去除前缀
|
||||
model_remove_prefix = ["siliconflow-"]
|
||||
)
|
||||
# 判断是否具有推理能力
|
||||
enable_reasoning = any(item in model for item in inference_model_series)
|
||||
model_info.update(
|
||||
{
|
||||
model: {
|
||||
"fn_with_ui": siliconflow_ui,
|
||||
"fn_without_ui": siliconflow_noui,
|
||||
"endpoint": siliconflow_endpoint,
|
||||
"can_multi_thread": True,
|
||||
"max_token": 32000,
|
||||
"tokenizer": tokenizer_gpt35,
|
||||
"token_cnt": get_token_num_gpt35,
|
||||
"enable_reasoning": enable_reasoning,
|
||||
},
|
||||
}
|
||||
)
|
||||
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())
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue