Provider Hub
Pontus
rules
Validate

L2 Construct: validate

rule_engine validate

Description

ValidateRulesEndpoint validates a list of rules against a given text. It takes a list of rules and a text, and returns a list of rule results.

L2 Data

  1. Provider: pontus
  2. Module: rules
  3. Action: validate

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "pontus",
    "module": "rules",
    "action": "validate",
    "metadata": {}
  }
}
 

Input

Example

{
  "text": "",
  "names": ["Monthly rent amount"],
  "requireds": [true],
  "rule_types": ["extract"],
  "rule_prompts": [
    "Find the monthly rent amount in dollars. Return only the number."
  ],
  "validation_types": ["validate"],
  "validation_prompts": [
    "Is this a valid currency amount? Answer PASS or FAIL."
  ],
  "validation_compare_with": ["1000"]
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/rule_engine/verticalized-rules-engine-input",
  "$ref": "#/$defs/VerticalizedRulesEngineInput",
  "$defs": {
    "VerticalizedRulesEngineInput": {
      "properties": {
        "text": {
          "type": "string"
        },
        "names": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "requireds": {
          "items": {
            "type": "boolean"
          },
          "type": "array"
        },
        "rule_types": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "rule_prompts": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "validation_types": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "validation_prompts": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "validation_compare_with": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "text",
        "names",
        "requireds",
        "rule_types",
        "rule_prompts",
        "validation_types",
        "validation_prompts"
      ]
    }
  }
}
 

Output

Example

{
  "results": [
    {
      "name": "Monthly rent amount",
      "extracted_value": 1000,
      "status": "PASS",
      "confidence": 100,
      "message": "Monthly rent amount is 1000"
    }
  ],
  "raw": null,
  "error": {
    "is_error": false
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/rule_engine/rules-engine-output",
  "$ref": "#/$defs/RulesEngineOutput",
  "$defs": {
    "HandlerError": {
      "properties": {
        "is_error": {
          "type": "boolean"
        },
        "errors": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["is_error"]
    },
    "RuleResult": {
      "properties": {
        "name": {
          "type": "string"
        },
        "extracted_value": true,
        "status": {
          "type": "string"
        },
        "confidence": {
          "type": "number"
        },
        "message": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "name",
        "extracted_value",
        "status",
        "confidence",
        "message"
      ]
    },
    "RulesEngineOutput": {
      "properties": {
        "results": {
          "items": {
            "$ref": "#/$defs/RuleResult"
          },
          "type": "array"
        },
        "raw": {
          "items": {
            "items": true,
            "type": "array"
          },
          "type": "array"
        },
        "error": {
          "$ref": "#/$defs/HandlerError"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["results", "raw", "error"]
    }
  }
}