Skip to main content

Node - #start#

Overview

  • The "#start#" node is the only starting node that a ChatTree must have (for the Xmind ChatTree, it can only be the default center node when creating a new Xmind file)
  • For Xmind ChatTree, the first line of the node content must be "#start#", and then the content starting from the second line is the following attributes (each attribute starts with "@" and two parts are separated by "=". The first part is the attribute name, followed by the attribute content, and the attribute content can be multiple lines), such as:
    #start#
    @... = ...
    @... =
    ...
    ...
    ...
    @... = ...|...|...
  • For Python ChatTree, the first parameter of chattree.create_node() must be "#start#", and the second parameter dict contains the following keys (i.e. attributes). If there is no special explanation, the value (i.e. attribute content) type is str, such as:
    start_node = chattree.create_node("#start#", {
    "...": "...",
    "...": ["...","..."],
    "...": "...\n...\n",
    "...": [{"...":"...","...":"...","...":"..."}, ...],
    })
  • This node is found in several ChatTree examples in "ChatTree Examples"

"chattree_title" attribute

(Xmind ChatTree is in the form of "@chattree_title = ...")

  • Use a short sentence or phrase to clearly describe the scene of the current ChatTree (such as "911 emergency telephone service", "rail freight information inquiry and service", etc.). If the scene is complicated and difficult to describe, you can write it as "dialogue"
  • (If the ChatTree is the starting main ChatTree) This attribute is required
  • This attribute is present in several ChatTree examples in "ChatTree Examples"

"system_role" attribute

(The Xmind ChatTree is in the form of "@system_role = ...")

  • Refers to the role that the AI ​​system plays in the dialogue, such as “AI customer service robot”
  • (If the ChatTree is the starting main ChatTree) This attribute is required
  • This attribute is present in several ChatTree examples in "ChatTree Examples"

"user_role" attribute

(The Xmind ChatTree is in the form of "@user_role = ...")

  • Refers to the role of the user who talks to the AI, which can be a user of the website, app or phone, such as "law firm consulting client"
  • (If the ChatTree is the starting main ChatTree) This attribute is required
  • This attribute is present in several ChatTree examples in "ChatTree Examples"

"allow_transfer_human_agent" attribute

(The Xmind ChatTree is in the form of "@allow_transfer_human_agent =...")

  • Optional values ​​are "true" or "false"
  • (If the ChatTree is the starting main ChatTree) This attribute is required
  • This attribute is present in several ChatTree examples in "ChatTree Examples"

"background_information" attribute

(Xmind ChatTree is in the form of "@background_information = ...")

  • Its content describes the background information of the entire dialogue, including but not limited to:
    • Dialogue scene information
    • The specific tasks to be accomplished in the dialogue
    • Dialogue communication methods and requirements
    • Global and easily confusing key terms and related explanations in this dialogue scenario (such as the example below). Other conceptual clarifications of locality can be put into "InfoItem Constraint" (see "InfoItem") or "Intent Constraint" (see "Intent")
      Vehicle damage insurance is referred to as "car damage insurance", third party liability insurance is referred to as "three-party insurance", vehicle occupant liability insurance is referred to as "seat insurance", driver and passenger accident insurance is referred to as "driving insurance", driver accident insurance is referred to as "driving accident insurance", and additional motor vehicle value-added services. These six are different types of insurance/services and cannot be confused.
      The car owner, the insured, and the policy holder may be different people, especially the car owner is not necessarily the policy holder.
      Policy contact phone number, return visit phone number, car owner phone number, policyholder phone number, insured phone number, etc. may or may not be the same.
      Note that there is no need to explain the role information unless the role is described in detail
  • It can only be a descriptive description, and cannot contain questions or requests, etc.
  • It can be multiple lines
  • (If the ChatTree is the starting main ChatTree) This attribute is required
  • This attribute is present in several ChatTree examples in "ChatTree Examples"

"code_file" attribute

(This attribute is only required by Xmind ChatTree, that is, in the form of "@code_file = ..."; not required by Python ChatTree)

  • The content is the name of an uploaded Python code file. Complex code logic can be implemented in this code file.
  • The functions defined in the code file can be called by Python scripts in multiple places in the Xmind ChatTree (for details of where the Python scripts are, see "Python Script/Function")
  • Functions in all ChatTree code files in the ChatTree call stack (referring to calls implemented through "#activity#call_sub_tree") can be called (also limited to Xmind ChatTrees)
  • For details, please refer to "code file"

"static_reference_information" attribute

(The Xmind ChatTree is in the form of "@static_reference_information = ...")

  • Can carry a massive RAG knowledge base (AI automatically quotes and replies on demand in each round of interaction)
  • There can only be one *.md or *.word or *.zip file name (see "Knowledge Base"), with or without the file name suffix, but it cannot contain characters such as decimal point (the decimal point before the file suffix is ​​not counted), minus sign and square brackets
  • This attribute is optional
  • "ChatTree Examples" The "TMC", "hospital_registration" and "first_aid_qa" ChatTree examples all have this attribute

"dynamic_reference_information" attribute

