A multi-module cooperative-based multi-round interactive AI agent and an implementation method thereof
By using modular design and dynamic prompt generation mechanism, the illusion problem caused by small-sized large language models in agent systems due to task complexity exceeding processing capacity is solved, achieving stability and accuracy in multi-turn dialogue, reducing maintenance costs, and improving user interaction efficiency and system flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YIZHIWEISI (BEIJING) INTELLIGENT TECHNOLOGY CO LTD
- Filing Date
- 2025-07-31
- Publication Date
- 2026-05-08
AI Technical Summary
In existing agent systems, small-sized large language models are prone to illusions due to task complexity exceeding processing capacity, leading to model misjudgment of intent and incorrect parameter extraction. Traditional dialogue systems cannot determine whether user input is a continuation of the previous task, resulting in context loss and task interruption. Furthermore, static prompt word templates cannot adapt to new tasks, resulting in high maintenance costs.
It adopts a modular design, including modules for information acquisition, dialogue state judgment, intent recognition, parameter extraction, rule engine, and dialogue strategy. Through module collaboration, it achieves functional decoupling, dynamically generates prompt words, uses the rule engine for parameter verification, and manages multi-turn dialogue context in conjunction with dialogue state judgment.
It effectively avoids model illusion, improves the accuracy of tool calls and system stability, ensures the continuity of multi-round interactions, reduces maintenance costs, and improves user operation efficiency and system flexibility.
Smart Images

