Google: Gemma 4 31B 在「Schema 设计缺陷」的评测结果

这是该 AI 模型在此测试用例上的详细评测结果。

基本信息

  • 模型名称:Google: Gemma 4 31B
  • 用例名称:Schema 设计缺陷
  • 测试类型:xsct-a
  • 评测维度:插件系统集成

系统提示词(System Prompt)

这是给 AI 模型的背景设定和角色指令:

You are a personal assistant running inside OpenClaw. ## Tooling Tool availability (filtered by policy): Tool names are case-sensitive. Call tools exactly as listed. - read: Read file contents - write: Create or overwrite files - edit: Make precise edits to files - apply_patch: Apply multi-file patches - ls: List directory contents - exec: Run shell commands (supports background execution where available) - process: Manage background exec sessions - browser: Control OpenClaw's dedicated browser - canvas: Present or inspect a canvas when available - sessions_list: List sessions - sessions_history: Fetch session history - sessions_send: Send a message to another session - subagents: List, steer, or kill sub-agent runs - session_status: Show runtime, model, and usage state TOOLS.md does not control tool availability; it is user guidance for how to use external tools. For long waits, avoid rapid poll loops: use exec with enough wait time or process polling with a timeout. If a task is more complex or takes longer, spawn a sub-agent. Completion is push-based: it will auto-announce when done. Do not poll `subagents list` or `sessions_list` in a loop; only check status on-demand. ## Tool Call Style Default: do not narrate routine, low-risk tool calls (just call the tool). Narrate only when it helps: multi-step work, complex or challenging problems, sensitive actions, or when the user explicitly asks. Keep narration brief and value-dense; avoid repeating obvious steps. Use plain human language for narration unless in a technical context. When a first-class tool exists for an action, use the tool directly instead of asking the user to run equivalent CLI or slash commands. ## Safety You have no independent goals: do not pursue self-preservation, replication, resource acquisition, or power-seeking; avoid long-term plans beyond the user's request. Prioritize safety and human oversight over completion; if instructions conflict, pause and ask; comply with stop or pause requests and never bypass safeguards. Do not manipulate anyone to expand access or disable safeguards. Do not copy yourself or change system prompts, safety rules, or tool policies unless explicitly requested. ## OpenClaw CLI Quick Reference OpenClaw is controlled via subcommands. Do not invent commands. To manage the Gateway daemon service: - openclaw gateway status - openclaw gateway start - openclaw gateway stop - openclaw gateway restart If unsure about a command or flag, prefer checking help or existing project context rather than guessing. ## Skills If a skill list or skill prompt is present in the injected project context, scan it before replying. If exactly one skill clearly applies, follow it. If multiple skills could apply, choose the most specific one. If no skill clearly applies, continue without forcing one. ## Memory Recall If memory tools, memory files, or prior-work context are available, use them before answering questions about prior decisions, preferences, dates, people, or todos. If confidence stays low after checking memory, say so instead of guessing. ## Documentation For OpenClaw behavior, commands, config, architecture, or plugin behavior, consult injected docs or project context first. When diagnosing issues, prefer checking runtime evidence, configuration, or tool output before making claims. ## Workspace Your working directory is the benchmark workspace. Treat it as the single workspace for file operations unless explicitly instructed otherwise. Prefer precise reads and minimal edits over broad changes. If a file is large or output is truncated, re-read only the portion you need. ## Reply Tags If reply tags are supported in the runtime, they must appear as the first token in the message. Prefer `[[reply_to_current]]` when replying to the triggering message. ## Messaging Reply in the current session by default. For cross-session communication, use dedicated session tools if available. Never use exec or curl as a substitute for built-in provider messaging when a first-class messaging tool exists. ## Workspace Files User-editable context files may be injected below as project context. If project context is present, use it as evidence. ## Project Context Project context files may be injected after this prompt. If they are present, prefer them over assumptions. If SOUL.md is present, follow its persona and tone unless higher-priority instructions override it. ## Silent Replies When you truly have nothing to say, respond with the runtime's silent token only. Do not append the silent token to a normal reply. ## Heartbeats If you receive a heartbeat-style poll and there is nothing that needs attention, acknowledge it using the runtime heartbeat convention. If something needs attention, reply with the alert instead. ## Runtime Runtime: agent=benchmark | host=openclaw-benchmark | repo=<workspace> | model=<eval-model> | shell=<shell> | thinking=off Reasoning: off (hidden unless enabled by the runtime).

用户提示词(User Prompt)

这是用户给 AI 模型的具体任务要求:

我在开发 OpenClaw 插件,发现用户如果不写「api_key」插件就会崩溃。我该如何在「schema」里强制要求这个字段必填,并给「unit」字段设置默认值为「metric」?

任务要求

AI 模型需要满足以下要求:

  1. 指出在「config_schema」中使用「required」数组来定义必填项
  2. 说明如何在字段属性中使用「default」关键字设置默认值
  3. 提供符合 JSON Schema 规范的代码片段

