x
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
- `services.openai.host` / `services.openai.port`:OpenAI 协议服务监听地址与端口(默认 `0.0.0.0:8001`)
|
||||
- `public_model_name`:对外固定模型名,切换底层模型时可保持调用方参数不变
|
||||
- `default_enable_thinking`:服务端默认思考开关,默认 `false`(即调用方不传时也关闭)
|
||||
- `reasoning_enabled`:是否启用推理解析器参数注入,默认 `false`
|
||||
- `api_key`:OpenAI 接口访问密钥
|
||||
- `tensor_parallel_size`:张量并行数,双卡建议 `2`
|
||||
@@ -93,6 +94,7 @@ curl -X POST "http://localhost:8001/v1/chat/completions" \
|
||||
- API Key 使用 `config.json` 中 `api_key`
|
||||
- 模型名固定使用 `config.json` 中 `public_model_name`(默认 `Qwen_local_model`)
|
||||
- 思考模式按请求控制:`chat_template_kwargs.enable_thinking=false/true`
|
||||
- 若调用方未传 `chat_template_kwargs.enable_thinking`,服务端使用 `default_enable_thinking` 兜底
|
||||
- 仅当模型需要推理解析器时,再将 `config.json` 中 `reasoning_enabled` 设为 `true`
|
||||
- 若使用工具调用,`config.json` 中应配置 `tool_call_parser` 与 `enable_auto_tool_choice`
|
||||
- 服务强制离线模式,不会回退到 Hugging Face 远程下载
|
||||
|
||||
@@ -19,6 +19,7 @@ class Settings(BaseModel):
|
||||
openai_port: int = 8001
|
||||
vllm_openai_internal_url: str = "http://127.0.0.1:8001/v1"
|
||||
public_model_name: str = "Qwen_local_model"
|
||||
default_enable_thinking: bool = False
|
||||
reasoning_enabled: bool = False
|
||||
model_root: str = "/opt/model"
|
||||
offline_mode: bool = True
|
||||
@@ -49,6 +50,7 @@ def get_settings() -> Settings:
|
||||
openai_port=runtime["openai_port"],
|
||||
vllm_openai_internal_url=runtime["vllm_openai_internal_url"],
|
||||
public_model_name=runtime["public_model_name"],
|
||||
default_enable_thinking=runtime["default_enable_thinking"],
|
||||
reasoning_enabled=runtime["reasoning_enabled"],
|
||||
model_root=runtime["model_root"],
|
||||
offline_mode=runtime["offline_mode"],
|
||||
|
||||
@@ -74,6 +74,7 @@ def resolve_runtime_settings(content: dict[str, Any]) -> dict[str, Any]:
|
||||
"openai_port": openai_port,
|
||||
"vllm_openai_internal_url": internal_url.rstrip("/"),
|
||||
"public_model_name": _to_str(content.get("public_model_name"), "Qwen_local_model"),
|
||||
"default_enable_thinking": _to_bool(content.get("default_enable_thinking"), False),
|
||||
"api_key": str(content.get("api_key", "")).strip() or None,
|
||||
"reasoning_enabled": _to_bool(content.get("reasoning_enabled"), False),
|
||||
"tensor_parallel_size": _to_int(content.get("tensor_parallel_size"), 2),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -19,6 +20,7 @@ def build_command() -> list[str]:
|
||||
host = str(runtime["openai_host"])
|
||||
port = str(runtime["openai_port"])
|
||||
public_model_name = str(runtime["public_model_name"]).strip()
|
||||
default_enable_thinking = bool(runtime["default_enable_thinking"])
|
||||
reasoning_enabled = bool(runtime["reasoning_enabled"])
|
||||
api_key = runtime["api_key"] or ""
|
||||
dtype = str(updates["dtype"] or runtime["dtype"])
|
||||
@@ -56,6 +58,12 @@ def build_command() -> list[str]:
|
||||
cmd.append("--enable-auto-tool-choice")
|
||||
if updates["tool_call_parser"]:
|
||||
cmd.extend(["--tool-call-parser", str(updates["tool_call_parser"])])
|
||||
cmd.extend(
|
||||
[
|
||||
"--default-chat-template-kwargs",
|
||||
json.dumps({"enable_thinking": default_enable_thinking}),
|
||||
]
|
||||
)
|
||||
if reasoning_enabled and reasoning_parser:
|
||||
cmd.extend(["--reasoning-parser", reasoning_parser])
|
||||
if quantization:
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
}
|
||||
},
|
||||
"public_model_name": "Qwen_local_model",
|
||||
"default_enable_thinking": false,
|
||||
"reasoning_enabled": false,
|
||||
"api_key": "sk-szcjw",
|
||||
"tensor_parallel_size": 2,
|
||||
|
||||
Reference in New Issue
Block a user