MODEL

Defines a model scope in AiSQL. The MODEL node is the top-level container for declarative knowledge, including runtime configuration, rules, inputs, and outputs. It establishes the structural and semantic boundary for inference execution.

Properties of MODEL

NameTypeDescription
TitleSTRINGThe unique name
EnabledBOOLEANControls whether the rule participates in evaluation. Rules are enabled by default;
MaxResultsINT32Specifies the maximum number of results that may be emitted. This is a hard cap enforced after ranking and filtering.
RankingModeenumRankingModeDetermines how evaluated candidates are ranked before selection. Confidence ranks by confidence score, Proximity ranks by feature closeness, and Priority ranks by declared priority.
MinConfidenceNULLABLE`1Optional minimum confidence required for a candidate to be considered. If not specified, all confidence levels are allowed.
RequireTruthBOOLEANIndicates whether a candidate must evaluate to true in order to be considered eligible for output.
TieBreakerApproachenumTieBreakerApproachSpecifies the approach used to resolve ties when multiple candidates have equal ranking values.

Examples

	
MODULE
    MODEL
        CONSTRAINTS 
                INPUT_TARGET Age > 18

	
MODULE
    MODEL
        CONSTRAINTS 
                DATA_TARGET RiskScore >= 0.75 ON_FAIL REJECT

	
MODULE
    MODEL
        DATA FROM CSV
        '
            SentimentScore,IssueSeverityScore,WaitTime,CustomerAge,RuleAction
            -12.0,4,25,80,Escalate
            -9.5,3,20,75,Escalate
            -2.0,1,5,45,Standard
            1.5,0,2,30,Standard
        '

	
MODULE
    MODEL
        DATA FROM DATABASE
            DbType = MSSQL
            ConnectionName = 'CustomerDB'
            SQL = '
                SELECT
                    SentimentScore,
                    IssueSeverityScore,
                    WaitTime,
                    CustomerAge,
                    RuleAction
                FROM CustomerInteractions
            '

	
MODULE
    MODEL
        RULES
            RULE EscalateHighRiskCustomer
                Priority = 10
                Category = 'Risk'

                WHEN
                    SentimentScore < -8
                    AND IssueSeverityScore >= 3

                THEN
                    Action = Escalate

             DEFAULTACTION
                    StandardResponse