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
| Name | Type | Description |
| Title | STRING | The unique name |
| Enabled | BOOLEAN | Controls whether the rule participates in evaluation. Rules are enabled by default; |
| MaxResults | INT32 | Specifies the maximum number of results that may be emitted. This is a hard cap enforced after ranking and filtering. |
| RankingMode | enumRankingMode | Determines how evaluated candidates are ranked before selection. Confidence ranks by confidence score, Proximity ranks by feature closeness, and Priority ranks by declared priority. |
| MinConfidence | NULLABLE`1 | Optional minimum confidence required for a candidate to be considered. If not specified, all confidence levels are allowed. |
| RequireTruth | BOOLEAN | Indicates whether a candidate must evaluate to true in order to be considered eligible for output. |
| TieBreakerApproach | enumTieBreakerApproach | Specifies 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