<span id="信息提取"></span>

# Information Extraction

Extract structured fields from files or parsed documents using a JSON Schema, retaining source-tracking information where available.

Use it for defined fields such as contract details, receipt values, or resume information. For free-form summaries, use [AI Inference](ai-inference.md).

<span id="定义输入和字段"></span>

## Define input and fields

Supply either upstream `documents` or `files` for this node to parse. Do not supply both.

| Setting | Description |
| --- | --- |
| Extraction schema | Required JSON Schema defining field names, types, and constraints |
| Extraction instructions | Optional explanation of field meanings and requirements |
| Layout-sensitive fields | Fields whose interpretation depends on page position, such as supplier and recipient |
| Page filter | Limits source pages; leave empty to process all pages |
| Debug records | Off by default; records some call details for troubleshooting |

File input must use valid, unique Catalog `file_id` values.

<span id="选择提取模式"></span>

## Choose an extraction mode

| Mode | Results and failure behavior |
| --- | --- |
| One combined result, `n_to_1` | Default; all inputs contribute to one result |
| One result per source, `n_to_n` | Produces separate results by source file; supports a failure policy |

The default `n_to_n` policy is `per_item`: failed sources retain error objects while other sources continue. With `fail_fast`, a failure stops the batch. Before writing a batch to a table, separate successful results from errors and write only successful data.

<span id="使用输出"></span>

## Use the output

`result` is a JSON string for a single result; `results` contains result strings returned by source. `mode` identifies the mode, and `sources_tracking` contains available field-source information.

Distinguish JSON strings from objects when binding to downstream inputs. A single result can feed the JSON input of [Save to MOI Table](../data-io/save-table.md). Process individual results and error states before using multiple results.

<span id="示例提取合同编号"></span>

## Example: extract a contract number

Flow: General Document Parsing → Information Extraction → Save to MOI Table.

Example schema:

```json
{
  "type": "object",
  "properties": {
    "contract_number": {"type": "string", "description": "合同编号"}
  },
  "required": ["contract_number"]
}
```

Choose combined-result mode and explain what identifies the contract number. After running, verify the extracted number and its source.

<span id="继续阅读"></span>

## Further reading

- [Variables and data flow](../../variables-and-data.md)
- [Run and debug](../../run-debug.md)

<span id="核对字段依据和长输入"></span>

## Validate evidence and long inputs

Check extracted field values together with available source evidence, particularly layout-sensitive fields and multi-document summaries. A value appearing in an answer does not establish matching evidence.

Inspect coverage near the end of long inputs. Preserve model, input files, schema and errors when processing fails instead of loosening requirements or arbitrarily truncating material. Recheck both node settings and [document extraction](../../templates/document-extraction.md) or [multimodal extraction](../../templates/multimodal-extraction.md) templates.
