The application discloses a behavior tree automatic generation method and device based on a large
language model and
electronic equipment, relates to the technical field of
artificial intelligence and
automatic control, and comprises the following steps: acquiring task description information, constructing a node variable
context object, injecting a structured prompt word, and forming a resource constraint-aware generation context; according to a
semantic vector of the task description, searching for high-quality cases that meet a quality threshold, screening dynamic few-sample examples through a
selection algorithm, and embedding generation prompt words; calling a large
language model deployed locally to generate a behavior tree, performing
syntax checking and logic defect detection on the generation result through an evaluation operator, converting a detection failure result into structured feedback information, driving the model to perform minimum iteration refinement until the checking is passed or the maximum number of iterations is reached. The application solves the problems of low availability, poor stability and high deployment cost of the large
language model in generating the behavior tree, and enables a lightweight large language model to achieve a generation success rate of about 90% on
consumer-grade hardware.