LLM で請求書のデータを JSON に抽出する(ゼロデータ保持)
エージェントが請求書のテキストを構造化された JSON に変換し、合計が合っているかを確認します。実行後は何も残りません。
- ファイル
- ゼロデータ保持
- 予算の上限
実際の実行を見る
2026年10月7日 の実際の実行を再生しています。モデル: openai/gpt-6-luna。
成功run_409c7825c514f991b83554e667640f68$0.03 のうち $0.003496
- 待機中予算 $0.03 を確保
- MicroVMmicroVM ready
- MicroVMworker started · shell off · web off
- ファイル
read invoice.txt - MicroVMmicroVM destroyed
- 成功モデル呼び出し 2 回、トークン 2,304記録された出力(英語)
{ "vendor": "Fjord Supplies AS", "invoice_number": "FS-2026-0417", "invoice_date": "2026-09-30", "due_date": "2026-10-30", "currency": "EUR", "line_items": [ { "description": "Organic flour 25 kg", "quantity": 8, "unit_price": 31.5, "amount": 252 }, { "description": "Sunflower oil 10 l", "quantity": 5, "unit_price": 24, "amount": 120 }, { "description": "Delivery (pallet)", "quantity": 1, "unit_price": 45, "amount": 45 } ], "subtotal": 417, "tax": 104.25, "total": 531.25, "checks": { "line_items_sum_matches_subtotal": true, "subtotal_plus_tax_matches_total": false, "notes": "Subtotal plus VAT is 521.25, which is 10.00 less than the printed total of 531.25." } } - ワーカーを破棄$0.003496 を請求、$0.026504 を解放
モデル $0.000378 · Web $0.00 · コンピュート $0.0028 · 追加料金 $0.000318
この実行ではゼロデータ保持が有効でした。
自分で実行する
リクエスト全体が入力された状態で、サンプルをプレイグラウンドで開きます。実行はご自身のアカウントで、表示された予算の範囲内で、同じ読み取り専用のサンプルシステムに対して行われます。
このサンプルの予算: $0.03
仕組み
請求書には氏名、住所、銀行口座の情報が含まれるため、この実行ではゼロデータ保持を使います。エージェントは取引先、番号、日付、明細、合計を JSON で返し、計算が合わない請求書にはフラグを立てます。スキャンした書類の場合は、先に OCR を実行し、そのテキストを渡してください。
エージェントにできること、できないこと
権限はリクエストの一部です。ここに挙げていないものは、実行では利用できません。
| 設定 | 許可 |
|---|---|
| 接続 | なし |
| Web | オフ |
| シェル | オフ |
| ファイル | invoice.txt(読み取り専用) |
| ゼロデータ保持 | オン: 記録は残らず、出力は 1 度だけ返されます |
| 予算 | $0.03、厳格な上限 |
| タイムアウト | 60 秒 |
認証情報がマシンに入ることはありません。ブローカーが各呼び出しに認証情報を付与し、上記のメソッドだけを通します。
コード
サンプルが送信する正確なリクエストです。EPHEMERAL_API_KEY には、組織のメンバーキーを設定してください。
curl -X POST $EPHEMERAL_URL/v1/runs \
-H "Authorization: Bearer $EPHEMERAL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d @request.jsonリクエストに含まれるファイル
インラインで渡すため、事前にアップロードする必要はありません。エージェントには、それぞれが読み取り専用のファイルとして見えます。
invoice.txt
INVOICE
Fjord Supplies AS
Storgata 12, 0155 Oslo, Norway
VAT no: NO 123 456 789 MVA
Invoice number: FS-2026-0417
Invoice date: 2026-09-30
Due date: 2026-10-30
Bill to: Example Bakery Ltd, 5 High Street, London
Description Qty Unit price (EUR) Amount (EUR)
Organic flour 25 kg 8 31.50 252.00
Sunflower oil 10 l 5 24.00 120.00
Delivery (pallet) 1 45.00 45.00
Subtotal 417.00
VAT 25% 104.25
Total due 531.25
Payment: bank transfer, IBAN NO93 8601 1117 947, reference FS-2026-0417
リクエスト本文の全体 request.json
同じ本文を、ファイルをインラインにした形で示します。
{
"prompt": "Extract the invoice in invoice.txt. Reply with one JSON object and nothing else: {\"vendor\": string, \"invoice_number\": string, \"invoice_date\": \"YYYY-MM-DD\", \"due_date\": \"YYYY-MM-DD\", \"currency\": string, \"line_items\": [{\"description\": string, \"quantity\": number, \"unit_price\": number, \"amount\": number}], \"subtotal\": number, \"tax\": number, \"total\": number, \"checks\": {\"line_items_sum_matches_subtotal\": boolean, \"subtotal_plus_tax_matches_total\": boolean, \"notes\": string}}. Copy numbers exactly as printed, then do the arithmetic for the checks. Use null for any field the document does not show.",
"files": [
{
"path": "invoice.txt",
"content": "INVOICE\n\nFjord Supplies AS\nStorgata 12, 0155 Oslo, Norway\nVAT no: NO 123 456 789 MVA\n\nInvoice number: FS-2026-0417\nInvoice date: 2026-09-30\nDue date: 2026-10-30\nBill to: Example Bakery Ltd, 5 High Street, London\n\nDescription Qty Unit price (EUR) Amount (EUR)\nOrganic flour 25 kg 8 31.50 252.00\nSunflower oil 10 l 5 24.00 120.00\nDelivery (pallet) 1 45.00 45.00\n\nSubtotal 417.00\nVAT 25% 104.25\nTotal due 531.25\n\nPayment: bank transfer, IBAN NO93 8601 1117 947, reference FS-2026-0417\n"
}
],
"shell": false,
"timeout_seconds": 60,
"max_cost_micros": 30000,
"zero_data_retention": true
}