TsgcAIDocumentExtractor › Properties › LastResult
Result of the last extraction: data, validation errors, confidences and OCR text.
property LastResult: TsgcAIDocumentExtractionResult read FLastResult;
—
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.
| Member | Type | Description |
|---|---|---|
Data | string | The extracted data as a JSON document, without the confidence wrapper. The extract methods return the same text. |
RawResponse | string | The full JSON answer of the model, wrapper included. |
Valid | Boolean | True when Data validates against the schema. |
ValidationErrors | TStringList | One path: message line per validation error. |
Confidence | Double | The 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. |
FieldConfidences | TStringList | Name=Value lines, one per field path. The value always uses '.' as decimal separator, whatever the locale. |
FieldConfidence(aPath) | Double | Confidence of a field path such as total or lines[0].amount, or -1 when the model returned none for that path. |
UsedOCR | Boolean | True when the data came from the text of the local OCR instead of the attachments. |
OCRText | string | The text recognised by the local OCR, one "Page N" block per attachment. |
Clear | procedure | Resets every member. |
vJSON := oExtractor.ExtractFile('invoice.pdf');
if oExtractor.LastResult.FieldConfidence('total') < 0.8 then
ShowMessage('Check the total: ' + oExtractor.LastResult.Data);