TsgcAIDocumentExtractor › Properties › LastResult

LastResult Property

Result of the last extraction: data, validation errors, confidences and OCR text.

Syntax

property LastResult: TsgcAIDocumentExtractionResult read FLastResult;

Default Value

—

Remarks

Public, read only. The object is owned by the extractor and is reset at the start of every extraction, so copy what you need before the next call.

MemberTypeDescription
DatastringThe extracted data as a JSON document, without the confidence wrapper. The extract methods return the same text.
RawResponsestringThe full JSON answer of the model, wrapper included.
ValidBooleanTrue when Data validates against the schema.
ValidationErrorsTStringListOne path: message line per validation error.
ConfidenceDoubleThe lowest field confidence once an answer is parsed, 1 when there are none or IncludeConfidence is False. 0 when no answer was parsed, for example after the provider returned an error.
FieldConfidencesTStringListName=Value lines, one per field path. The value always uses '.' as decimal separator, whatever the locale.
FieldConfidence(aPath)DoubleConfidence of a field path such as total or lines[0].amount, or -1 when the model returned none for that path.
UsedOCRBooleanTrue when the data came from the text of the local OCR instead of the attachments.
OCRTextstringThe text recognised by the local OCR, one "Page N" block per attachment.
ClearprocedureResets every member.

Example

vJSON := oExtractor.ExtractFile('invoice.pdf');
if oExtractor.LastResult.FieldConfidence('total') < 0.8 then
  ShowMessage('Check the total: ' + oExtractor.LastResult.Data);

Back to Properties