TsgcAIDocumentExtractor › Properties › Preset

Preset Property

Selects a built in schema (invoice, receipt, identity document) instead of Schema.

Syntax

property Preset: TsgcAIDocumentPreset read FPreset write FPreset default dpCustom;
// TsgcAIDocumentPreset = (dpCustom, dpInvoice, dpReceipt, dpIDCard)

Default Value

dpCustom

Remarks

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.

ValueFields
dpCustomNo preset, Schema is used.
dpInvoiceinvoice_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.
dpReceiptmerchant (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.
dpIDCarddocument_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.

Example

oExtractor.Preset := dpInvoice;
vJSON := oExtractor.ExtractFile('invoice.pdf');

Back to Properties