Findout¶
XML element: a question-raising plan item. A findout asks the user or invokes the configured question source to resolve its question. It differs from raise, which raises an issue without imposing the same findout plan behavior.
Syntax¶
| Attribute | Type | Default | Meaning |
|---|---|---|---|
type | question type | wh_question | One of goal, wh_question, kpq, alt_question, or yn_question. |
predicate | ontology predicate | — | Identifies a predicate-backed question when required by its type. |
allow_answer_from_pcom | Boolean | false | Allows compatible answers from the user's previous commitments to be considered. |
alts_predicate | ontology predicate | — | For a wh-question, supplies fact-backed alternatives from this predicate. |
force | Boolean | false | For a predicate-backed wh or yes/no question, forgets stored values for its predicate before asking. |
findout can be used in a goal plan, postplan, or a conditional plan. Its question form depends on type:
| Type | Question content |
|---|---|
goal | Asks which goal/action is relevant; no predicate is needed. |
wh_question | Uses the named predicate, e.g. predicate="destination". |
yn_question | Uses a Boolean predicate or a proposition/goal child. |
alt_question | Contains one or more alt children, each naming an alternative proposition or goal. |
kpq | Contains an embedded_question describing the question whose answer is known. |
Parents and question children¶
findout may appear in a <plan>, <postplan>, or a <then>/<else> plan inside <if>. Its question content can be supplied by attributes or by child elements:
| Child | Use |
|---|---|
proposition | Predicate proposition, commonly the content of a yes/no question. |
perform | Perform-goal alternative, including a yes/no action question. |
resolve | Resolve-goal alternative. |
alt | Wraps an explicit alternative; repeat for each alternative. |
embedded_question | The embedded question of a KPQ. |
A KPQ embeds the question whose knowledge is being checked:
Behavior¶
The DME raises the question represented by the plan item. When the DDD has question parameters, the configured domain/service query and question parameters may determine the answers or wording. allow_answer_from_pcom allows a compatible answer in the user's previous commitments to be reused; TDM applies its confidence and grounding rules before integrating that answer.
For a wh-question with alts_predicate, TDM collects positive known facts for that predicate. A single fact can be posed as a yes/no question; multiple facts can be posed as an alternative question. Define the ontology predicate with multiple_instances="true" when the domain needs to retain several values for it. A configured max_spoken_alts can limit the alternatives that are presented.
allow_answer_from_pcom is an XML Schema Boolean and defaults to false. Omit the attribute or set it to false/0 to prevent reuse; set it to true/1 to allow a compatible answer from the user's previous commitments. DDD JSON expresses the same option as a JSON Boolean.
In XML, force="true" or force="1" is shorthand for a <forget> plan item for the question's predicate immediately before the <findout>. It is supported only for predicate-backed wh_question and yn_question forms. Other question forms, and yes/no questions about goals, cannot be forced because they do not identify one predicate. Omit force or set it to false/0 for ordinary findout behavior. DDD JSON has no force option; place a forget item before the findout item instead.
Forced findouts rely on the DME preserving a findout after preceding non-findout items in the plan until those items have executed.
Examples¶
WH and yes/no questions:
<findout type="wh_question" predicate="destination"/>
<findout type="yn_question" predicate="need_visa"/>
<findout type="goal"/>
Forget an earlier answer before asking a yes/no question again:
Tala compiles this to:
Explicit alternatives, where each alternative is a question or goal proposition:
<findout type="alt_question">
<alt><resolve type="wh_question" predicate="monthly_payment"/></alt>
<alt><resolve type="wh_question" predicate="interest_rate"/></alt>
</findout>
An alternative may also be a perform goal:
KPQ in DDD JSON uses a nested question object:
Fact-backed alternatives and prior-commitment reuse:
<findout type="wh_question" predicate="animal"
alts_predicate="available_animal"
allow_answer_from_pcom="true"/>
DDD JSON equivalent for a basic wh-question:
See domain XML, DDD JSON, and Alternatives for additional alternative-question forms.
Tala reference and tests¶
- XML parsing/defaults:
tala/ddd/ddd_xml_compiler.py - JSON compilation:
tala/ddd/ddd_json_compiler.py - Plan item model:
tala/model/plan_item.py - Tala tests:
tala/ddd/test/test_ddd_xml_compiler.pyandtala/ddd/test/test_ddd_json_compiler.py