講座 › 分野4 プロンプトエンジニアリングと構造化出力
4.3 ツール使用とJSONスキーマ
配点 3.3%Tool use and JSON schemas
構造化出力は、スキーマつきのツール使用で受け取るのが、最も確実。ただし、意味の誤りまでは防げない。
未読
スキーマつきのツール使用 読了

抽出用のツールを定義し、入力のスキーマにJSONスキーマを指定して、ツール呼び出しの入力から結果を取り出します。書式の誤りがなくなる、最も確実な方法です。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Tool use (tool_use) with JSON schemas as the most reliable approach for guaranteedhttps://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Structured outputs
Structured outputs guarantee schema-compliant responses through constrained decoding:https://platform.claude.com/docs/en/build-with-claude/structured-outpu…(取得 2026-11-20)
出典:Strict tool use
Setting strict: true on a tool definition guarantees Claude’s tool inputs match your JSON Schemahttps://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-t…(取得 2026-11-20)
厳密にしないと、何が起きるか 読了

厳密な指定がなければ、型が合わない値や、必須の項目の欠落が、実行時のエラーを招くことがあります。厳密な指定はこれを防ぎます。
出典:Strict tool use
Without strict mode, Claude might return incompatible types ("2" instead of 2) or omit required fields, breaking your functions and causing runtime errors.https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-t…(取得 2026-11-20)
tool_choice:auto・any・指定 読了

auto は、ツールを呼ばず、文章で返すことがあります。any は、どれかのツールを必ず呼びます。名前を指定すると、そのツールを必ず呼びます。文書の種類が不明で、抽出用のスキーマが複数あるときは any を使います。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
The distinction between tool_choice: "auto" (model may return text instead of calling a tool), "any" (model must call a tool but can choose which), and forced tool selection (model must call a specific named tool)https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Setting tool_choice: "any" to guarantee structured output when multiple extraction schemas exist and the document type is unknownhttps://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
防げるのは書式の誤りだけ 読了

スキーマは、書式の誤りをなくしますが、意味の誤りは防げません。明細の合計が総額と合わない、値が別の欄に入る、といった誤りは、別の検証が必要です。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
That strict JSON schemas via tool use eliminate syntax errors but do not prevent semantic errors (e.g., line items that don't sum to total, values in wrong fields)https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
スキーマの設計:必須か任意か、列挙の逃げ道 読了

文書に書かれていないかもしれない情報は、任意(null可)にします。必須にすると、値をでっち上げます。列挙には「不明」を入れ、拡張できる分類には「その他」と詳細の欄を設けます。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Designing schema fields as optional (nullable) when source documents may not contain the information, preventing the model from fabricating values to satisfy required fieldshttps://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Adding enum values like "unclear" for ambiguous cases and "other" + detail fields for extensible categorizationhttps://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
表記のゆれは、正規化の規則で吸収する 読了

元の文書の書き方がバラバラなときは、スキーマに加えて、整える規則もプロンプトに書きます。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Including format normalization rules in prompts alongside strict output schemas to handle inconsistent source formattinghttps://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)
試験のポイント
- 構造化出力は、スキーマつきのツール使用で。書式の誤りがなくなる。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Tool use (tool_use) with JSON schemas as the most reliable approach for guaranteed
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20) - スキーマでは意味の誤りは防げない。別の検証を足す。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
That strict JSON schemas via tool use eliminate syntax errors but do not prevent semantic errors (e.g., line items that don't sum to total, values in wrong fields)
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20) - 無いかもしれない情報は、任意(null可)にして、でっち上げを防ぐ。
出典:Claude Certified Architect – Foundations Exam Guide v1.0(英語)
Designing schema fields as optional (nullable) when source documents may not contain the information, preventing the model from fabricating values to satisfy required fields
https://everpath-course-content.s3-accelerate.amazonaws.com/instructor…(取得 2026-11-20)