快速开始¶
安装¶
需要 Python 3.11 或更新版本。运行时依赖为 fastapi、httpx、pydantic 和
uvicorn[standard]。
配置¶
配置全部是 JEV_ 前缀的环境变量,没有配置文件。不设置就用默认值,空环境下也能直接启
动。想集中管理就用模板:
真正要改的是 JEV_BACKEND_BASE_URL——你的 OpenAI 兼容服务的地址:
全部变量、默认值和取值范围见配置参考。监听地址取
JEV_SERVER_HOST:JEV_SERVER_PORT(默认 0.0.0.0:8000)。
运行¶
已经 export 好的话,等价的控制台脚本是 jev-gateway。配置也可以直接写在命令行上,不建文件:
确认它活着:
发一次决策¶
curl -X POST http://127.0.0.1:8000/v1/systemone \
-H 'content-type: application/json' \
-d '{
"model": "jev-latest",
"state": {"error_rate": 0.42, "p99_latency_ms": 3100, "recent_deploy": true},
"questions": {
"is_healthy": {"type": "noul", "instructions": "Is the service healthy?"},
"severity": {
"type": "choice",
"instructions": "Pick the incident severity.",
"criteria": {"sev1": "a whole region is down", "sev2": "error_rate is at least 0.05", "sev3": "below 0.05 and users are unaffected"}
},
"urgency": {
"type": "score",
"instructions": "How urgent is the response?",
"criteria": ["can wait", "today", "right now"]
}
}
}'
{
"model": "Qwen3-4B-Instruct",
"answers": {
"is_healthy": {"type": "noul", "noul": 0.0314},
"severity": {
"type": "choice",
"choice": "sev2",
"probabilities": {"sev1": 0.024, "sev2": 0.921, "sev3": 0.055}
},
"urgency": {
"type": "score",
"score": 1.86,
"legend": {"0": "can wait", "1": "today", "2": "right now"},
"probabilities": {"0": 0.041, "1": 0.058, "2": 0.901}
}
}
}
一次请求,三个决策,三个输出 token。
Docker¶
每个模板都通过 environment: 传配置,不挂载任何文件。改后端地址就改那个变量;改模型、
上下文长度或端口,直接编辑 command 段。启动后端栈前先把 .gguf 放进 ./models。视觉模型
还需要投影权重:在 llama-server 命令里加 --mmproj /models/mmproj.gguf,并用
GET /props 确认 modalities.vision 为 true。
端到端验证¶
curl -s http://127.0.0.1:8000/healthz
curl -s http://127.0.0.1:8000/readyz
curl -s http://127.0.0.1:8000/v1/systemone \
-H 'content-type: application/json' \
-d '{
"model": "jev-latest",
"state": {"error_rate": 0.31, "p99_latency_ms": 4100},
"questions": {
"severity": {
"type": "choice",
"instructions": "Pick the severity.",
"criteria": {
"sev1": "error_rate >= 0.20",
"sev2": "error_rate >= 0.05 but < 0.20",
"sev3": "error_rate < 0.05"
}
}
}
}'
/healthz 证明进程活着,/readyz 证明后端已就绪并返回它加载的模型名,最后一个请求
会返回官方结构的 model、answers 和 usage。图片请求使用 assets 和引用字符串,见
图片指南。
vLLM 与 SGLang
仓库里只随附 llama.cpp 那套 compose。要对接 vLLM 或 SGLang,把 backend.base_url
指过去,并把 backend.model 设成服务启动时用的名字。见后端。