(The Xmind ChatTree is in the form of "@dynamic_reference_information = ...")

  • Dynamically obtain reference information by executing scripts, suitable for information that needs to be dynamically obtained or generated
  • For the Xmind ChatTree, each line of attribute content is divided into two parts separated by "-->":
    • The first part is the intent, in which "(...constraint...)" is optional[note that only parentheses are allowed here]; for more information, see "intent"
    • The latter part is Python's str expression script, which can access InfoItems based on ctx and can also call Python functions in code files (can be defined in "code file"). For more information, see "Python Script/Function"
    • For example:
      @dynamic_reference_information =
      ...... --> ("......" if ctx["{...}"] == "..." else "......")
      ......(......) --> xxxx_func(ctx)
  • For Python ChatTree, the attribute content is a list, each element of the list is a dict, and there are 3 keys in the dict:
    • "intent": User intent, see "Intent" for more information
    • "intent_constraint": that is, the constraint of the user's intent. This key is optional. For more information, see "Intent"
    • "function": Python function name or lambda expression that returns a str value (function definition or lambda must take a ctx parameter, and the InfoItem can be accessed based on ctx), for more information, see "Python Script/Function"
    • like:
      def xxxx_func(ctx):
      ...ctx["{...}"]...
      return a_str_var
      start_node = chattree.create_node("#start#", {
      ...
      "dynamic_reference_information": [
      {
      "intent": "...",
      "function": xxxx_func
      },
      {
      "intent": "...",
      "intent_constraint": "...",
      "function": lambda ctx : ...ctx["{...}"]...
      },
      ],
      ...
      })
  • During the dialogue, AI will dynamically call relevant functions or scripts according to the user's intents to obtain reference information, and answer the user's relevant questions or requirements based on this reference information
  • This attribute is optional
  • The "TMC" ChatTree example in "ChatTree Examples" has this attribute

"intent_trigger" attribute

(The Xmind ChatTree is in the form of "@intent_trigger = ...")

  • During the dialogue, when the content entered by the user hits a certain intent, the corresponding script or function will be executed.
  • For the Xmind ChatTree, each line of attribute content is divided into two parts separated by "-->":
    • The first part is the intention, in which "(...constraint...)" is optional[note that only parentheses are allowed here]; for more information, see "intent"
    • The latter part is a Python script that can access InfoItems based on ctx and can also call Python functions in code files (can be defined in "code file"), for more information, see "Python Script/Function"
    • For example:
      @intent_trigger =
      ...... --> ctx["{...}"] == "..."
      ......(......) --> xxxx_func(ctx)
  • For Python ChatTree, the attribute content is a list, each element of the list is a dict, and there are 3 keys in the dict:
    • "intent": User intent, see "Intent" for more information
    • "intent_constraint": that is, the constraint of the user's intent. This key is optional. For more information, see "Intent"
    • "function": Python function name or lambda expression (function definition or lambda must have a ctx parameter, and the InfoItem can be accessed based on ctx), for more information, see "Python Script/Function"
    • like:
      def xxxx_func(ctx):
      ...
      ctx["{...}"] = "..."
      ...
      start_node = chattree.create_node("#start#", {
      ...
      "intent_trigger": [
      {
      "intent": "...",
      "function": xxxx_func
      },
      {
      "intent": "...",
      "intent_constraint": "...",
      "function": lambda ctx: ...
      },
      ],
      ...
      })
  • This attribute is optional
  • "TMC_book_flights" ChatTree example in "ChatTree Examples" has this attribute

"language_style" attribute

(Xmind ChatTree is in the form of "@language_style = ...")

  • Refers to the language style of the AI. The value can be "normal" / "spoken" / "written"
  • This attribute is optional (if there is no such attribute, the AI ​​language style defaults to "normal")

"response_script" attribute

(The Xmind ChatTree is in the form of "@response_script = ...")

  • Can carry a large amount of "service words", "sales words", etc. that are pre-standardized in communication with customers (AI automatically quotes and replies on demand in each round of interaction)
  • For the Xmind ChatTree, each line of attribute content is divided into two parts separated by "-->":
    • The first part is "intent", which can be followed by "(...constraint...)" (optional). For more information, see "intent"
    • For the latter part of "response", see "Text Output". Be careful not to conflict with the content of the background information.
    • For example:
      @response_script =
      Express purchase intention --> Hello! We are happy to serve you. Are you interested in our products?
      Consult product features (including questioning product capabilities) --> Our products have a variety of powerful features, including...
  • For Python ChatTree, the attribute content is a list, each element of the list is a dict, and there are 3 keys in the dict:
    • "intent": User intent, the value is of str type, see "Intent" for more information
    • "intent_constraint": that is, the constraint of the user's intention, the value is of str type, the key is optional
    • "response": output of the response_script content, the value is str or list[str] type, see "Text Output", be careful not to conflict with the content of the background information here.
    • like:
      start_node = chattree.create_node("#start#", {
      ...
      "response_script": [
      {
      "intent": "...",
      "response": "..."
      },
      {
      "intent": "...",
      "intent_constraint": "...",
      "response": "..."
      },
      ],
      ...
      })
  • This attribute is optional
  • The "TMC" ChatTree example in "ChatTree Examples" has this attribute

