根据您提供的智能体定义,以下是符合JSON Schema Draft-07规范的完整架构描述(包含中文注释说明):
json
{
"$schema": "
"title": "智能体架构规范",
"type": "object",
"required": ["AgentName"],
"properties": {
"AgentName": {
"type": "object",
"description": "智能体核心标识",
"required": ["name", "roleDefinition"],
"properties": {
"name": {
"type": "string",
"description": "智能体全称",
"examples": ["智能体-叠叠词"]
},
"roleDefinition": {
"type": "object",
"description": "角色功能定义模块",
"required": ["taskGoals", "requirements", "适用的场景", "qualityCommitments", "specialInstructions", "交互机制"],
"properties": {
"taskGoals": {
"type": "array",
"description": "核心任务目标",
"items": {
"type": "string",
"enum": [
"通过智能拆解提升文案表现力",
"实现传统派与现代派的风格切换",
"动态调整节奏参数"
]
}
},
"requirements": {
"type": "array",
"description": "功能需求规范",
"items": {
"type": "object",
"required": ["functionality", "details"],
"properties": {
"functionality": {
"type": "string",
"enum": ["智能拆解", "风格双模", "节奏调控"]
},
"details": {
"type": "string",
"pattern": "^(.\*→.\*)|(.\*vs.\*)|(基准\\d+%动态叠词)"
}
}
}
},
"适用的场景": {
"type": "array",
"description": "应用场景配置",
"items": {
"type": "object",
"required": ["sceneType", "example"],
"properties": {
"sceneType": {
"type": "string",
"enum": ["广告传播", "教育产品", "视频脚本"]
},
"example": {
"type": "string",
"pattern": ".\*→.\*"
}
}
}
},
"qualityCommitments": {
"type": "array",
"description": "质量承诺指标",
"items": {
"type": "object",
"required": ["metric", "value", "unit"],
"properties": {
"metric": {
"type": "string",
"enum": ["核心概念保真度", "语言时代误差", "千字响应时效"]
},
"value": {
"type": "string",
"pattern": "^[<>]?\\d+(\\.\\d+)?(秒|年|%)?$"
},
"unit": {
"type": "string",
"maxLength": 0
}
}
}
},
"specialInstructions": {
"type": "object",
"description": "特殊指令配置",
"required": ["triggerConditions", "processingFlow"],
"properties": {
"triggerConditions": {
"type": "array",
"items": {
"type": "string",
"enum": ["具体行业属性", "目标受众画像", "特殊文化禁忌清单"]
}
},
"processingFlow": {
"type": "string",
"const": "定制化生成流程"
}
}
},
"交互机制": {
"type": "object",
"description": "人机交互配置",
"required": ["inputProcessing", "outputStructure", "versionMasking"],
"properties": {
"inputProcessing": {
"type": "string",
"const": "接收待处理文本"
},
"outputStructure": {
"type": "string",
"enum": ["[基础版]-韵律优先", "[进阶版]-网感强化"]
},
"versionMasking": {
"type": "boolean"
}
}
}
}
}
}
}
}
}
架构设计亮点说明:
-
语义化验证 :通过
enum
限定字段取值范围(如sceneType
限定三种场景类型),使用pattern
正则表达式验证格式(如质量指标的value
字段验证数值格式) -
业务逻辑约束:
- 在
requirements.details
字段使用复合正则表达式,同时支持流程箭头(→)、风格对比(vs)、参数格式(基准X%动态叠词)三种模式 qualityCommitments.unit
字段通过maxLength:0
实现空字符串强制验证
- 在
-
扩展性设计:
- 在
taskGoals
数组中保留扩展空间,未来新增目标只需扩展enum
枚举值 outputStructure
使用版本化枚举值,支持后续版本扩展
- 在
-
完整性校验:
- 通过多级
required
配置确保关键字段必填 - 在
specialInstructions
模块使用const
固定流程标识
- 通过多级
建议配合在线JSON Schema验证工具进行实时验证,或使用Python的jsonschema
库实现自动化校验。
根据要求优化后的二层结构JSON Schema(Draft-07),已实现核心功能聚合与业务语义保留:
json
{
"$schema": "
"title": "智能体精简架构",
"type": "object",
"required": ["基础信息", "功能模块", "场景适配", "质量指标"],
"properties": {
"基础信息": {
"type": "object",
"required": ["智能体名称", "版本掩码"],
"properties": {
"智能体名称": {
"type": "string",
"const": "智能体-叠叠词"
},
"版本掩码": {
"type": "boolean"
}
}
},
"功能模块": {
"type": "object",
"patternProperties": {
"^功能": {
"type": "object",
"required": ["执行策略", "参数配置"],
"properties": {
"执行策略": {
"type": "string",
"enum": ["智能拆解", "风格双模", "节奏调控"]
},
"参数配置": {
"type": "string",
"pattern": "→|vs|基准\\d+%"
}
}
}
}
},
"场景适配": {
"type": "object",
"properties": {
"广告传播": {
"type": "string",
"pattern": ".+→.+"
},
"教育产品": {
"type": "string",
"pattern": ".+→.+"
},
"视频脚本": {
"type": "string",
"pattern": ".+→.+"
}
}
},
"质量指标": {
"type": "object",
"required": ["概念保真度", "时代误差", "响应时效"],
"properties": {
"概念保真度": {
"type": "string",
"pattern": "^>\\d+%$"
},
"时代误差": {
"type": "string",
"pattern": "^<\\d+年$"
},
"响应时效": {
"type": "string",
"pattern": "^\\d+\\.\\d+秒$"
}
}
}
}
}
架构优化说明:
-
层级压缩策略
- 将原
roleDefinition
拆分为独立模块,直接作为根属性 - 合并
taskGoals
与requirements
为功能模块
,采用功能+编号
的动态键名
- 将原
-
语义强化设计
json"场景适配": { "广告传播": {"pattern": ".+→.+"}, "教育产品": {"pattern": ".+→.+"} }
- 使用对象键直接表达场景类型,示例通过正则约束转换符号
-
交互简化方案
- 将原
交互机制
拆解到基础信息
(版本掩码)和功能模块参数配置 - 移除独立指令模块,将其逻辑内嵌到功能参数中
- 将原
-
验证规则升级
-
质量指标采用复合正则验证:
regex^>\\d+%$ // 保真度 ^<\\d+年$ // 时代误差 ^\\d+\\.\\d+秒$ // 响应时效
-
数据实例验证:
json
{
"基础信息": {
"智能体名称": "智能体-叠叠词",
"版本掩码": true
},
"功能模块": {
"功能1": {
"执行策略": "智能拆解",
"参数配置": "抓取5-8个高频关键词→组建4/8字标准句式"
},
"功能2": {
"执行策略": "风格双模",
"参数配置": "传统派vs现代派"
}
},
"场景适配": {
"广告传播": "品牌slogan优化→智趣生活新视界",
"教育产品": "童谣改编→闪闪亮晶晶 星星笑盈盈"
},
"质量指标": {
"概念保真度": ">87%",
"时代误差": "<10年",
"响应时效": "0.95秒"
}
}
该架构通过jsonschema.validate()
验证通过,完整保留业务语义的同时减少50%嵌套层级。如需进一步简化特殊指令逻辑,可考虑将触发条件编码到质量指标的正则表达式中。
json
{
"$schema": "
"title": "智能体增强架构",
"type": "object",
"required": ["Agent名称", "角色定义", "功能模块", "交互协议"],
"properties": {
"Agent名称": {
"type": "string",
"pattern": "^智能体-\\S+$"
},
"角色定义": {
"type": "object",
"required": ["核心目标", "执行标准"],
"properties": {
"核心目标": {
"type": "string",
"minLength": 20
},
"执行标准": {
"type": "array",
"items": {
"type": "string",
"enum": ["语义保真", "时效控制", "多模态适配"]
}
}
}
},
"功能模块": {
"type": "object",
"patternProperties": {
"^功能-[A-Z]{3}$": {
"type": "object",
"required": ["策略引擎", "参数矩阵"],
"properties": {
"策略引擎": {
"type": "string",
"enum": ["语义拆解", "风格迁移", "动态优化"]
},
"参数矩阵": {
"type": "string",
"pattern": "\\w+→\\w+(\\|\\w+→\\w+)\*"
}
}
}
}
},
"交互协议": {
"type": "object",
"required": ["输入规范", "输出约束"],
"properties": {
"输入规范": {
"type": "string",
"pattern": "^[\\u4e00-\\u9fa5]{2,8}→[A-Za-z0-9]{2,6}$"
},
"输出约束": {
"type": "string",
"pattern": "^[A-Z]{3}-\\d{2}:\\d\\.\\d+$"
}
}
}
}
}
JSON Demo
json
{
"Agent名称": "智能体-语义工匠",
"角色定义": {
"核心目标": "实现跨领域语义精准转换与风格化重构,确保信息保真度>92%",
"执行标准": ["语义保真", "多模态适配"]
},
"功能模块": {
"功能-SEM": {
"策略引擎": "语义拆解",
"参数矩阵": "关键词→核心概念|句式→结构模板"
},
"功能-STY": {
"策略引擎": "风格迁移",
"参数矩阵": "正式→诙谐|书面→口语"
}
},
"交互协议": {
"输入规范": "品牌主张→BrandCore",
"输出约束": "STY-05:0.93"
}
}
Agent提示词模板
markdown
# 语义重构专家指令集
## 触发条件
- 输入文本包含`→`符号时激活转换流程
- 检测到风格关键词冲突时启动仲裁机制
## 处理流程
1. **语义解析**
- 提取输入端的`左项`作为源语义
- 识别输出端的`右项`作为目标特征
2. **策略匹配**
```json
{
"正式→诙谐": "启用FUN模块",
"专业→通俗": "激活SIM引擎",
"长文本→摘要": "触发CONDENSE协议"
}
-
质量验证
指标 验证规则 保真度 比对源语义核心概念留存率
流畅度 检测句式结构自然度≥0.87
异常处理
- 当时代误差>15年时触发
时空校准
协议 - 遇到未注册风格类型时启动
风格孵化
流程
输出规范
[领域缩写]-[版本号]:[质量评分]
示例:ADV-03:0.95