Figure CN121009985B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and in particular to a multi-turn interactive AI agent based on multi-module collaboration and its implementation method. Background Technology
[0002] In recent years, with the enhancement of Large Language Models (LLMs) capabilities, agent-based intelligent systems have rapidly developed in various task-oriented automation applications. A typical agent system possesses "perception-decision-action-memory" capabilities, enabling it to complete complex tasks driven by user natural language by invoking specialized external tools in the industrial field (such as anomaly detection, time series prediction, SPC process quality analysis, and capability analysis tools). For example:
[0003] Natural language is used to invoke anomaly detection tools to detect whether there are any anomalies in a specified production line or process over a certain period of time; natural language is also used to invoke SPC process quality analysis and capability analysis tools to analyze the stability of a specified production line or process.
[0004] Technical problems with parameter extraction in the current Agent system:
[0005] 1. The "illusion" of the model caused by task mixing
[0006] Existing systems integrate tasks such as intent recognition, parameter extraction, and missing parameter guidance into a single natural language understanding module. Especially when using a small-sized, large-language model (such as Qwen2.5-14B), the model is prone to "illusions" due to the complexity of the task exceeding its processing capacity. For example, when a user asks "check the pressure of the L500 production line", the model may misjudge the intent as "equipment maintenance" or fabricate "temperature parameters", leading to incorrect tool calls.
[0007] 2. Traditional dialogue systems cannot determine whether the user's current input is a continuation of the previous task, which often leads to loss of context, repeated input of parameters, and task interruption, affecting interaction efficiency and user experience.
[0008] 3. Traditional systems use static prompt templates, which cannot adapt to contextual changes and diverse semantic requirements caused by new tasks / tools. Expanding with new tools requires manual modification of code and prompt templates, resulting in high maintenance costs and untimely response.
[0009] Based on this, we propose a multi-turn interactive AI agent based on multi-module collaboration and its implementation method. Summary of the Invention
[0010] To address the technical challenges of small-sized, large-language models (such as Qwen2.5-14B) in handling complex parameter extraction, multi-task mixing, and multi-turn dialogue, including issues such as illusion, decreased stability, and reduced accuracy, this invention provides a multi-turn interactive AI agent based on multi-module collaboration and its implementation method.
[0011] To address the aforementioned issues, this invention provides a multi-module collaborative, multi-round interactive AI Agent and its implementation method. Modular design achieves decoupling and collaboration of various functions. The specific technical solution is as follows:
[0012] The intelligent agent includes an information acquisition module, a dialogue state judgment module, an intent recognition module, a parameter extraction module, a rule engine module, and a dialogue strategy module. The collaborative workflow of each module is as follows:
[0013] The information acquisition module serves as the knowledge support hub, maintaining the structured definition information of tools (including names, functions, parameters, constraint rules, etc.), historical dialogue knowledge base, and dynamically generating prompt words to provide real-time data support for other modules.
[0014] Dialogue Status Judgment Module: This module is used to determine whether the user's current input is a continuation of the previous task; it is connected to the information acquisition module and is used to determine whether the user's current input is a continuation of the previous task based on the previous dialogue information and the historical dialogue knowledge base.
[0015] Intent recognition module: This module uses a large language model to recognize the intent of the user's input;
[0016] Parameter extraction module: connects the information acquisition module and the intent recognition module, and is used to generate extraction prompt words according to the parameter definition of the tool after the intent recognition module completes intent recognition, and extract structured parameters from user input;
[0017] Rule Engine Module: Connects the parameter extraction module and the information acquisition module, and is used to perform integrity and legality verification on the structured parameters extracted by the parameter extraction module according to the tool parameter constraint rules provided by the information acquisition module;
[0018] Dialogue Strategy Module: When parameter validation fails, this module generates natural language prompts based on missing or invalid fields to guide the user to complete the input.
[0019] As a further optimization of the present invention, the tool structure definition information maintained by the information acquisition module includes tool name, function description, parameter fields, constraint rules and return format; it supports dynamic registration of tools through the page, and the information is stored in the database for the intent recognition and parameter extraction module to call in real time; at the same time, the module has a built-in historical dialogue knowledge base for context memory and retrieval in multi-turn dialogues, and supports dynamic generation of large model prompt words through the template engine.
[0020] As a further optimization of the present invention, the dialogue state judgment module inputs the previous round of dialogue information and the historical dialogue knowledge base into a large language model to analyze semantic similarity and clearly determine whether the user's current input is "supplementing the original task" or "starting a new task." When task continuation is detected, the system retains the context information and continues processing; when a new task is detected, the state is reset and the intent recognition process is entered, thereby realizing multi-round task tracking and context management. Simultaneously, the task state is marked by the dialogue state variable "dialogue_state," which is automatically reset to False upon task completion and remains True when the task is not completed, ensuring the accuracy of state judgment.
[0021] As a further optimization of the present invention, the intent recognition module, in conjunction with the tool description and task examples provided by the information acquisition module, dynamically constructs few-shot format prompts (containing "intent name + description + example question") through Jinja2 template rendering. It then calls a large language model to generate a structured intent result containing "intention_name", "message", and "subdivide_intention" fields. The result undergoes grammatical and structural validity checks. If parsing fails, a regular expression or secondary prompt retry mechanism is invoked. If the intent is ambiguous (the "message" field is not empty), the user is guided to confirm, ensuring the accuracy of intent recognition.
[0022] As a further optimization of the present invention, after intent recognition is completed, the parameter extraction module generates extraction prompts with clear field and format requirements based on the tool parameter definitions (parameter name, type, etc.), and then passes the user input to the large language model to extract structured parameters in key-value pair format. This module is only responsible for parameter extraction and does not participate in legality verification. By decoupling from the rule engine module, the stability and controllability of the system are improved.
[0023] As a further optimization of the present invention, the rule engine module binds a set of rules (described in JSON format) for each tool, including required fields, enumeration constraints, regular expression formats, default values, etc., and performs traversal validation on the extracted parameters through pure code logic: missing required fields are marked as "missing", fields with invalid values are marked as "invalid" (with explanations of invalid and expected values), and fields that are missing but have default values are automatically filled in and marked as "default_filled". Finally, a standardized result object containing validation status, missing fields, invalid fields, etc. is output.
[0024] As a further optimization of the present invention, a method for implementing a multi-round interactive AI Agent based on multi-module collaboration is provided, the method comprising the following steps:
[0025] S1: Information Acquisition: The information acquisition module maintains the structured definition information and historical dialogue knowledge base of the tool, and dynamically generates prompt words according to specific tasks;
[0026] S2: Dialogue Status Judgment: Based on the previous dialogue information and the historical dialogue knowledge base, the dialogue status judgment module determines whether the user's current input is a continuation of the previous task. If it is a continuation of the task, proceed to step S4; if it is a new task, proceed to step S3.
[0027] S3: Intent Recognition: Through the intent recognition module, combined with the tool description dynamically constructed in step S1, the intent of the user input is recognized and a structured intent result is generated;
[0028] S4: Parameter extraction: The parameter extraction module generates extraction prompts based on the tool parameter definitions corresponding to the intent identified in step S3, and extracts structured parameters from the user input.
[0029] S5: Parameter validation: Based on the tool parameter constraint rules in step S1, the structured parameters extracted in step S4 are validated for completeness and legality through the rule engine module.
[0030] S6: Dialogue guidance: If the verification in step S5 fails, the dialogue strategy module generates natural language prompts based on missing or invalid fields to guide the user to complete the input; if the verification passes, the tool is invoked.
[0031] As a further optimization of the present invention, the dialogue strategy module obtains information such as the Chinese name, description, value range, and example value of relevant fields from the information acquisition module based on the verification results returned by the rule engine, constructs structured guidance prompts, and calls a large language model to generate natural and specific natural language guidance prompts. It supports a "multi-field concatenation prompt" strategy, generating compound prompts when multiple fields have problems simultaneously, ensuring the clarity and efficiency of the guidance.
[0032] As a further optimization of the present invention, the parameter verification in step S5 of the implementation method specifically includes: verifying whether the parameter contains a required field, whether it conforms to the range of enumerated values, and whether it matches the regular expression format; the generated verification result contains information on missing fields, invalid fields, and default filled fields, providing a clear basis for subsequent dialogue guidance or tool invocation.
[0033] As a further optimization of the present invention, in step S6 of the implementation method, when generating natural language prompts, guiding prompt words are constructed based on missing fields, illegal fields and corresponding parameter descriptions, and then passed into a large language model to generate natural language text containing field meanings, example values and legal range descriptions, thereby improving the efficiency of user understanding and supplementary input.
[0034] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0035] 1. This invention employs a modular collaborative design to achieve functional decoupling, effectively avoiding the model "illusion" caused by task mixing. By separating functions such as intent recognition, parameter extraction, and rule validation into independent modules, large language models can focus solely on semantic understanding and parameter extraction, while parameter validity validation is handled by the rule engine using hard rules. This significantly reduces the probability of errors caused by task complexity in small-sized models, improving the accuracy of tool calls and system stability.
[0036] 2. This invention achieves intelligent management of multi-turn dialogues through a dialogue state judgment module, solving the problem of context loss in traditional systems. This module distinguishes between "original task supplementation" and "new task initiation" through semantic similarity analysis, and accurately tracks task status by combining dialogue state variables, avoiding repeated parameter input or task interruption, ensuring the continuity of multi-turn interactions, and significantly improving user operation efficiency and interaction experience.
[0037] 3. The dynamic prompt generation mechanism of this invention enhances system scalability and reduces the cost of adding and maintaining tools. The information acquisition module supports dynamic tool registration and automatically generates prompts adapted to new tools through a template engine, eliminating the need for manual code and template modifications. This allows for rapid response to new task requirements, solving the problem that traditional static prompts are difficult to adapt to tool iterations, and improving system flexibility and ease of use.
[0038] 4. This invention achieves precise parameter guidance through a dialogue strategy module, improving user input efficiency. Based on the validation results of the rule engine, it generates natural language prompts by combining field descriptions, example values, and other information, clearly guiding users to supplement missing or correct invalid parameters. It supports multi-field compound prompts, reduces interaction rounds, ensures rapid parameter completion, and provides complete and valid parameter support for tool calls. Attached Figure Description
[0039] Figure 1 This is a schematic diagram of the overall process of the present invention;
[0040] Figure 2 This is a schematic diagram of the parameter extraction process of the rule engine module of the present invention;
[0041] Figure 3 This is a schematic diagram of the information acquisition module of the present invention;
[0042] Figure 4 This is a schematic diagram of the dialogue status determination module of the present invention;
[0043] Figure 5 This is a schematic diagram of the intent recognition module of the present invention;
[0044] Figure 6 This is a schematic diagram of the parameter extraction module of the present invention;
[0045] Figure 7 This is a schematic diagram of the rule engine module process of the present invention;
[0046] Figure 8 This is a schematic diagram of the dialogue strategy module of the present invention. Detailed Implementation
[0047] The present invention will now be further described in conjunction with the accompanying drawings and specific embodiments. It should be noted that, without conflict, the various embodiments or technical features described below can be arbitrarily combined to form new embodiments.
[0048] Example 1:
[0049] Please combine Figures 1-8 This embodiment proposes a multi-round interactive AI agent based on multi-module collaboration and its implementation method. Each module includes the following process:
[0050] Information Acquisition Module Implementation Process:
[0051] During system initialization, the information acquisition module loads the metadata of all registered tools (including tool name, tool function description, list of required parameters, parameter constraints, and output format) and caches it in the database for other modules to access in real time. Users or administrators submit tool information and parameter configurations via a graphical interface, which the system stores in a MySQL database. The module integrates a prompt word construction engine that generates specific prompt words based on intent, such as intent recognition prompt words and parameter extraction prompt words. These prompt word templates dynamically inject contextual information, such as historical intents, tool descriptions, and parameter requirements, through parameter placeholders. Simultaneously, the module maintains a historical dialogue knowledge base, recording the intent, tool parameters, and context of each user dialogue for contextual memory lookup in multi-turn dialogues. When requested by other modules, it returns the corresponding historical dialogue information to support contextual judgment of the current input and ensure dialogue continuity.
[0052] Implementation process of dialogue status determination module:
[0053] The dialogue state determination module first checks whether the dialogue state variable "dialogue_state" is equal to True when the user inputs in each round. If it is True, it means that the current user is in a continuous conversation. It retrieves relevant reference knowledge from the historical dialogue knowledge base and constructs dialogue state determination prompts based on contextual information. The Qwen2.5-14B model compares the current input with the previous input based on the constructed dialogue state determination prompts to determine whether the user should continue the original task. If the semantic expression is to supplement or refine parameters, the conversation continues; otherwise, it clarifies to the user whether the current task still needs to be performed.
[0054] If a user completes a task, i.e., successfully invokes a tool, the dialogue state variable "dialogue_state" automatically expires and equals True, ensuring no interference from historical states. Conversely, if a task is not completed, and the dialogue state variable "dialogue_state" equals True, multiple rounds of dialogue state judgment are required. When the judgment is "continue the current task," this module directly passes the current user query and the original intent and parameters to the parameter extraction module for completion. When the judgment is "new task," it clears the dialogue state variable "dialogue_state" and starts the intent recognition module. The entire process ensures that the AIAgent dialogue system can intelligently distinguish between "new intent input" and "original task supplementation," making it a key distribution node in the multi-turn dialogue logic chain.
[0055] Intent recognition module implementation process:
[0056] The intent recognition module is activated when the system determines that the current user input is a new task. Its primary task is to map the user's natural language input to the intent tags already registered within the system. The module first obtains the metadata of all registered tools from the information acquisition module, including tool name, function description, intent classification tags, and typical example usage (such as possible user questions).
[0057] Subsequently, the module concatenates the user's current query input with the tool descriptions to construct a structured prompt template. This prompt follows a few-shot format, where each candidate intent includes "intent name + description + example question." The system automatically generates complete prompts using Jinja2 template rendering. For example, for the two intents "abnormal_check" and "param_view" (i.e., two tools), a standardized prompt is formed, such as: "You are an intelligent intent recognition assistant. Please identify the user's intent based on the tool descriptions below..." Next, the module uses this prompt as input to the large language model (Qwen2.5-14B) for inference. It calls the underlying model API to make an inference request, requesting the model to return a structured JSON object with fields including {"intention_name":"intent name","message":"clarification of ambiguous intent","subdivide_intention":"intent sub-category"}. After returning, the system performs syntax and structural validity checks on the output, prioritizing the use of json.loads() to parse the model results. If parsing fails, a regular expression or secondary prompt retry mechanism is invoked. If the "Intent Name" field contains a valid, system-registered intent, that intent is recorded as the current intent for this session. If the "message" field is not empty, it indicates that the user's intent is unclear or ambiguous, and the system will forward this prompt to the dialogue strategy module for further user confirmation. Throughout the process, the intent recognition module acts as a bridge between "natural language → executable intent," ensuring that the system can accurately understand the user's task objectives and providing a foundation for subsequent structured parameter extraction.
[0058] Parameter extraction module implementation process:
[0059] The parameter extraction module is triggered immediately after the intent recognition module successfully outputs a structured intent result (e.g., {"intention_name":"intent name","message":"clarification of ambiguous intent","subdivide_intention":"intent sub-category"}). Its core objective is to extract all parameters required to complete the current intent / tool from the user input.
[0060] First, the module sends a request to the information acquisition module based on the identified "intention_name" field to obtain the tool parameter definition information bound to that intent. This information includes the parameter name, the required parameters vary from tool to tool (e.g., line_name, process_name, start_time, end_time), and the parameter type (e.g., string, enum, date). After obtaining the parameter definition, the module reads the current user's original input query and dynamically constructs a parameter extraction prompt based on the parameter requirements. This prompt is presented in a clear guiding format, typically listing all fields to be extracted, their meanings, an example return format, and appending the user's original input at the end.
[0061] For example: "Please extract the following fields from the user input below: 1) line name (line_name), 2) process name (process_name), 3) start time (start_time), 4) end time (end_time); the user input is: 'Please check the abnormal situation of the welding process on the L500 production line from yesterday to today,' please return it in the following JSON format..." This prompt is then passed to the large language model (Qwen2.5-14B) for inference. The model should return a structured JSON object containing key-value pairs of fields and values. The entire module process demonstrates a high degree of structure, ensuring that the large language model can stably and controllably extract the parameter structure that meets business execution requirements when faced with complex natural language input.
[0062] Implementation process of the rules engine module:
[0063] The rules engine module starts immediately after the parameter extraction module completes the structured parameter extraction. Its main task is to perform integrity and legality checks on all parameters under the current intent / tool, ensuring that a set of parameters that meets the calling specifications is available before the tool is invoked. First, the rules engine retrieves the rule definition information of the tool corresponding to the intent from the information acquisition module based on the current `intention_name` field. This rule information contains detailed constraints for each parameter field, such as whether the field is required, whether the parameter value must be in a certain enumeration list, whether it needs to match a specific format (such as a regular expression), and whether there is a default value. These rules are usually described in JSON format, for example: `{"line_name":{"required":true,"pattern":"L\\d{3}"},"field":{"enum":["current","pressure"]},"start_time":{"required":true},"end_time":{"required":true}}`. After loading the rules, the module performs a traversal validation of each parameter. If a field is missing (i.e., it is not present in the parameter extraction results) and is marked as required=true, it is recorded as a missing field. If a field exists but its value is invalid (e.g., enumeration mismatch, regular expression failure), it is recorded as an invalid field, along with an explanation of the invalid value and the expected value. If a field is missing but has a default value, the module can automatically complete it and mark it as default_filled. The module will ultimately aggregate all field validation results into a result object with a standard structure, such as:
[0064]
[0065]
[0066] This structure clearly indicates whether the current parameter passes the validation (params_check: True / False), which fields are missing, which values are invalid, and which values can be filled with default values, among other details.
[0067] If all fields pass validation, the module sets `params_check` to `True` and passes the `final_parameters` object to the tool execution module, initiating the tool invocation process. If missing fields or invalid values exist, the module returns the structure to the dialogue strategy module, which generates user prompts to guide the user in supplementing or correcting the parameters. The entire rules engine module is typically implemented in Python, offering high configurability and interpretability, supporting fine-grained rule definitions and dynamic validation logic, and capable of expanding the validation scope according to tool complexity. This module directly determines whether the tool invocation can be successfully executed. The specific process is determined by... Figure 2 express.
[0068] Dialogue strategy module implementation process:
[0069] The dialogue strategy module starts immediately upon receiving the parameter validation results from the rules engine module. Its core responsibility is to generate a natural language-compliant completion prompt based on the current intent / tool name, the user's original input query, and the standardized validation information returned by the rules engine (including missing fields, invalid fields, and default_filled fields). This prompt guides the user to supplement or correct parameters. In terms of implementation, the module first extracts the relevant field information from the JSON structure output by the rules engine, such as the field names and meanings to be supplemented, invalid fields, and their expected value ranges. Then, combining the current task intent / tool (e.g., "abnormal_check"), it obtains the parameter information for these fields through the information acquisition module, including the field's Chinese name, description, supported value range, and example values. Next, the module constructs a standardized "parameter prompt," typically in a structured instruction style, guiding the large model to generate a prompt statement that conforms to the user's language style. For example, when the user is missing the "start_time" and "field" fields, the module will construct the following prompt:
[0070] "You are an intelligent dialogue assistant. Please generate natural language prompts based on the following task types and parameter verification results to guide users to complete missing parameters or correct illegal parameters."
[0071] Task type: Process anomaly detection (abnormal_check)
[0072] Original user input: I want to check if there are any problems with the welding on the L500 production line.
[0073] Missing fields:
[0074] -start_time: Specifies the start time of the detection, such as "2024-07-01" or "yesterday".
[0075] -field: Specifies the indicator to be detected; options include: current, pressure.
[0076] Illegal field:
[0077] (none)
[0078] Please provide a clear, concise, and straightforward Chinese prompt to guide the user in providing the required parameters.
[0079] This prompt is passed as input to the Qwen2.5-14B model for inference. The returned result might be: "Please provide the time range for detection, such as yesterday to today," or "Do you want to detect current or pressure?" The module also supports a "multi-field concatenation prompt" strategy. When multiple fields are missing or invalid, it can generate a compound prompt, such as: "Please provide the time range for detection and select the detection item (current or pressure)." The final generated prompt not only improves the user experience but also ensures that the system can guide the user to complete the necessary parameter completion in an orderly manner, thus making the subsequent tool call process legal and complete.
[0080] Example 2 proposes a multi-module collaborative, multi-turn interactive AI Agent and its implementation method. Example 2 further elaborates on the improvement scheme of Example 1:
[0081] Improvement 1: Dynamic prompt generation capability – solving the problem of tool adaptation and expansion.
[0082] Technical issues: Traditional systems use static prompt templates, which cannot adapt to the contextual changes and diverse semantic requirements caused by new tasks / tools. Expanding to new tools requires manual modification of code and prompt templates, resulting in high maintenance costs and untimely responses.
[0083] Improvement plan:
[0084] This system introduces an information acquisition module, providing a "dynamic tool registration and configuration page." This page allows system administrators or non-developers to add metadata such as the name, function description, parameter fields, enumeration constraints, and return format of new tools via a structured form. This configuration information is dynamically stored in a database (e.g., MySQL + JSONSchema) and is automatically loaded and integrated into the prompt word template during the intent recognition and parameter extraction stages. Dynamic prompt words are automatically generated by the prompt word construction node using Jinja2 templates or custom rules and are then passed to a large language model for semantic parsing at runtime.
[0085] Improvement point two: Hard rule-driven parameter validation mechanism – avoiding execution errors caused by the illusion of a large model.
[0086] Technical Issue: Traditional dialogue systems often employ small-sized, large-language models (such as Qwen2.5-14B). When these models encounter tasks whose complexity exceeds their processing capacity, they are prone to "illusions," leading to errors in their output. These "illusions" frequently result in incorrect judgments, causing missing parameters to go unrecognized and illegal values to be unblocked. This can trigger abnormal tool calls, impacting system stability and reliability.
[0087] Improvement plan:
[0088] This invention introduces an independent rule engine module, completely decoupling the "parameter extraction" and "parameter validation" functions. The model is only responsible for extracting parameters from user input, no longer judging parameter compliance or guiding users to fill in missing parameters. Once the parameter structure is extracted, the rule engine performs logical validation item by item according to the rules bound to the tool (including whether it is required, value range restrictions, format constraints, default values, etc.). The system outputs standard validation results, such as missing fields, illegal fields, and default-filled fields, providing a reliable basis for subsequent dialogue strategy modules and tool calls.
[0089] Improvement Point 3: Dialogue State Management Mechanism – Supports Multi-Turn Context Task Tracking
[0090] Technical problem: Traditional dialogue systems cannot determine whether the user's current input is a continuation of the previous task, which often leads to loss of context, repeated input of parameters, and task interruption, affecting interaction efficiency and user experience.
[0091] Improvement plan:
[0092] This system introduces a dialogue state determination module. Based on information from the previous dialogue round (such as intent name, extracted parameters, missing fields, etc.) and combined with a historical dialogue knowledge base, it determines whether the user input is a continuation of the original task. When it is determined to be a "task continuation," the system automatically completes the context and continues execution; if it is a "new task," the old state is cleared, and the system re-enters the intent recognition process. A timeout mechanism and a task completion flag are also introduced to ensure that the state is not misused.
[0093] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.
Claims
1. A multi-module collaborative, multi-turn interactive AIAgent intelligent agent, characterized in that, include: Information Acquisition Module: As the knowledge support hub of the system, this module is responsible for maintaining the structured definition information of all tools. The structured definition information of the tools maintained by the information acquisition module includes tool name, function description, parameter fields, constraint rules and return format; it supports dynamic registration of tools through the page, and the information is stored in the database for the intent recognition and parameter extraction module to call in real time; at the same time, this module has a built-in historical dialogue knowledge base for context memory and retrieval in multi-turn dialogues, and supports dynamic generation of large model prompt words through the template engine; Dialogue State Judgment Module: This module is used to determine whether the user's current input is a continuation of the previous task. It is connected to the information acquisition module and is used to determine whether the semantic similarity of the previous dialogue information and the historical dialogue knowledge base into the large model is "supplement to the original task" or "start of a new task" based on the semantic similarity. When task continuation is detected, the system retains the context information and continues processing; otherwise, the state is reset and the intent recognition process is entered, realizing multi-round task tracking and context management. Intent Recognition Module: This module uses a large language model to recognize the user's input intent. It dynamically constructs prompt words by combining the tool descriptions and task examples provided by the information acquisition module, generating structured intent results, such as {"intention_name":"..."}. It also supports recognizing ambiguous intents and guiding the user to further confirm through the message field, ensuring that the system accurately understands the task objective. Parameter extraction module: Connecting the information acquisition module and the intent recognition module, it generates extraction prompts based on the tool's parameter definition after the intent recognition module completes intent recognition. It extracts structured parameters from user input. After the intent recognition module completes, the system automatically generates extraction prompts based on the tool's parameter definition, and then inputs the user input into a large language model for structured information extraction. The result is typically in key-value pair format. The parameter extraction module does not verify parameter validity; it only extracts information and inputs it into the rule engine for processing, thus decoupling extraction and verification, improving stability and controllability. The rules engine module connects the parameter extraction module and the information acquisition module. It performs completeness and validity checks on the structured parameters extracted by the parameter extraction module based on the tool parameter constraint rules provided by the information acquisition module. Each tool is bound to a set of rules, such as required fields, enumeration constraints, and regular expression formats. The module performs parameter checks through pure code logic and returns a unified verification structure, including missing fields, illegal values, and default completion items. If the verification passes, the tool is invoked; otherwise, it enters the guidance phase, ensuring the security and determinism of the invocation. Dialogue Strategy Module: When parameter validation fails, this module generates natural language prompts based on missing or invalid fields to guide the user to complete the input. The prompts in the dialogue strategy module are generated by constructing guiding prompt words and passing them into the large model to ensure that the prompts are natural and specific.
2. A method for implementing a multi-turn interactive AI agent based on multi-module collaboration, applied to the multi-turn interactive AI agent based on multi-module collaboration as described in claim 1, characterized in that, The implementation method includes the following steps: S1: Information Acquisition: The information acquisition module maintains the structured definition information and historical dialogue knowledge base of the tool, and dynamically generates prompt words according to specific tasks; S2: Dialogue Status Judgment: Based on the previous dialogue information and the historical dialogue knowledge base, the dialogue status judgment module determines whether the user's current input is a continuation of the previous task. If it is a continuation of the task, proceed to step S4; if it is a new task, proceed to step S3. S3: Intent Recognition: Through the intent recognition module, combined with the tool description dynamically constructed in step S1, the intent of the user input is recognized and a structured intent result is generated; S4: Parameter extraction: The parameter extraction module generates extraction prompts based on the tool parameter definitions corresponding to the intent identified in step S3, and extracts structured parameters from the user input. S5: Parameter validation: Based on the tool parameter constraint rules in step S1, the structured parameters extracted in step S4 are validated for completeness and legality through the rule engine module. S6: Dialogue guidance: If the verification in step S5 fails, the dialogue strategy module generates natural language prompts based on missing or invalid fields to guide the user to complete the input; if the verification passes, the tool is invoked.
3. The method for implementing a multi-module collaborative, multi-round interactive AI Agent as described in claim 2, wherein parameter verification in step S5 includes: Validate whether the parameters include required fields, whether they conform to the enumerated value range, and whether they match the regular expression format; The generated validation results include information on missing fields, invalid fields, and default completion fields.
4. The method for implementing a multi-turn interactive AIAgent based on multi-module collaboration as described in claim 2, wherein generating natural language prompts in step S6 includes: Based on missing fields, illegal fields, and corresponding parameter descriptions, guide-type prompt words are constructed and passed to a large language model to generate natural language text. The text includes the meaning of the fields, example values, and a description of the legal range.
Citation Information
Patent Citations
Task type multi-round dialogue method and system for office scene
CN112199486A