# Default Messages

The conversation system has several default messages that it uses, in addition to the responses that exist in the task configuration. These default messages have standard values in Answer Server. You can change the default values, for example, if you want to run conversations in a different language, use a different conversational style, or customize the messages to your organization.

To configure default messages, you set the `default_messages` object in your task configuration file. The following sections describe the messages that you can configure.

## Response for Non-Valid Input

The non-valid input response is the value that the conversation system returns when the user input was not recognized, for example because the message did not pass validation.

To modify the default message for non-valid input, add the `default_messages` object and set the `invalid_input` property to the new message.

For example:

    {
       "default_messages" : {
          "invalid_input" : "Je ne comprends pas."
       }
    }

The default value for this message is:

I'm sorry. I didn't understand that.

## Response for Disambiguation

The disambiguation response is the value that the conversation system returns when there are two or more possible responses. For example, if user text triggers more than one task, or if the task sends a question that has multiple interpretations to a Answer Server Fact Bank system.

To modify the default message for disambiguation, add the `ambiguous_input` property to the `default_messages` object. The `ambiguous_input` property is a configuration object.

The following table describes the properties that you can set in the `ambiguous_input` object.

Property | Type | Description
--- | --- | ---
`message` | string | (Optional) The message text to display to the user. This message must include the string `[[ITEMS]]`, which is a special token that Answer Server replaces with the disambiguation items. The default value is `"Which of the following did you mean: [[ITEMS]]?"`.
`item_separator` | string | (Optional) The separator to use between the items in the disambiguation list. The default value is `", "` (that is, a comma and a space).
`last_separator` | string | (Optional) The separator to use between the second-last and last item in the list. The default value is `", or "` (that is, a serial comma and or, with appropriate spaces).
`lua` | string | (Optional) A Lua function to call whenever some user input triggers multiple tasks. See Lua Processing Scripts. The Lua function must accept a `routingTable` object as the first parameter, which is can use to override the response and options. You can optionally also use a `taskUtils` object as the second parameter, if you want to use `taskUtils` methods in your function. This function can change the default prompt to return to the user, and the possible responses and tasks that they route to. The function can access the default prompts and options, as well as user input text, session variables, and so on. The function can optionally route to tasks that were not originally triggered. If the function leaves only one possible task, Answer Server routes to that task immediately without prompting the user. If the function removes all possible tasks, Answer Server behaves as if no tasks were triggered. If the function does not modify the prompt or options, Answer Server uses the default options.

For example:

    {
       "default_messages" : {
          "ambiguous_input" : {
             "message": "Which one of [[ITEMS]] did you mean?",
             "item_separator": "/",
             "last_separator": "/"
          }
       }
    }

This example results in a disambiguation message of the following form:

Which one of order breakfast/order lunch/order dinner did you mean?

The default configuration gives a disambiguation message of the following form:

Which of the following did you mean: order breakfast, order lunch, or order dinner?

## Response for Multiple Answer Disambiguation

The multiple answer disambiguation is the message that the conversation system returns if an `Ask` action sent as part of the conversation returns multiple possible answers.

This configuration allows you to set different messages depending on the type of answer that is requested. For more information about the types of questions that Answer Server can parse, see The Question Parser Eduction Grammar.

To modify the default message for disambiguation, add the `multiple_answers_disambiguation` property to the `default_messages` object. The `multiple_answers_disambiguation` property is a configuration object.

The following table describes the properties that you can set in the `multiple_answers_disambiguation` object.

Property | Type | Description
--- | --- | ---
`entity` | object | (Optional) An object that describes the message to display when a question about a particular entity returned multiple answers. This object can contain the following properties: `message` (string). Optional. The message text to display to the user. This message must include the string `[[ITEMS]]`, which is a special token that Answer Server replaces with the disambiguation items. It can also include the string `[[ENTITY]]`, which is a special token that Answer Server replaces with the name of the entity in the question. The default value is `"Found multiple possibilities for '[[ENTITY]]', which did you mean: [[ITEMS]]?"`. `item_separator` (string). Optional. The separator to use between the items in the disambiguation list. The default value is `", "` (that is, a comma and a space). `last_separator` (string). Optional. The separator to use between the second-last and last item in the list. The default value is `", or "` (that is, a serial comma and or, with appropriate spaces).
`qualifier_code` | object | (Optional) An object that describes the message to display when a question returned multiple answers with different qualifiers that you can use to determine the correct answer to use. This object can contain the following properties: `message` (string). Optional. The message text to display to the user. This message must include the string `[[ITEMS]]`, which is a special token that Answer Server replaces with the disambiguation items. The default value is `"Got multiple answers. Choose a qualifier to disambiguate on: [[ITEMS]]?"`. `item_separator` (string). Optional. The separator to use between the items in the disambiguation list. The default value is `", "` (that is, a comma and a space). `last_separator` (string). Optional. The separator to use between the second-last and last item in the list. The default value is `", or "` (that is, a serial comma and or, with appropriate spaces).
`qualifier_value` | object | (Optional) An object that describes the message to display when a question returned multiple answers with different qualifiers that you can use to determine the correct answer to use. This object can contain the following properties: `message` (string). Optional. The message text to display to the user. This message must include the string `[[ITEMS]]`, which is a special token that Answer Server replaces with the disambiguation items. The default value is `"Which value did you want to filter by: [[ITEMS]]?"`. `item_separator` (string). Optional. The separator to use between the items in the disambiguation list. The default value is `", "` (that is, a comma and a space). `last_separator` (string). Optional. The separator to use between the second-last and last item in the list. The default value is `", or "` (that is, a serial comma and or, with appropriate spaces).
`additional_choices` | object | (Optional) An object that describes additional messages to return . This object can contain the following properties: `all_answers` (string). Optional. The message text to display to allow the user to choose to return all available answers. The default value is `Return all answers`. `reject_answers` (string). Optional. The message text to display to allow the user to choose to reject all available answers. The default value is `None of these`.
`rejected_answers` | object | (Optional) An object that describes the message to display when the user rejects the available answers. This object can contain the following properties: `message` (string). Optional. The message text to display to the user. The default value is `I'm sorry, I don't have an answer for that."`.

For example:

    "default_messages": {
       "multiple_answers_disambiguation": {
          "entity": {
             "message": "I found several possible matches for '[[ENTITY]]'. Which of the following matches your intent: [[ITEMS]]?"
          },
          "qualifier_code": {
             "message": "I found multiple answers for that. Pick one of these qualifiers to clarify your original question: [[ITEMS]]"
          },
          "qualifier_value": {
             "message": "I have several answers for you, but I need more information to give you the best one. Choose one of the following values: [[ITEMS]]"
          },
          "additional_choices": {
             "all_answers": "I want it all",
             "reject_answers": "That's not helpful"
          },
          "rejected_answers": {
             "message": "Then I'm afraid I can't help you with your question, because I have no further information."
          }
       }
    }

TIP: When the `Converse` action calls out to the `Ask` action to ask a question, Answer Server returns the possible answers in the `Converse` action response, along with the disambiguation information. At this point, you can use the special string `ANSWER_NUMBER_N` in the `Text` parameter of the `Converse` action to return a particular answer from the list, where `N` is the number of the answer (starting from 0).

_FT_HTML5_bannerTitle.htm