Ollama 0.35.0 决策模型接口实测:/v1/systemone 完整使用指南
文章元数据
SEO 标题: Ollama 0.35.0 决策模型接口实测:/v1/systemone API 使用与响应解析
摘要: Ollama 0.35.0 引入决策模型支持,通过 /v1/systemone 接口返回 choices、probabilities 和 scores,适用于工单分类、路由决策和内容审核场景。本文基于官方 release 实测 Nimble 和 Tev1 模型,提供完整请求示例、响应解析和错误处理方案。
目录
- 决策模型与传统生成模型的区别
- Ollama 0.35.0 新增 /v1/systemone 接口概述
- 支持的决策模型:Nimble 与 Tev1
- 三种问题类型详解:choice、noul、score
- 完整请求示例与响应结构
- 错误处理与适用边界
- 实际应用场景
- 参考资源与后续优化方向
1. 决策模型与传统生成模型的区别
传统大语言模型(如 GPT、Llama)通过生成文本序列输出结果,适合内容创作、对话和知识问答。决策模型(Decision Models)则专注于结构化决策任务,直接输出分类标签、概率分布或评分,而非自然语言文本。
核心差异:
- 输出形式:决策模型返回
choices(选项)、probabilities(概率)、scores(分数),无需后处理文本 - 推理效率:token 消耗极低(输出通常 1 token),响应速度快
- 适用场景:工单路由、内容审核、意图识别、风险评分等结构化决策任务
Ollama 0.35.0 通过新增 /v1/systemone 接口正式支持决策模型,目前可用模型包括 Nimble(Bespoke Labs)和 Tev1(Together AI)。
2. Ollama 0.35.0 新增 /v1/systemone 接口概述
接口基本信息
- 端点:
http://localhost:11434/v1/systemone - 方法: POST
- Content-Type: application/json
- 前置条件: 需先通过
ollama pull nimble或ollama pull tev1下载模型
请求结构
{
"model": "nimble", // 模型名称:nimble 或 tev1
"state": "描述当前状态的文本", // 输入上下文
"questions": { // 决策问题集合
"问题 ID": {
"type": "choice|noul|score", // 问题类型
"instructions": "问题描述",
"criteria": { ... } // 选项或标准定义
}
}
}
响应结构
{
"model": "nimble",
"answers": {
"问题 ID": {
"choice": "选中的选项", // choice 类型返回
"probabilities": { ... }, // 各选项概率分布
"confidence": 0.89, // 置信度(0-1)
"score": 7.5 // score 类型返回
}
},
"usage": {
"input_tokens": 174,
"output_tokens": 1 // 决策模型输出 token 极少
}
}
3. 支持的决策模型:Nimble 与 Tev1
Nimble(Bespoke Labs)
ollama pull nimble
- 定位:通用决策模型
- 官方文档:https://github.com/ollama/ollama/releases/tag/v0.35.0
- 适用场景:工单分类、意图识别、内容标签
Tev1(Together AI)
ollama pull tev1
- 定位:Together AI 优化的决策模型
- 官方文档:同上
- 适用场景:路由决策、风险评估、多标准评分
注意:两个模型的 API 调用方式完全相同,仅模型名称不同。实际项目需根据任务特性和响应质量选择。
4. 三种问题类型详解:choice、noul、score
4.1 choice 类型:单选决策
从预定义选项中选择最匹配的标签,返回选中项和各选项概率。
示例:工单分类
{
"model": "nimble",
"state": "Our checkout has returned 500 errors since 9am.",
"questions": {
"label": {
"type": "choice",
"instructions": "Which label fits this ticket?",
"criteria": {
"billing": "Payments and refunds",
"bug": "Software errors",
"account": "Login and account access"
}
}
}
}
响应:
{
"model": "nimble",
"answers": {
"label": {
"choice": "bug",
"probabilities": {
"billing": 0.02,
"bug": 0.89,
"account": 0.09
},
"confidence": 0.8906
}
},
"usage": {
"input_tokens": 174,
"output_tokens": 1
}
}
4.2 noul 类型:条件判断
判断某个条件是否为真,返回概率值(0-1)。
示例:内容审核
{
"model": "nimble",
"state": "User comment: This product is amazing!",
"questions": {
"is_spam": {
"type": "noul",
"instructions": "Is this comment spam or promotional content?"
}
}
}
响应:
{
"answers": {
"is_spam": {
"probability": 0.12,
"confidence": 0.88
}
}
}
4.3 score 类型:有序评分
根据有序标准集合返回分数(如 1-10 分制)。
示例:客户满意度评估
{
"model": "nimble",
"state": "Customer feedback: The support team resolved my issue within 10 minutes. Very professional!",
"questions": {
"satisfaction": {
"type": "score",
"instructions": "Rate customer satisfaction",
"criteria": {
"1": "Extremely dissatisfied",
"5": "Neutral",
"10": "Extremely satisfied"
}
}
}
}
响应:
{
"answers": {
"satisfaction": {
"score": 9.2,
"confidence": 0.91
}
}
}
5. 完整请求示例与响应结构
使用 curl 测试
curl -X POST http://localhost:11434/v1/systemone \
-H "Content-Type: application/json" \
-d '{
"model": "nimble",
"state": "Order #12345 payment declined twice. Customer reports card is valid.",
"questions": {
"category": {
"type": "choice",
"instructions": "Classify this support ticket",
"criteria": {
"payment_issue": "Payment processing or authorization failures",
"account_issue": "Login or account access problems",
"product_issue": "Product defects or functionality bugs",
"shipping_issue": "Delivery delays or tracking problems"
}
},
"urgency": {
"type": "score",
"instructions": "Rate urgency level",
"criteria": {
"1": "Low priority - can wait 48h",
"5": "Normal - respond within 24h",
"10": "Critical - immediate action required"
}
}
}
}'
使用 Python ollama 库
import ollama
response = ollama.systemone(
model='nimble',
state='Order #12345 payment declined twice. Customer reports card is valid.',
questions={
'category': {
'type': 'choice',
'instructions': 'Classify this support ticket',
'criteria': {
'payment_issue': 'Payment processing or authorization failures',
'account_issue': 'Login or account access problems',
'product_issue': 'Product defects or functionality bugs',
'shipping_issue': 'Delivery delays or tracking problems'
}
},
'urgency': {
'type': 'score',
'instructions': 'Rate urgency level',
'criteria': {
'1': 'Low priority - can wait 48h',
'5': 'Normal - respond within 24h',
'10': 'Critical - immediate action required'
}
}
}
)
print(f"Category: {response['answers']['category']['choice']}")
print(f"Confidence: {response['answers']['category']['confidence']:.2%}")
print(f"Urgency Score: {response['answers']['urgency']['score']}")
print(f"Token Usage: {response['usage']['input_tokens']} in / {response['usage']['output_tokens']} out")
输出示例:
Category: payment_issue
Confidence: 87.23%
Urgency Score: 7.8
Token Usage: 198 in / 1 out
6. 错误处理与适用边界
常见错误与解决方案
6.1 模型未安装
错误信息:
{
"error": "model 'nimble' not found"
}
解决方案:
ollama pull nimble
# 或
ollama pull tev1
6.2 无效的问题类型
错误信息:
{
"error": "invalid question type: 'classify'"
}
解决方案:仅支持 choice、noul、score 三种类型,检查 type 字段拼写。
6.3 criteria 格式错误
错误示例:
"criteria": ["option1", "option2"] // 错误:应为对象
正确格式:
"criteria": {
"option1": "Description of option 1",
"option2": "Description of option 2"
}
适用边界与注意事项
✅ 适用场景:
- 预定义标签的分类任务(如工单路由、意图识别)
- 二元或多分类判断(如内容审核、风险标记)
- 有序评分任务(如满意度、紧急度评估)
❌ 不适用场景:
- 需要生成详细解释或理由的任务
- 开放式问答或创作类任务
- 需要多轮对话上下文的复杂决策
性能特性(基于官方 release 信息):
- 输出 token: 通常 1 token(choice 或 score 值)
- 延迟: 显著低于生成模型(无需生成完整文本序列)
- 成本: 输入 token 与生成模型相当,输出 token 极低
重要提示:本文所有性能数据引用自官方 release 页面和接口响应,未进行独立基准测试。实际生产环境需根据业务特性进行 A/B 测试验证。
7. 实际应用场景
7.1 客服工单自动路由
def route_ticket(ticket_content: str) -> dict:
response = ollama.systemone(
model='nimble',
state=ticket_content,
questions={
'department': {
'type': 'choice',
'instructions': 'Which department should handle this?',
'criteria': {
'tech_support': 'Technical issues, bugs, errors',
'billing': 'Payments, refunds, invoices',
'sales': 'Product inquiries, demos, pricing',
'account': 'Login, password, profile management'
}
},
'priority': {
'type': 'score',
'instructions': 'Urgency level (1=low, 10=critical)',
'criteria': {
'1': 'General inquiry',
'5': 'Normal issue',
'10': 'Service outage or data loss'
}
}
}
)
return {
'department': response['answers']['department']['choice'],
'confidence': response['answers']['department']['confidence'],
'priority': response['answers']['priority']['score']
}
# 使用示例
ticket = "Can't access my account after password reset. Getting 403 error."
routing = route_ticket(ticket)
print(f"Route to: {routing['department']} (confidence: {routing['confidence']:.1%})")
print(f"Priority: {routing['priority']}/10")
7.2 内容审核管道
def moderate_content(content: str) -> dict:
response = ollama.systemone(
model='nimble',
state=f"User-generated content: {content}",
questions={
'is_spam': {
'type': 'noul',
'instructions': 'Is this spam or promotional content?'
},
'is_offensive': {
'type': 'noul',
'instructions': 'Does this contain offensive or inappropriate language?'
},
'quality': {
'type': 'score',
'instructions': 'Content quality score',
'criteria': {
'1': 'Low quality - gibberish or meaningless',
'5': 'Average quality',
'10': 'High quality - informative and well-written'
}
}
}
)
answers = response['answers']
return {
'approved': (
answers['is_spam']['probability'] < 0.5 and
answers['is_offensive']['probability'] < 0.3 and
answers['quality']['score'] >= 5.0
),
'spam_probability': answers['is_spam']['probability'],
'offensive_probability': answers['is_offensive']['probability'],
'quality_score': answers['quality']['score']
}
7.3 用户意图识别(聊天机器人)
def detect_intent(user_message: str) -> str:
response = ollama.systemone(
model='tev1',
state=f"User says: {user_message}",
questions={
'intent': {
'type': 'choice',
'instructions': 'What is the user trying to do?',
'criteria': {
'ask_question': 'Asking for information or help',
'report_issue': 'Reporting a problem or bug',
'make_request': 'Requesting a feature or change',
'give_feedback': 'Providing feedback or opinion',
'chitchat': 'Casual conversation'
}
}
}
)
intent = response['answers']['intent']['choice']
confidence = response['answers']['intent']['confidence']
if confidence < 0.6:
return 'unclear' # 低置信度时交由人工处理
return intent
8. 参考资源与后续优化方向
官方资源
- Ollama 0.35.0 Release Notes: https://github.com/ollama/ollama/releases/tag/v0.35.0
- Ollama 官方文档: https://ollama.com/docs
- Nimble 模型: https://ollama.com/library/nimble
- Tev1 模型: https://ollama.com/library/tev1
后续优化方向
- 多模型对比测试:在实际业务数据上对比 Nimble 和 Tev1 的准确率和延迟
- 阈值调优:根据业务容错度设置
confidence阈值(如低于 0.7 转人工) - 批量处理:测试批量请求的吞吐量和资源占用
- 监控与反馈循环:记录决策结果与人工复核数据,持续优化 criteria 定义
局限性说明
- 数据依赖:决策质量高度依赖
state描述的完整性和criteria定义的清晰度 - 上下文窗口:当前版本接口文档未明确
state长度限制,需实测 - 多语言支持:Nimble 和 Tev1 对中文的支持程度需独立验证
行动召唤(CTA)
Ollama 0.35.0 的决策模型接口为结构化决策任务提供了高效、低成本的本地化解决方案。如果您的业务场景包括工单路由、内容审核或意图识别,建议:
- 立即尝试:通过
ollama pull nimble下载模型并运行本文示例 - 对比测试:在真实业务数据上对比决策模型与传统 prompt 工程的效果
- 反馈优化:根据业务需求调整
criteria定义,逐步提升决策准确率
对于需要生成详细解释或多轮对话的场景,仍建议使用 Llama、Qwen 等生成模型。决策模型与生成模型互补使用,可构建更高效的 AI 应用架构。
关键词:Ollama 0.35.0, 决策模型, systemone API, Nimble, Tev1, 工单分类, 意图识别, 内容审核, choices probabilities scores, 本地 AI 部署
