Skip to content

Validator

Definition

<validator name="ValidatorName">

Checks the validity of some predicate in an http_service.

Attribute Type Description
name string Required. The name of the validator class. Names are written according to the PascalCase convention, e.g. 'CityRecognizer'.

Children

Behaviour

The <validator> element in the service interface checks the validity of a parameter using the specified module in <target>. The target service must be an http_service, which would return either true or false as the value for "is_valid" inside a validator response.

If the target module returns a "is_valid": false, that will trigger the system to reject the user utterance, and explain to the user why the parameter was rejected.

Examples

Check in an http_service if the value and grammar entry for the destination city are valid

  <validator name="CityValidity">
    <parameters>
      <parameter predicate="dest_city" format="value"/>
      <parameter predicate="dest_city" format="grammar_entry"/>
    </parameters>
    <target>
      <http endpoint="http://climate-http-service:10100/city_validity"/>
    </target>
  </validator>

Last update: December 12, 2022