TsgcAIDocumentExtractor › Properties › Preset
Selects a built in schema (invoice, receipt, identity document) instead of Schema.
property Preset: TsgcAIDocumentPreset read FPreset write FPreset default dpCustom;
// TsgcAIDocumentPreset = (dpCustom, dpInvoice, dpReceipt, dpIDCard)
dpCustom
A preset replaces Schema with a built in schema and adds its own extraction instructions. Every preset schema follows the OpenAI strict rules and every leaf value is nullable, so a field the document does not show comes back as null.
| Value | Fields |
|---|---|
dpCustom | No preset, Schema is used. |
dpInvoice | invoice_number, issue_date, due_date, currency (ISO 4217), supplier and customer (name, tax_id, address), lines (description, quantity, unit_price, discount, tax_rate, amount), taxes (rate, base, amount), subtotal, tax_total, total, payment_terms, iban. |
dpReceipt | merchant (name, tax_id, address), date, time, currency (ISO 4217), items (description, quantity, unit_price, amount), subtotal, tax_total, tip, total, payment_method (cash, card, mobile, other or null), card_last4. |
dpIDCard | document_type (passport, id_card, driving_licence, residence_permit, other), document_number, issuing_country (ISO 3166-1 alpha-3), surname, given_names, date_of_birth, sex (M, F, X or null), nationality, place_of_birth, date_of_issue, date_of_expiry, personal_number, mrz (one array item per machine readable zone line). |
The invoice preset writes tax_rate and the tax rates as percentage numbers (21 for 21%), the receipt preset writes the time as HH:MM in 24 hour format and the identity preset copies the machine readable zone exactly as printed. Read the full schema with GetPresetSchema.
oExtractor.Preset := dpInvoice;
vJSON := oExtractor.ExtractFile('invoice.pdf');