Inference Schema

The inference schema is a structure that defines what should be done and in which way while making predictions.

>> PREDICT-API Service

Beta Version

The inference schema is a component of the Artificial Intelligence Platform. This platform is not included in yuuvis® Momentum installations and is available as a beta version only on request.

Table of Contents

Inference Schema

The inference schema is a JSON configuration file defining the object types that will be available for the classification as well as the properties for which the metadata extraction should be done. At the same time, each internal aiObjectTypeId for classification or aiPropertyId for metadata extraction gets a corresponding objectTypeId in the case of classification, or propertyId in the case of metadata extraction, which will be used in the response bodies of the classification and extraction endpoints to be compatible with the connected client application.

The inference schema also defines whether the particular mapping is enabled or disabled, and also timeouts, allowed values, patterns that should be met, external validation services to be called, etc.

The inference schema is defined for a specific tenant. It is also possible to further limit the usage of the inference schema to an app by specifying the appName (e.g., to make a distinction between a client app for single uploads and batch processing apps).

Example for an inference schema
{
    "tenant" : "ACME Inc.",
    "appName" : "InvoiceBatchProcessing",
    "classification" : {
        "enabled" : true,
        "timeout" : 2,
        "aiClassifierId" : "DOCUMENT_CLASSIFICATION",
        "objectTypes": [
            {
                "objectTypeId" : "invoiceIn",
                "aiObjectTypeId" : "AI_INVOICE"
            },
            {
                "objectTypeId" : "invoiceOut",
                "aiObjectTypeId" : "AI_INVOICE"
            },
			{
                "objectTypeId" : "creditMemoIn",
                "aiObjectTypeId" : "AI_CREDIT_MEMO"
            },
            {
                "objectTypeId" : "creditMemoOut",
                "aiObjectTypeId" : "AI_CREDIT_MEMO"
            }
    },
    "extraction" : {
        "enabled" : true,
        "timeout" : 5,
        "objects" : [
            {
                "objectTypeId" : "invoiceIn",
                "enabled" : true,
                "timeout" : 10,
                "propertyReference" : [
                    {
                        "propertyId" : "companyName",
                        "aiPropertyId" : "AI_INVOICE_COMPANY_NAME",
                        "allowedValues" : ["Lufthansa", "KLM", "Swiss"],
                        "pattern" : "/^[a-z]|\\d?[a-zA-Z0-9]?[a-zA-Z0-9\\s&@.]+$",
                        "validationService" : "os_company_name_validation_service",
                        "maxNumberOfPredictions" : 5
                    },
                    {
                        "propertyId" : "baseAmount",
                        "aiPropertyId" : "AI_BASE_AMOUNT",
                        "pattern" : "^[0-9]*[.][0-9]*$",
                        "validationService" : "os_amounts_validation_service",
                        "maxNumberOfPredictions" : 1
                    },
                    {
                        "propertyId" : "totalAmount",
                        "aiPropertyId" : "AI_INVOICE_TOTAL_AMOUNT",
                        "pattern" : "^[0-9]*[.][0-9]*$",
                        "validationService" : "os_amounts_validation_service",
                        "maxNumberOfPredictions" : 1
                    },
                    {
                        "propertyId" : "invoiceDate",
                        "aiPropertyId" : "AI_INVOICE_DATE",
                        "pattern" : "^[0-9]*[.][0-9]*$",
                        "validationService" : "os_dates_validation_service",
                        "maxNumberOfPredictions" : 1
                    }
					
                ]
            },
			{
                "objectTypeId" : "invoiceOut",
                "enabled" : true,
                "timeout" : 10,
                "propertyReference" : [
                    {
                        "propertyId" : "companyName",
                        "aiPropertyId" : "AI_INVOICE_COMPANY_NAME",
                        "allowedValues" : ["Lufthansa", "KLM", "Swiss"],
                        "pattern" : "/^[a-z]|\\d?[a-zA-Z0-9]?[a-zA-Z0-9\\s&@.]+$",
                        "validationService" : "os_company_name_validation_service",
                        "maxNumberOfPredictions" : 5
                    },
                    {
                        "propertyId" : "totalAmount",
                        "aiPropertyId" : "AI_INVOICE_TOTAL_AMOUNT",
                        "pattern" : "^[0-9]*[.][0-9]*$",
                        "validationService" : "os_amounts_validation_service",
                        "maxNumberOfPredictions" : 1
                    }
                ]
            },
			{
                "objectTypeId" : "creditMemoIn",
                "enabled" : true,
                "timeout" : 10,
                "propertyReference" : [
                    {
                        "propertyId" : "companyName",
                        "aiPropertyId" : "AI_CREDIT_MEMO_TOTAL_AMOUNT",
                        "allowedValues" : ["Lufthansa", "KLM", "Swiss"],
                        "pattern" : "/^[a-z]|\\d?[a-zA-Z0-9]?[a-zA-Z0-9\\s&@.]+$",
                        "validationService" : "os_company_name_validation_service",
                        "maxNumberOfPredictions" : 5
                    },
                    {
                        "propertyId" : "totalAmount",
                        "aiPropertyId" : "AI_CREDIT_MEMO_TOTAL_AMOUNT",
                        "pattern" : "^[0-9]*[.][0-9]*$",
                        "validationService" : "os_amounts_validation_service",
                        "maxNumberOfPredictions" : 1
                    }
                ]
            },
			{
                "objectTypeId" : "creditMemoOut",
                "enabled" : true,
                "timeout" : 10,
                "propertyReference" : [
                    {
                        "propertyId" : "companyName",
                        "aiPropertyId" : "AI_CREDIT_MEMO_TOTAL_AMOUNT",
                        "allowedValues" : ["Lufthansa", "KLM", "Swiss"],
                        "pattern" : "/^[a-z]|\\d?[a-zA-Z0-9]?[a-zA-Z0-9\\s&@.]+$",
                        "validationService" : "os_company_name_validation_service",
                        "maxNumberOfPredictions" : 5
                    },
                    {
                        "propertyId" : "totalAmount",
                        "aiPropertyId" : "AI_CREDIT_MEMO_TOTAL_AMOUNT",
                        "pattern" : "^[0-9]*[.][0-9]*$",
                        "validationService" : "os_amounts_validation_service",
                        "maxNumberOfPredictions" : 1
                    }
                ]
            }
        ]
    }
}

The following parameters are available in the inference schema:

ParameterDescription
tenantTenant for which the inference schema will be applied.
appName

Optional parameter: name of the app that uses the inference schema. Other apps within the tenant cannot use this inference schema but only their own app-specific inference schema or the tenant-wide inference schema.

classificationSection of parameters for classification processes.






enabledBoolean value specifying whether the document classification is activated (true) or deactivated (false).
timeout

Time limit for the determination of a classification prediction in seconds.

An error will be thrown if the calculation process could not be finished before the timeout was reached.

aiClassifierIdID in the AI platform dictionary defining the model that will be used for the classification process.
objectTypes

A list of mappings, each of them containing the following keys. This list defines the object types that are available for the classification prediction.



objectTypeIdThe identification of an object type as it will appear in prediction response bodies. You can define a concatenation of several secondary object type IDs, catalog values, etc. that can be interpreted by your client application to show the prediction results in a proper format.
aiObjectTypeIdID of the internal class used within the Artificial Intelligence platform, especially in its dictionary.
extractionSection of parameters for metadata extraction processes.













enabledBoolean value specifying whether the metadata extraction is activated (true) or deactivated (false).
timeout

Time limit for the determination of extraction predictions in seconds.

The result will be returned even if the calculation process is still running for some models. Those models will be excluded from the response.

objectsList of mappings for the individual object types containing the following keys. This list defines the object types for which metadata extraction will be available.










objectTypeIdThe ID of the object type as it will be referenced within each object's metadata in the property system:objectTypeId. This property has to be set already during the object creation in yuuvis® Momentum and is thus always assigned to any object to be processed. The available object types are defined in the yuuvis® Momentum schema.
enabled

Boolean value specifying whether the metadata extraction is activated (true) or deactivated (false) for the specific object type.

Ignored if extraction.enabled is set to false.

timeout

Optional time limit in seconds overwriting extraction.timeout for the determination of extraction predictions for properties belonging to the object type specified by objectTypeId.

The result will be returned even if the calculation process is still running for some models. Those models will be excluded from the response.

propertyReferenceA list of mappings, each of them containing the following keys. This list defines the properties for wich metadata should be extracted for an object of type objectTypeId.






propertyId

The identification of a property as it will appear in prediction response bodies. You can define a concatenation of several secondary object type IDs, catalog values etc. that can be interpreted by your client application to show the prediction results in proper format.

aiPropertyIdID of the internal property used within the Artificial Intelligence platform, especially in its dictionary.
allowedValuesOptional limitation of the prediction response: List of values for the property specified by propertyId. Only values specified in this list are allowed as prediction results of the metadata extraction.
patternOptional limitation of the prediction response: Condition for values for the property specified by propertyId. Only values matching the condition are allowed as prediction results of the metadata extraction.
validationService

Optional parameter: URL of an endpoint for further validation of the value determined for the property specified by propertyId.

Note: Not available in the beta version where the connection of an additional validation service needs more configuration steps.

maxNumberOfPredictions

Optional parameter: An integer value defining the maximum number of values included in the prediction response for the property propertyId.

If not specified, the default value 1 will be used.

In order to use the Artificial Intelligence Platform with a client application based on our client libraries (e.g., yuuvis® client as a reference implementation), objectTypeId has to be defined as a concatenation of app name and SOTs separated by pipes as can be seen in the following example:

Inference schema for the combination with yuuvis® Momentum CLIENT service
{
    "tenant" : "os__papi",
    "appName" : "AIInvoiceClient",
    "classification" : {
        "enabled" : true,
        "timeout" : 10,
        "aiClassifierId" : "DOCUMENT_CLASSIFICATION",
		"objectTypes": [ 
			{ 
				"objectTypeId" : "appImpulse:hrdocsot|appImpulse:hrDocumentType|Bescheinigung",
				"aiObjectTypeId" : "appImpulse:contractsot"
			},
			{ 
				"objectTypeId" : "appImpulse:receiptsot",
				"aiObjectTypeId" : "appImpulse:hrdocsot"
			},
			{ 
				"objectTypeId" : "appImpulse:contractsot|appImpulse:contractType|Arbeitsvertrag",
				"aiObjectTypeId" : "appImpulse:receiptsot"
			},
			{ 
				"objectTypeId" : "appImpulse:hrdocsot|appImpulse:hrDocumentType|Arbeitsvertrag",
				"aiObjectTypeId" : "appImpulse:basedocumentsot"
			}
		]
    }
}

Requirements

The inference schema is a part of the Artificial Intelligence Platform and can run only in combination with the other included services.

Installation

The Artificial Intelligence Platform including the inference schema is not yet included in yuuvis® Momentum installations but is only available on request.

Configuration

The inference schema is managed, configured, and maintained via the command line application Kairos CLI.

Read on

ML Training Pipeline

Responsible for preparing data for training, training of machine learning models, evaluation of trained models, and preparing for the deployment to the production. Keep reading

Kairos CLI App

A command-line application for managing the Artificial Intelligence Platform. Keep reading

PREDICT-API Service

The service of the AI platform provides the API for the retrieval of typification predictions determined by the Machine Learning (ML) Pipeline. Keep reading