"fixed_closing_remarks" attribute

(The Xmind ChatTree is in the form of "@fixed_closing_remarks =...")

  • When the AI ​​actively ends the dialogue or the user requests to end the dialogue, the AI ​​system expresses the closing words to the user, such as "Goodbye!"
  • This attribute is optional (if there is no such attribute, the AI ​​system will dynamically generate relevant closing remarks)

"on_infoitem_change_trigger" attribute

(The Xmind ChatTree is in the form of "@on_infoitem_change_trigger =...")

  • For the Xmind ChatTree, each line of attribute content is divided into two parts separated by "-->":
    • The first part is the name of one or more InfoItems. If there are multiple InfoItems, separate them with "|" (such as "{...}|{...}|{...}"), which cannot be system InfoItems.
    • The latter part is a single-line Python script. In the script, InfoItems can be accessed or assigned based on ctx, and functions defined in "code file" can be called. For more information, see "Python Script/Function"
    • For example:
      @on_infoitem_change_trigger =
      {...} --> ...; ctx[{...}] = ...; ...
      {...}|{...} --> xxxx_func(ctx)
  • For Python ChatTree, the attribute content is a list, each element of the list is a dict, and there are 2 keys in the dict:
    • "infoitem": It is a list. Each element in the list is an InfoItem name ("{...}"), which cannot be a system InfoItem.
    • "function": a Python function name or lambda expression (function definition or lambda must have a ctx parameter and InfoItems can be accessed or assigned based on ctx), for more information, see "Python Script/Function"
    • like:
      def xxxx_func(ctx):
      ...
      ctx["{...}"] = "..."
      ...
      start_node = chattree.create_node("#start#", {
      ...
      "on_infoitem_change_trigger": [
      {
      "infoitem": ["{...}"],
      "function": xxxx_func
      },
      {
      "infoitem": ["{...}","{...}","{...}"],
      "function": lambda ctx: ...
      },
      ],
      ...
      })
  • The function of this attribute is that during the dialogue process, when the value of the relevant InfoItem changes (including when the status of the InfoItem changes between "have value" and "no value"), the relevant script or function will be automatically executed. In this way, when the value of some InfoItems changes (especially changes caused by user input), the execution of the corresponding business logic code will be automatically triggered. Common scenarios include:
    • Automatic verification. If it is not compliant, the value of the InfoItem can be cleared (equivalent to the user not inputting it) or changed to other compliant values.
    • Automatically update the values ​​of other InfoItems (typically calculated InfoItems, such as "{XXXX_summarized_amount}", etc.)
    • Maintain consistency between two InfoItems, such as InfoItem "{is_there_real_estate}" and "{quantity_of_real_estate}": when the value of the former becomes "No", the value of the latter is automatically changed to "0", and vice versa, that is, if the value of the latter becomes a number greater than "0", the value of the former is automatically changed to "Yes", and if the value of the latter becomes "0", the value of the former is automatically changed to "No"
    • Automatically call external interfaces
  • This attribute is optional
  • "TMC_book_flights" ChatTree example in "ChatTree Examples" has this attribute

"startup_infoitem" attribute

(The Xmind ChatTree is in the form of "@startup_infoitem =...")

  • For Xmind ChatTree, the attribute content is a single line of InfoItem name ("{...}"). If there are multiple, they are separated by "|", such as "{...}|{...}|{...}"
  • For Python ChatTrees, the attribute content is a list, and each element in the list is an InfoItem name ("{...}")
  • When the ChatTree is started as the main tree, if no relevant startup InfoItems are passed in, the dialog cannot be started successfully; if there are multiple InfoItems in the startup parameters, they must be also separated by "|", such as "{...}=...|{...}=...|{...}=...", see "API" and "Dialogue Test"
  • This attribute will be ignored when the ChatTree is called as a subtree
  • This attribute is optional
  • The "TMC" and "911" ChatTree examples in "ChatTree Examples" have this attribute
  • The content of the "chattree_title", "system_role", "user_role", "background_information", "fixed_closing_remarks", "allow_transfer_human_agent", "startup_infoitem", "language_style" attributes of the "#start#" node of the root ChatTree of the ChatTree call stack (possibly the current ChatTree) will be used, and the corresponding attribute contents of the other called sub-ChatTrees will be ignored.
  • If the "#start#" node of the current ChatTree has the "static_reference_information" attribute, the attribute content of the current ChatTree will be used. Otherwise, the attribute content of the parent ChatTree with this attribute that is closest to the current ChatTree in the ChatTree call stack will be used (if neither exists, it will not be used); the attribute content of other ChatTrees will be ignored.
  • The "dynamic_reference_information", "intent_trigger", "code_file", "response_script", "on_infoitem_change_trigger" attributes of the "#start#" node of the current ChatTree and all parent ChatTrees of the ChatTree call stack will be used (if the "response_script" attribute has multiple response with the same "intent", the response closest to the current ChatTree shall prevail)