> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 構造化出力

> 構造化出力を効果的に活用し、API 経由で Devin セッションと対話する方法を学ぶ

> [!NOTE]
>
> 構造化出力は Devin のメモ帳のようなものです。Devin は作業しながらメモを更新していき、いつでもそのメモを確認できます。現時点では Devin にメモの更新を強制することはできませんが、これまでに書かれた内容をいつでも参照できます。

> [card] 進捗アップデート
>
> 長時間実行タスクの進行状況として、Devin の進捗を確認できます

> [card] アプリケーション連携
>
> Devin の分析結果と出力を、一貫した JSON 形式でアプリケーションに取り込めます。

## 構造化出力の利用

構造化出力を使用するには、[セッションを作成](https://docs.devin.ai/ja/api-reference/v1/sessions/create-a-new-devin-session.md)するときのプロンプトに、必要な JSON スキーマを含めてください。\
関連する出来事があったときは必ず Devin に構造化出力を更新させてください。

> [tab] PR レビュー
>
> ```json theme={null}
> {
>   "prompt": "Review this PR and provide updates in this format. Please update the structured output immediately whenever you find new issues, have suggestions, or change your approval status:\n{
>     "issues": [
>       {
>         "file": "src/App.tsx",
>         "line": 42,
>         "type": "bug",
>         "description": "Memory leak in useEffect cleanup"
>       }
>     ],
>     "suggestions": [
>       "Add error handling for API calls",
>       "Split component into smaller parts"
>     ],
>     "approved": false
>   }"
> }
> ```
>
> PR レビューやコード分析向けのシンプルなフォーマットです。

> [tab] 進捗更新
>
> ```json theme={null}
> {
>   "prompt": "As you work, provide updates in this format. Please update the structured output immediately whenever you start a new task, complete a task, or plan your next task:\n{
>     "status": "in_progress",
>     "current_task": "Adding authentication to login page",
>     "completed_tasks": [
>       "Set up project structure",
>       "Added routing"
>     ],
>     "next_task": "Implement form validation"
>   }"
> }
> ```
>
> Devin が現在取り組んでいる内容と、次に行う作業を追跡できます。

> [tab] テスト結果
>
> ```json theme={null}
> {
>   "prompt": "When running tests, report results in this format. Please update the structured output immediately after each test run and whenever coverage changes:\n{
>     "tests_passed": 25,
>     "tests_failed": 2,
>     "failing_tests": [
>       {
>         "name": "login_validation",
>         "error": "Expected error message to be shown"
>       }
>     ],
>     "coverage": 85
>   }"
> }
> ```
>
> テスト実行結果のシンプルなサマリーです。

> [tab] 機能実装
>
> ```json theme={null}
> {
>   "prompt": "Build a user settings page and track progress in this format. Please update the structured output immediately whenever you complete a requirement, create new files, identify review items, or change testing status:\n{
>     "requirements_met": {
>       "can_change_password": true,
>       "can_update_email": false,
>       "dark_mode_toggle": true
>     },
>     "files_created": [
>       "UserSettings.tsx",
>       "useUpdateProfile.ts"
>     ],
>     "needs_review": [
>       "Email update flow needs security review"
>     ],
>     "ready_for_testing": false
>   }"
> }
> ```
>
> 特定の要件に対する機能実装の進捗を追跡します。

## 構造化された出力の取得

[このエンドポイント](https://docs.devin.ai/ja/api-reference/v1/sessions/retrieve-details-about-an-existing-session.md)を使用して、セッションから構造化された出力を取得します。
構造化された出力は `structured_output` フィールドで返されます。

> [!TIP]
>
> Devin の Web アプリでは、`⌘ + I` (Command+I) を押すと、いつでも構造化された出力をすばやく表示できます。

## ベストプラクティス

* 初期プロンプトに完全なスキーマ定義を含める
* 想定する更新頻度を指定する (例:「サイトに新しいコンポーネントを追加するたびに構造化出力を更新してください」)
* 値の型とフォーマットを明確に記載する
* Devin が何を書くべきか理解できるよう、わかりやすく説明的なフィールド名を使う
* スキーマにサンプル値を含める
* Devin API に過度な負荷をかけないよう、ポーリングの間隔は 10〜30 秒程度に設定する
* セッションが完了するかエラーになったらポーリングを停止する

> [!NOTE]
>
> Devin は独自のタイミングで構造化出力を更新します。更新を強制することはできませんが、いつでも最新のノートの表示をリクエストできます。

構造化出力の使い方に関する質問や問題の報告は、[support@cognition.ai](mailto:support@cognition.ai) までメールでご連絡ください。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.