Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageyaml
body: |
  From: customer@somedomain.tld
  Subject: I have a problem with your product
  Hello,
  I have a big problem with your product and need support.
  My customer id is 123456.
  Cheers, Valued Customer
  
pipeline:
  - ai.intentcommand.detect:
      runDetectedCommand: true
      advice:
        intentCandidates:
          - intentId: "forwardToSupport"
            descriptioninstruction: "Use this intent in case the sender needs product support."
            commandNametargetCommand: "mail.send"
            parametersparams:
              to:
                name:
"to"                 value: "support@internal.tld"
                commandParameter: true
              from:
                name: "from"
                descriptioninstruction: "The email address of the sender."
   
            detect: true                 commandParameter: true
              subject:
                name: "subject"
                descriptioninstruction: "Use the subject of the sender's email."

               detect: true
                commandParameter: true
              message:
                nameinstruction: "message"
                description: "Use the message of the sender's email."
                detect: true
                commandParameter: true
          - intentId: "forwardToInfo"
            descriptioninstruction: >
              Use this intent in case the sender's intent could not be detected.
            commandNametargetCommand: "mail.send"
            parametersparams:
              to:
                name: "to"
                value: "info@internal.tld"
 
              commandParameter: true
              from:
                name: "from"
                descriptioninstruction: "The email address of the sender."
  
             detect: true
                commandParameter: true
              subject:
                nameinstruction: "subject"
                description: "Use the subject of the sender's email."
   
            detect: true                 commandParameter: true
              message:
                name: "message"
                descriptioninstruction: "Use the message of the sender's email."
                detect: true
                commandParameter: true

As you can see in this example, there are two command intents configured:

  • One intent will forward the customer email to the support team (=forwardToSupport) and

  • the other one to the info team in case it is related to any other topic (= forwardToInfo).

Each intent has an advice description instruction in order to instruct the AI about the criteria to select this intent. In case such an intent is selected by AI, there is the commandName targetCommand field defining the name of the command which must be finally called. In this example this is the mail.send command.

Intent Parameters

The parameters params section on each intent lists the parameters required to call the command. For the mail.send command these are for example the parameters to, from, subject and message. For each parameter it can be configured whether the AI should auto-detect the value (detect: true, as you can see for the from parameter for example), in this case the description field is mandatory to instruct the AI how to extract the parameter. Or it can be a fixed value (as you can see for the to parameter for example).In order to keep this example simple, we set an email text at the very beginning in the body. This text will be passed to the AI for analysis using the given advice

The parameter attributes are explained below.

name (optional)

The name of the parameter. Under this name it will be passed to the command.

This attribute is optional. If not set, the params id will be used.

required (optional)

Defines whether this parameter is required. In case it is required and value is missing or cannot be detected by AI, an error is thrown.

The default value is false.

type (optional)

The data type of the parameter such as string, boolean, integer, number.

The default value is string.

value (optional)

The value of an intent parameter defines the value to be passed to the command.

This can be a fixed value (literal) or a template. By default the Mustache template syntax can be used which starts with {{ and ends with }}. The variables advice and intent are passed as model context to the template. This way you can access for example settings and values of other parameters after they have been resolved by the AI in order to formulate the final parameter for a command. See this example to construct a message out of advice parameters:

Code Block
languageyaml
...
message:
  value: "The customerId is: {{advice.params.customerId}}"
...

instruction (optional)

For each parameter, an attribute instruction instead of a value can be set. Not both!

In this case the AI will auto-detect the parameter value by reading and applying this instruction and setting the result on the value field automatically. See this example:

Code Block
languageyaml
...
subject:
  instruction: "Use the subject from initial sender email"
...