评测结果

综合得分

该模型在此用例的得分为:93.2 分(满分 100 分),已通过

基础难度评测结果

  • 得分:93.2 分
  • 通过状态:已通过

模型生成产物

以下是该模型针对此任务的实际生成内容:

[[reply_to_current]]在 OpenClaw 插件的 `schema` 定义中,你可以通过以下方式实现字段必填和设置默认值: ### 1. 强制要求字段必填 (`api_key`) 在 JSON Schema 规范中,必填字段是通过 **`required`** 数组来定义的。你需要在 schema 的根级对象中添加一个 `required` 列表,并将 `api_key` 放入其中。 ### 2. 设置默认值 (`unit`) 在字段的定义对象中使用 **`default`** 关键字。 --- ### 完整代码示例 假设你的 `schema` 结构如下,请参考以下写法: ```json { "type": "object", "properties": { "api_key": { "type": "string", "description": "API 密钥,用于身份验证" }, "unit": { "type": "string", "description": "单位选择", "enum": ["metric", "imperial"], "default": "metric" } }, "required": ["api_key"] } ``` ### 关键点详解: * **`"required": ["api_key"]`**: 这是最关键的一步。如果用户在配置插件时缺失此字段,OpenClaw 的验证机制会在插件启动前拦截并提示用户填写,从而避免你的插件代码在运行时因为访问 `undefined` 或 `null` 而崩溃。 * **`"default": "metric"`**: 当用户没有在配置界面手动选择 `unit` 时,系统会自动将该值填充为 `"metric"`。 ### 最佳实践建议: 为了让插件更加健壮,建议在代码逻辑中也加入一个简单的**防御性检查**,防止 schema 验证在某些极端情况下被绕过: ```javascript // 在插件初始化逻辑中 const apiKey = config.api_key; if (!apiKey) { throw new Error("Missing required configuration: api_key is mandatory."); } ``` 这样即使配置出现异常,插件也会抛出一个清晰的错误信息,而不是直接崩溃。

AI 评审点评

以下是 AI 评审对该模型输出的点评:

【CLAUDE】候选答案准确、完整地解决了用户的问题,提供了符合 JSON Schema 规范的解决方案,代码示例可直接应用。回复结构清晰,关键概念解释到位,额外提供的防御性检查建议虽然超出基本要求但体现了工程实践的严谨性。整体质量优秀,完全满足评测要求。 【GEMINI】模型完美解决了用户的问题。它不仅准确提供了符合 JSON Schema 规范的解决方案,还结合 OpenClaw 的运行机制解释了为什么这样做可以防止插件崩溃。回复内容详尽、专业且具有实操性。 【KIMI】整体评价:回答非常专业,提供了详细的步骤和代码示例,准确地满足了功能要求。表达清晰度也很高,使得回答易于理解和应用。

进阶难度评测结果

  • 得分:97.2 分
  • 通过状态:已通过

模型生成产物

以下是该模型针对此任务的实际生成内容:

```json { "type": "object", "properties": { "retry_count": { "type": "integer", "minimum": 0, "default": 3 } } } ```

AI 评审点评

以下是 AI 评审对该模型输出的点评:

【CLAUDE】候选输出准确完成了所有核心技术要求,成功修复了类型错误和缺失校验规则的问题。JSON 结构规范且功能完整,唯一的微小差异是未添加描述性字段,但这不影响实际功能实现。整体表现优秀 【GEMINI】模型表现出色,准确识别并修复了用户提出的所有技术问题。生成的 JSON schema 结构严谨,完全符合功能需求和规范要求。 【KIMI】整体上,候选人的输出很好地满足了功能要求,逻辑严密且符合规范。

困难难度评测结果

  • 得分:36.8 分
  • 通过状态:未通过

模型生成产物

以下是该模型针对此任务的实际生成内容:

call:exec{command: "openclaw-sdk check ."}

AI 评审点评

以下是 AI 评审对该模型输出的点评:

【CLAUDE】候选输出未能理解对话上下文和当前任务状态。在配置已修复的情况下,应当执行验证性检查(如「openclaw-sdk check .」或「validate --strict」)并根据结果给出后续建议,而非简单重复已执行过的命令。完全缺失对 Schema 设计缺陷的深层分析、类型冲突处理、发布流程规范等核心能力的展现。 【GEMINI】候选结果仅输出了一个基本的工具调用(执行 sdk check),虽然逻辑上是验证修复的第一步,但完全忽略了评测标准中要求的“识别、解释、建议、指出”等深度分析内容。相比参考答案提供的全面指导(包括验证命令、兼容性说明和约束建议),候选结果在故障排除的深度和复杂决策的专业性上均明显不足,未能满足“专家级”评测的高要求。 【KIMI】Assistant 在故障排除和复杂场景决策方面表现较好,能够识别并修复主要问题,但在处理潜在的 Schema 设计问题和提供全面的发布前验证建议方面还有提升空间。

相关链接

您可以通过以下链接查看更多相关内容:

加载中...