Skip to main content

Node - #single_turn_interact#

Only "#single_turn_interact#" and "#multi_turn_interact#" are the "only two" nodes that can interact with the user, and the InfoItems defined in these two types of nodes will be extracted from the user input.

Xmind ChatTree

For the Xmind ChatTree, the first line of the node content must be "#single_turn_interact#", and then only the second line:

  • The content of the second line is the front and back parts separated by "="
  • The part before "=" is the InfoItem related content:
    • The first piece is the InfoItem "{...}", enclosed in curly brackets on both sides. For details, see "InfoItem"
    • The second piece is the InfoItem constraint "(...)", enclosed in parentheses on both sides. For details, see "InfoItem", optional
    • The third piece is a number of values ​​"[...|...|...]" separated by "|" for InfoItem modifier or question modifier, enclosed in square brackets on both sides. For specific instructions, please see the corresponding part in the Python ChatTree below (appearance means "yes", not appearing means "no"), optional
  • The part after "=" is a system question. For details, see "Text Output"
  • Such as:
    #single_turn_interact#
    {The_caller_current_specific_location}(detailed address required, including community, building number, house number, etc.) [explicit|repeat|required] = Where are you now? Please provide detailed address, including community, building number, house number, etc.

Python ChatTree

For Python ChatTrees, the first parameter of chattree.create_node() must be "#single_turn_interact#", and the second parameter dict contains several keys:

  • "infoitem": The value is the name of a single InfoItem, str type, for details, see "InfoItem"
  • "infoitem_synonym": The value is a list, including several InfoItem synonyms (str type). The format requirements of these synonyms are the same as "InfoItems"; synonyms are mainly used to increase the success rate of information extraction in some extreme cases (In most cases, synonyms do not need to be defined). For example, for the InfoItem {flight_landing_city}, if the user input is "book a ticket and fly to Beijing the day after tomorrow", a synonym is added at this time {which_city_to_fly_to} will greatly improve the success rate of information extraction; only Python ChatTrees support synonyms; this key is optional; the "TMC_book_flights" ChatTree example in "ChatTree Examples" has this attribute
  • "infoitem_constraint": The value is the constraint of the InfoItem, str type, for details, see "InfoItem", this key is optional; "TMC_book_flights" and "hospital_registration" ChatTree examples in "ChatTree Examples" have this attribute
  • "infoitem_modifier": The value is a list, including several InfoItem modifier values ​​(str type). The specific description of these values ​​​​is as follows (appearance means "yes", not appearing means "no"); this key is optional
    • "implicit": Indicates that when the user provides the answer to the InfoItem, it can be an indirect implicit expression; the "TMC_book_flights" and "911" ChatTree examples in "ChatTree Examples" have the modifier value of InfoItem
    • "explicit": Indicates that when the user provides the answer to the InfoItem, it must be a direct and clear expression; this attribute can also be used to deal with certain InfoItems that are likely to cause LLM hallucinations; the "TMC_book_flights" and "911" ChatTree examples in "ChatTree Examples" have this InfoItem modifier value
    • "verbatim": Some concepts will still cause errors even if they use the "explicit" modifier. Use this attribute, that is, the user's reply is required to completely contain the literal content of a "#user_intent#" sub-node behind the node (that is, the #single_turn_interact# node with this InfoItem modifier must have a "#user_intent#" sub-node after it)
    • "Repeat": Means that when the system replies, it will automatically repeat the content of the InfoItem (that is, the content of the user's answer) for the user to confirm; the "TMC_book_flights" and "911" ChatTree examples in "ChatTree Examples" have this InfoItem modifier value
    • "fixed": Indicate that this InfoItem can only be assigned a value in the interaction of this "#single_turn_interact#" node (that is, no global information extraction will be performed on the InfoItem, so it cannot be answered in advance or modified later); In some cases, if there is a "#user_intent#" child node behind it and there is an InfoItem of the "#single_turn_interact#" node of the child node after the child node, and if the InfoItem name contains "whether", you may need to set this modifier value; the "TMC_book_flights" and "911" ChatTree examples in "ChatTree Examples" have this InfoItem modifier value
    • "required": The user cannot refuse to answer the question of this InfoItem. If the user does not answer or refuse to answer, the question will be repeated; without this modifier, if the user refuses to answer the question, the InfoItem will be assigned the value "None" (note: only the InfoItems defined in "#single_turn_interact#" can be recognized by the system as refusal to answer); "TMC_book_flights" and "911" ChatTree examples in "ChatTree Examples" has this InfoItem modifier value
    • "incremental": Means that the content of the InfoItem provided by the user is constantly increasing, and the system will automatically add the content of the user's multiple answers together. For example, the {address} InfoItem is first "community name", then "community name + building number", and finally "community name + building number + house number"; In addition, descriptive InfoItems such as {..._case_facts}, {..._reasons} and {..._results} may also be incremental; "911" ChatTree example in "ChatTree Examples" has this InfoItem modifier.
    • "topic": Indicates that the node where the InfoItem is located is a topic node. The node must be followed by several "#user_intent#" nodes and the "intent" attribute of each "#user_intent" node is a topic. The so-called topic management refers to switching the dialogue content between these topics.
      • You can enter/switch/re-enter/exit a topic at any time during the dialogue. Similarly, you can only enter and exit a trigger (referring to the "#user_intent#" node's "intent" attribute after the "#trigger#" node, see "Node - #trigger#")
      • Every time you enter/switch/re-enter a topic, the InfoItems of all subsequent "#single_turn_interact#" nodes will be cleared (except for the InfoItems the user has just input).
      • A ChatTree can only have one topic node, but it will be ignored when it is called as a subtree, that is, only the topic node in the first parent ChatTree is valid (but this situation can be used to more accurately constrain the semantics of the InfoItem name of the "#single_turn_interact#" node)
      • The "TMC" ChatTree example in "ChatTree Examples" has this InfoItem modifier
    • "json": Indicates that the InfoItem stores information in JSON format, which is generally used to save multi-line table information, such as "{flight_passenger_information}". At the same time, InfoItem constraint are required to specify specific format requirements, such as "including 'Name', 'Document Type' and 'Document Number'", and then the stored InfoItem value may be [{"Name":"Richard Brown","Document Type":"REAL ID","Document Number":"12091234"},[{"Name":"Henry Jones","Document Type":"Passport","Document Number":"CD123456"}], for details on how to use json values, see "Python Script/Function"; "TMC_book_flights" ChatTree example in "ChatTree Examples" has this InfoItem modifier
    • Best Practices:
      • InfoItems for judgment may need to be "required" and "fixed"
      • Most of the InfoItems for final information confirmation need to be "explicit"
  • "infoitem_options": The value is a list whose elements are str. For details, see "InfoItem". This key is optional; this key is only supported by python ChatTree; "TMC_book_flights" and "hospital_registration" ChatTree Examples in "ChatTree Examples" have this attribute
  • "infoitem_options_modifier": The value is a list whose elements are str. For details, see "InfoItem". This key is optional; this key is only supported by python ChatTree; "TMC_book_flights" and "hospital_registration" ChatTree Examples in "ChatTree Examples" have this attribute
  • "system_question": The value is the system question text, str or list[str] type, for details, see "Text Output"; "TMC_book_flights" and "911" ChatTree Examples in "ChatTree Examples" have this attribute
  • "question_modifier": The value is a list, including several question modifier values ​​(str type). The specific description of these values ​​​​is as follows (appearance means "yes", not appearing means "no"); this key is optional
    • "rephrase": The system question will be reorganized and then output (the meaning will not change)
    • "always_ask_repeatedly": At this node, if the user does not answer the question of this node, the AI ​​will definitely ask again
    • "never_ask_repeatedly": At this node, if the user does not answer the question at this node, the AI Never ask again, even if the user does not answer the question (at this time, the dialogue status will always stay at this node); this attribute and "always_ask_repeatedly" cannot appear at the same time. If neither attribute appears, the default situation is: when the user does not answer the question of the node, if the user's answer triggers (dynamic/static) reference information or triggers response scripts, the question will not be asked again, and if neither is triggered, the question will be asked again; "TMC" ChatTree example in "ChatTree Examples" has this question modifier
  • "execute_script_before_asking": The value is a function, see "Python Script/Function" for details; this key is optional and is not supported by the xmind ChatTree; the "TMC_book_flights" ChatTree example in "ChatTree Examples" has this attribute
  • "inform_user_before_asking": The value is of str or list[str] type, see "Text Output" for details; this activity will be executed after executing "execute_script_before_asking"; this key is optional and is not supported by xmind ChatTree; "TMC_book_flights" ChatTree example in "ChatTree Examples" has this attribute
  • "structured_output_before_asking": The value is of str type, and its function is equivalent to "Node - #structured_output#"; this activity will be executed after executing "execute_script_before_asking"; this key is optional, and the xmind ChatTree does not support it; "TMC_book_flights" ChatTree example in "ChatTree Examples" has this attribute

Others

  • There is no need to add various modal particles in front of the system question text, such as "ok", "then", etc.
  • The name of the InfoItem must match the text of "system_question". For example, when the question is "Have the two parties reached a preliminary consensus?", the corresponding InfoItem name should be {do_both_parties_have_preliminary_consensus}, not {the_consensus_reached_by_both_parties}; if the InfoItem must be {the_consensus_reached_by_both_parties}, then the system question should be "What consensus has the two parties reached?"
  • "TMC", "TMC_book_flightss", and "911" ChatTree examples in "ChatTree Examples" have this node