Question number reply method and device based on multiple agents, electronic equipment and storage medium
By using a multi-agent question-and-answer method, user query commands are broken down into atomized subtasks and executed by agents. This solves the problem that traditional single models cannot handle complex and multi-dimensional question-and-answer requirements, and achieves efficient and accurate question-and-answer.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-04-07
AI Technical Summary
Traditional single-model approaches struggle to handle diverse data query needs, leading to inaccurate results. Furthermore, the lack of dynamic adjustment and feedback mechanisms makes it ineffective in processing complex and multi-dimensional data queries.
The multi-agent question-and-response method is adopted, which decomposes the user query command into multiple atomic subtasks and matches them to the corresponding agents for execution, ultimately generating natural language response text, including a determination module, a decomposition module, a matching module, and an execution module.
It improves the ability to handle complex question tasks, covers multiple scenario requirements, optimizes response efficiency, enhances result accuracy, and avoids the efficiency bottlenecks and accuracy problems of traditional single models.
Smart Images

Figure CN121808006A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and particularly relates to a question and answer method and device based on multiple agents, an electronic device and a computer readable storage medium. BACKGROUND
[0002] When a traditional single large model processes data query requirements, if the query requirements change, the output result is prone to errors and difficult to verify and correct, resulting in inaccurate output results in flexible and variable query requirement scenarios. SUMMARY
[0003] The present application provides a question and answer method and device based on multiple agents, an electronic device and a computer readable storage medium, which can solve the problem that a traditional single model cannot efficiently process complex and multi-dimensional question and answer requirements, and can improve the processing capability of complex question and answer tasks and cover multiple scenario requirements.
[0004] To achieve the above purpose, the present application adopts the following technical scheme: In a first aspect, a question and answer method based on multiple agents is provided, comprising: In response to receiving a query instruction, determining a corresponding target query task according to a user's current input natural language text; Analyzing and disassembling the target query task to obtain a plurality of atomized subtasks; Matching the plurality of atomized subtasks to each agent respectively, so that each atomized subtask is matched to a corresponding target agent; Based on each target agent executing the corresponding atomized subtask, an execution result is obtained; Generating a natural language answer text according to each execution result.
[0005] In a second aspect, a question and answer device based on multiple agents is provided, comprising: A determination module configured to, in response to receiving a query instruction, determine a corresponding target query task according to a user's current input natural language text; A disassembly module configured to analyze and disassemble the target query task to obtain a plurality of atomized subtasks; A matching module configured to match the plurality of atomized subtasks to each agent respectively, so that each atomized subtask is matched to a corresponding target agent; An execution module configured to, based on each target agent executing the corresponding atomized subtask, obtain an execution result; An answer module configured to generate a natural language answer text according to each execution result.
[0006] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the multi-agent based question answering method according to any one of the first aspect when executing the computer program.
[0007] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the multi-agent based question answering method according to any one of the first aspect.
[0008] In a fifth aspect, a computer program product is provided, which, when executed on an electronic device, causes the electronic device to perform the multi-agent based question answering method according to any one of the first aspect.
[0009] It can be understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, which will not be repeated here.
[0010] In the embodiments of the present application, in response to receiving the query instruction, the corresponding target query task is determined according to the natural language text currently input by the user, and then the target query task is analyzed and disassembled to obtain a plurality of atomized subtasks. Then, the plurality of atomized subtasks are matched with each agent respectively, so that each atomized subtask is matched to a corresponding target agent. Then, each target agent executes the corresponding atomized subtask to obtain an execution result. Then, according to each execution result, a natural language reply text is generated. Thus, by disassembling the query instruction in the form of natural language of the user into atomized subtasks, the problem that the traditional single model is difficult to efficiently process complex and multi-dimensional question answering requirements is solved, the processing capability of complex question answering tasks can be improved, multi-scene requirements can be covered, and the result accuracy can be enhanced.
[0011] The above description is only a summary of the technical solutions of the present application. In order to enable the technical means of the present application to be more clearly understood, and to be implemented according to the content of the description, and in order to enable the above and other purposes, characteristics and advantages of the present application to be more apparent and easy to understand, the following specific embodiments of the present application are described in detail. BRIEF DESCRIPTION OF DRAWINGS
[0012] Various other advantages and benefits will become apparent to those of ordinary skill in the art, upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of preferred embodiments, and are not meant to limit the present application. Moreover, the same reference numerals in the attached drawings indicate the same or similar elements. In the drawings: Figure 1is a one-way workflow diagram of a traditional rule-driven question answering system; Figure 2 is a flow diagram of a method for answering a question based on multiple agents according to an embodiment of the present disclosure; Figure 3 is a flow diagram of a task processing process; Figure 4 is a flow control diagram of information verification and result output; Figure 5 is an agent cooperation flow diagram of a natural language processing task; Figure 6 is a full-process cooperation timing diagram of an agent task processing; Figure 7 is a structural block diagram of an apparatus for answering a question based on multiple agents according to an embodiment of the present disclosure; Figure 8 is a structural diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0013] The embodiments of the technical solutions of the present disclosure will be described in detail below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present disclosure, and therefore only serve as examples, and cannot limit the protection scope of the present disclosure. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. Various changes, modifications and equivalents of the methods, devices and / or systems described herein will become apparent to those skilled in the art after understanding the present disclosure. For example, the order of the operations described herein is merely an example, and is not limited to those described herein, but changes can be made as apparent after understanding the present disclosure, except for operations that must be performed in a specific order. In addition, to improve clarity and brevity, the description of features known in the art can be omitted.
[0014] The implementations described in some embodiments of the present disclosure below do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0015] In related art, a deterministic one-way pipeline architecture is generally used, in which modules are connected in series, the output of a previous module is directly used as the input of a subsequent module, and there is no dynamic adjustment or feedback mechanism. Figure 1 is a one-way workflow diagram of a traditional rule-driven question answering system, as shown in Figure 1As shown, the entire process is deterministic and unidirectional, and the output of each module is the direct input of the next module. The intent recognition and slot filling module: This module parses the user's question based on predefined SQL formulas to identify the user's intent and fill in the corresponding slots. Any expression that deviates from these rules may result in parsing failure. Query generation module: This module uses pre-set query templates to map intent and slots into a database executable query statement. Data retrieval module: responsible for executing the query and obtaining the results from the data source. Natural language response generation module: embed the retrieved raw data into a predefined response template to generate a natural language reply and return it to the user.
[0016] Due to the difficulty of a single large model or fixed workflow to cope with changing query requirements, such as the inability to handle complex tasks such as data query, numerical calculation and trend prediction, and the lack of a flexible framework that can dynamically decompose tasks and call appropriate tools / models. Most decision-making processes of question and answer systems are in a "black box" state, and it is difficult to trace the cause of the wrong answer; At the same time, due to the lack of intermediate step verification and correction mechanism, one-time generation is prone to errors, and the accuracy is more obvious in precise calculation and strict logical reasoning type questions. Considering each query as an isolated event, it cannot learn from past interactions (successful experience / failure case), which may repeat corrected errors and make it difficult to accumulate user characteristics to improve accuracy and provide personalized services.
[0017] To solve at least one of the above problems, the embodiments of the present application provide a multi-agent-based question and number reply method, device, electronic equipment and computer readable storage medium.
[0018] It should be noted that the execution subject of the multi-agent-based question and number reply method of the present embodiment can be a multi-agent-based question and number reply device, hereinafter referred to as "device", which can be configured in any type of electronic equipment, and the embodiments of the present application do not limit this.
[0019] Referring to Figure 2 is the flowchart of the multi-agent-based question and number reply method provided by the first embodiment of the present application. As Figure 2 shown, the multi-agent-based question and number reply method can include the following steps: Step 101, in response to receiving a query instruction, determining the corresponding target query task according to the user's current input natural language text.
[0020] Wherein, the query instruction can refer to the user's unstructured natural language query request (such as "query the steel sales in East China in October 2025 and the year-on-year growth rate") submitted through the interactive interface to obtain specific business data, statistical results, trend analysis, etc. As user input.
[0021] Specifically, the system can capture the query instruction submitted by the user through an interactive interface (such as an input box, a voice recognition module), which exists in the form of unstructured natural language text (for example, “In combination with the data last month, say about the year-on-year change of the sales volume of steel materials in East China in October”). After the system receives the instruction, it immediately triggers the subsequent query information parsing process, while marking the timestamp of the instruction reception, user identification, and other basic metadata.
[0022] Among them, the natural language text can be unstructured natural language, which refers to the daily expression of human beings without fixed format or structure, such as colloquial questions, omitted sentences, etc. Compared with structured data (such as JSON, XML), it needs to be understood and parsed through natural language processing technology.
[0023] Among them, the target query task can be a standardized and structured query data formed based on the current input natural language text of the user, combined with relevant historical dialogue context and associated features, such as query intent, core indicators, filtering conditions, context association information, etc., which are not limited here.
[0024] As a possible implementation, in the case where the historical dialogue context and associated features are not obtained, the current input natural language text can be directly used as the target query task.
[0025] As a possible implementation, the historical dialogue context and associated features can be obtained, and then based on the historical dialogue context and associated features, the target query task of the target data structure is constructed according to the current input natural language text of the user.
[0026] Among them, the historical dialogue context can refer to the multi-round interaction record between the user and the system before the current query instruction, at least including the natural language text (question) of the historical query and the corresponding reply text (answer) returned by the system.
[0027] Among them, the associated features are supplementary information directly associated with the historical dialogue context and used to assist in determining its relevance to the current query, for example: Time dimension associated features: such as the occurrence timestamp of the historical dialogue, the time interval between the historical dialogue and the current query, the business time range involved in the historical query, etc. Business dimension associated features: such as the business field involved in the historical dialogue (such as steel sales, regional market), data indicator type (such as sales volume, sales volume, proportion), business filtering condition (such as region, product type), etc. Interaction dimension associated features: such as the user operation behavior (such as like, correct, ask follow-up questions) of the historical dialogue, the dialogue round number, the intent type (such as data query, numerical calculation, trend prediction) of the historical query, etc.
[0028] The target data structure can be a structured data organization form (such as a JSON array, a key-value pair set, etc.) preset for unified query information format and convenient subsequent task disassembly, and can include fields such as query core content, context association identifier, and correlation parameter.
[0029] Specifically, the system can retrieve the historical dialogue context of the user from the storage unit, including historical query questions and system reply content, and extract multi-dimensional features associated with the historical dialogue context, including time dimension (timestamp of the historical dialogue, time interval from the current query), business dimension (business field involved in the historical query, index type), and interaction dimension (user operation behavior of the historical dialogue, query intent type), without limitation.
[0030] Optionally, the relevance algorithm (such as semantic similarity calculation, feature weight superposition) can be used to determine the relevance of each historical dialogue context to the current query, and the target historical dialogue context with a relevance greater than a preset threshold can be selected, for example, if the user's current query mentions “East China Steel 10-month sales”, the historical dialogue record about “East China Steel sales” can be selected as the effective context.
[0031] Optionally, the association features include at least time dimension association features, business dimension association features, and interaction dimension association features, and the relevance of the historical dialogue context to the current input natural language text can be determined based on one or more of the time dimension association features, the business dimension association features, and the interaction dimension association features. Then, the target historical dialogue context with a relevance greater than a preset threshold is determined, and then the target query task of the target data structure is constructed according to the target historical dialogue context and the current input natural language text.
[0032] The time dimension association features can be the timestamp of the historical dialogue, the time interval between the historical dialogue and the current query, and the business time range involved in the historical query. The time interval is converted into a numerical feature, and the business time range is converted into a timestamp interval. The timestamp records the numerical identifier of the specific time point of each dialogue, which is usually represented in Unix timestamp or standard time format, and is used to track the time sequence of the dialogue and calculate the time interval.
[0033] The business dimension association features can be the business field (such as “steel sales”), the index type (such as “sales”), and the region / product filtering condition (such as “East China”) of the historical dialogue. These features are converted into a standardized business label vector (such as [steel sales, sales, East China]) by a pre-trained semantic model.
[0034] Among them, the interaction dimension associated features can refer to the user operation behavior in the history of the dialogue (such as "follow-up question" and "correction"), the dialogue round number (such as the 2nd round), and the intent type of the history query (such as "data query"), which are mapped to classification feature values (such as follow-up question = 1, correction = 2, data query = 01).
[0035] As one possible approach, weights can be set for each associated feature (e.g., 0.3 for the time dimension, 0.5 for the business dimension, and 0.2 for the interaction dimension), and the single-dimensional relevance can be calculated separately and then weighted and summed to obtain the comprehensive relevance between the historical dialogue context and the current query.
[0036] The time dimension relevance can be calculated by measuring the overlap between historical business time and current query time, and the similarity between the time interval between historical dialogue and current query (the shorter the interval, the higher the similarity). For example, the time relevance of a 3-day interval is 0.9.
[0037] Among them, the business dimension relevance can be obtained by calculating the cosine similarity between the business tag vector of the current query and the business tag vector of the historical dialogue. For example, the business relevance between the current query "October sales of steel products in East China" and the historical query "September sales of steel products in East China" is 0.95.
[0038] The interaction dimension relevance can be set as follows: if the historical dialogue is a user's follow-up question on a similar issue, the interaction relevance is 0.8; if it is a regular query, the interaction relevance is 0.5. The formula for calculating the overall relevance is: Overall Relevance = Time Dimension Relevance × 0.3 + Business Dimension Relevance × 0.5 + Interaction Dimension Relevance × 0.2. Using the example above, we can calculate: 0.9 × 0.3 + 0.95 × 0.5 + 0.8 × 0.2 = 0.905.
[0039] Optionally, the calculated overall relevance score can be compared with a preset threshold (e.g., 0.7) to filter historical dialogue contexts with an overall relevance score greater than the threshold as target historical dialogue contexts. For example, in the example above, the overall relevance score is 0.905 > 0.7, so the historical dialogue is selected as the target context. If the overall relevance score of a historical dialogue is 0.65, it is judged as an irrelevant context and removed.
[0040] As an example, the system can integrate the core information of the current input natural language text (such as the query intent "year-on-year change analysis" and the time "October 2025") with key information from the target's historical dialogue context (such as "East China steel sales of 12.8 million yuan in September 2025") based on an integrated intelligent agent. This integrated information is then standardized and constructed according to a preset target data structure (such as JSON or structured arrays). The resulting target query task can include core query requirements, contextual information, and multi-dimensional filtering conditions. This transforms abbreviated expressions into explicit and standardized query objects, significantly reducing ambiguity and misunderstanding rates.
[0041] For example, the context and its features can be constructed as a standardized ordered JSON array, and the timestamp and the gap between the historical conversation and the current conversation can be used as metadata to help determine its relevance.
[0042] The format is as follows: [{ Question: XXX Answer: XXX, Timestamp:XXX, Gap:XXX }] As an example, the output format of the target query task can be limited to standard JSON format, and restricted to four key-value pairs: whether there is a relevant context (is_relevant), the coverage of the context with the answer in this round of dialogue (relevance_level), the reason for selection (reasoning), and the list of strongly relevant content (content).
[0043] For example, the output of the target query task can be shown in the following code: { "is_relevant": "true", "item": "partial content", "relevance_level": "partial match", "explanation": "Your response materials mentioned the application timeline for the project, the expenses incurred during the project, and some specific figures for the projects." "content": "1. A commencement application is required in advance at a cost of 122 yuan. 2. Site leveling costs during project construction are 16,100 yuan. 3. Civil engineering costs for the project construction are 25,000-35,000 yuan. 4. Civil engineering and construction costs for the sewage treatment facilities..." } Step 102: Analyze and decompose the target query task to obtain multiple atomized subtasks.
[0044] Atomized subtasks are used to represent the smallest execution unit. Atomized subtasks break down complex problems into the smallest indivisible units. Each subtask is an independent, well-defined, and directly executable task, which facilitates parallel processing and result integration.
[0045] Optionally, the target query task can be analyzed and decomposed into multiple atomized subtasks based on structured thinking prompts guided by stepwise reasoning, and a framework that combines reasoning and action.
[0046] Among them, the structured thinking prompting technology based on step-by-step reasoning can refer to the thinking chain technology, which guides large language models to think in a structured way by displaying the step-by-step reasoning process in the input, enabling the model to decompose complex problems into multiple intermediate steps, thereby improving the accuracy and interpretability of reasoning.
[0047] Among them, the framework that combines reasoning and action can refer to React technology, which combines reasoning and action to allow the model to alternate between thinking and performing actions when solving problems, and complete complex tasks through a cycle of "think-act-observe".
[0048] First, a pre-defined task decomposition example is embedded in the prompts input to the large language model. The example includes a multi-level detailed decomposition process for complex queries, guiding the model to initially split the target query task and output the first round of splitting results. Then, a cyclical decomposition mechanism is constructed: if the first round of splitting results does not carry a pre-defined termination marker, the first round of splitting results are treated as new query information to be split and input into the model again for the next round of splitting.
[0049] Repeat the above cyclic decomposition steps until the model output decomposition result meets the judgment condition (i.e., the decomposition result is a single operation type and the smallest task unit that can be executed independently by a single agent), and trigger the termination flag output.
[0050] Furthermore, metadata can be added to the output atomic subtasks, such as task type (e.g., indicator query, numerical calculation, trend prediction), task index, and inter-task dependencies, to form a list of atomic subtasks.
[0051] It's worth noting that by breaking down user queries in natural language form into atomized subtasks, the challenge of traditional single models efficiently handling complex, multi-dimensional query requirements can be addressed. The breakdown into atomized subtasks allows each execution stage to focus on a single objective.
[0052] For example, the user inputs natural language text: "How do material prices in December 2025 compare to material prices in September 2025? Why is this?" Specifically, it can be broken down into the following atomized sub-tasks (questions): [ { Question: What are the material prices in December 2025? "category": "numerical type", "dependency": "independent" }, { Question: What were the material prices in September 2025? "category": "numerical type", "dependency": "Independent, can be implemented in parallel in advance" }, { Question: How do material prices in December 2025 compare to material prices in September 2025 (e.g., changes, magnitude)? "category": "numerical comparison", "dependency": "depends on the results of the first two problems" }, { Question: What are the reasons for the aforementioned changes in material prices from December 2025 to September 2025? "category": "Investigation of Causes", "dependency": "Dependency on the third problem" } ] Figure 3 The task processing flowchart is as follows: First, the user initiates a query command. The system first determines whether context exists. If context exists, the intelligent agent at the context processing node merges the information or provides a direct answer. If not, the context processing node extracts the core information of the request and sends it to the problem splitting node. The problem splitting node then iteratively splits the request until it is reduced to the smallest atomic sub-problems. Simultaneously, it reads the available resources provided by the matching task execution agent in real time (including the agent's definition and input / output parameter requirements) to ensure that each sub-problem can be matched with a corresponding execution agent, and finally, the matched agent completes the task.
[0053] Step 103: Match the multiple atomized subtasks with each agent so that each atomized subtask is matched with the corresponding target agent.
[0054] As one possible approach, feature extraction is first performed on each atomized subtask to obtain subtask feature information. Then, the functional description information of each agent is characterized to obtain agent feature information. Subsequently, the subtask feature information and agent feature information are matched using a vector similarity calculation method, and agents whose similarity meets the preset conditions are selected as the target agents for the corresponding atomized subtasks.
[0055] In this context, an agent can refer to a callable execution unit with specific functions, which follows a unified input / output data contract, has built-in dedicated task processing logic (such as rule engines or algorithm models) or associated tools (such as data query interfaces or computing tools), can receive standardized task instructions and execute corresponding sub-tasks, and finally output structured results for subsequent modules or orchestrators to call. This can improve the execution accuracy of individual sub-tasks matched by the agent, and ultimately ensure the accuracy and reliability of the overall query results.
[0056] Among them, the subtask feature information is the standardized core identification information obtained after feature extraction of atomized subtasks. It is used to characterize the core requirements and execution requirements of the subtasks, including at least the functional type, core parameters, and execution constraints of the subtasks, without any further limitations.
[0057] Among them, the intelligent agent functional description information can be used as structured description data to define the scope of functions and capability boundaries of the intelligent agent, describing the types of tasks that the intelligent agent can handle, the adapted scenarios, input and output formats, and other information.
[0058] Among them, the agent feature information can be standardized feature data obtained by feature processing of the agent's functional description information, which is used to perform matching calculations with the subtask feature information.
[0059] Among them, the vector similarity calculation method refers to the calculation method that converts the subtask feature information and the agent feature information into high-dimensional vectors respectively, and calculates the degree of similarity between the two vectors in the vector space based on a preset algorithm (such as cosine similarity algorithm, Euclidean distance algorithm, Manhattan distance algorithm, etc.) to quantify the functional adaptability of the subtask and the agent.
[0060] Among them, the preset conditions can refer to the threshold standards pre-configured by the system to determine whether the agent and the subtask are compatible. Specifically, the similarity value obtained by vector similarity calculation must reach or exceed a preset threshold (such as 0.7). This threshold can be adjusted according to business scenario requirements or system performance requirements.
[0061] The target agent can refer to the agent whose similarity value meets the preset conditions after vector similarity calculation, which is used to execute the corresponding atomized subtask and output structured results.
[0062] Specifically, the process begins by acquiring the names and functional descriptions of each pre-defined agent. These names and descriptions are then vectorized to generate high-dimensional vector-based agent feature information. This feature information is then bound to the agent's associated identifier and persistently stored in a vector database. Next, feature extraction is performed on each atomized subtask to define its subtask classification label (e.g., "index query" or "numerical calculation") and requirement description (e.g., "query October 2025 steel sales revenue"), forming subtask feature text. Using the same BGE-M3embedding model as the pre-defined agent vectorization, this subtask feature text is converted into high-dimensional vector-based subtask feature information—the vector representation of the subtask.
[0063] Furthermore, a vector search strategy based on the HNSW (Hierarchical Navigable Small World) algorithm and cosine similarity can be constructed, performing the following operations: The vector representation of the subtask is used as the retrieval input and fed into a vector database. The HNSW algorithm quickly retrieves all agent feature information stored in the database, outputting the distance between each agent's feature information and the subtask's vector representation in the vector space. This distance is converted into a cosine similarity value, which quantifies the functional fit between the subtask and each agent; a higher similarity value indicates a stronger fit. The agent with the highest cosine similarity value is selected and identified as the target agent corresponding to that atomized subtask.
[0064] Step 104: Execute the corresponding atomized subtask for each target agent to obtain the execution result.
[0065] Specifically, after accurately matching atomized subtasks with target agents, each successfully matched target agent can be issued its corresponding atomized subtask according to a one-to-one mapping relationship. Each target agent then independently completes the task execution based on its own preset execution logic, ultimately outputting the independent execution result for each atomized subtask. It should be noted that, based on the matching mechanism between atomized subtasks and individual agents, each subtask can be executed in parallel or sequentially by target agents with corresponding expertise. This avoids the efficiency bottleneck of traditional serial processing of overall tasks, significantly shortens query response time, and improves the system's throughput for handling high-concurrency query requests.
[0066] Optionally, if no target agent corresponding to any atomized subtask is matched, a first agent corresponding to any atomized subtask is constructed, and then the corresponding atomized subtask is sent to the first target agent to obtain the execution result.
[0067] Specifically, code can be called to write an Agent, attempting to automatically customize a sub-Agent for the user on-site as the first intelligent agent, and register the first intelligent agent into the user's private Agent library.
[0068] Understandably, when the system breaks down the target query task into its smallest granularity atomic subtasks, if the search finds no existing agent resources capable of matching and executing that atomic subtask, the construction process of the first agent can be triggered (including defining the agent's functional boundaries, input / output specifications, execution logic, and other core parameters). Once the first agent is built, the corresponding atomic subtask is directed to that agent for independent execution and return the final result, ensuring no execution breakpoints after task decomposition and achieving fully automated processing of complex tasks. This avoids task interruptions due to the lack of a matching agent, improves the automation and completeness of complex task processing, and reduces manual intervention costs. Consequently, the system can flexibly add or iterate agents based on new query scenarios without refactoring the overall system architecture.
[0069] Step 105: Generate natural language response text based on each execution result.
[0070] Optionally, the intelligent agent can be integrated based on the results to collect the execution results of each atomized subtask, perform grammatical and logical verification and factual accuracy verification on each execution result to obtain the verified execution result, and then generate a natural language response text that matches the user's query intent based on the verified execution result.
[0071] Understandably, after multiple target agents execute their respective atomic subtasks, the execution results of each atomic subtask are obtained. Optionally, the result integration agent is invoked to collect all execution results and sequentially perform syntax and logic checks, as well as factual accuracy checks, on each execution result to obtain the checked execution result.
[0072] The syntax and logic verification can include: checking the JSON format, spelling, syntax, and punctuation of the execution results using multiple SOTA models to verify whether there are errors; verifying whether the logical chain is complete and whether the factual statements are consistent; using a multi-model voting method for collaborative verification; and updating the execution results in real time.
[0073] The factual accuracy verification can include: retrieving authoritative data sources through WebSearch tools to ensure the timeliness and correctness of the execution results; performing data sampling and comparison through private data sources to verify the consistency between the execution results and the known data of the private data sources; and requiring the output of the calculation formulas for numerical conclusions contained in the execution results and verifying the data accuracy of the calculation formulas through a code executor.
[0074] Therefore, performing syntactic and logical checks on the execution results of each atomized subtask can effectively eliminate content with grammatical errors and logical contradictions, ensuring that each sub-result remains consistent in terms of expression standards and logical chains. Overlaying factual accuracy checks can verify whether the data and conclusions in the sub-results conform to objective facts or preset rules, avoiding factual errors in the final answer due to deviations in the execution of a single subtask.
[0075] Furthermore, based on the execution results or the validated execution results, natural language response text that matches the user's query intent can be generated.
[0076] Optionally, if multiple attempts to perform syntax and logic checks or factual accuracy checks fail, error messages are logged, including the available parts of the execution result and the parts that cannot be implemented temporarily, and a dynamic degradation operation is triggered.
[0077] Figure 4 This is a flow control diagram for information verification and result output. The flow and functions are as follows: Syntax / Logic Verification: Upon triggering, the syntax parser (to check syntax accuracy) and the logic validator (to verify the integrity of the logic chain) are invoked simultaneously. The results of the two tools are summarized in the "Pass / Fail" node: if either fails, an error message is returned directly; if both pass, the process proceeds to the next step.
[0078] Fact accuracy verification process: Based on the verification results from the previous step, three verifications are initiated simultaneously: Comparison with authoritative data sources: comparing facts with publicly available / industry authoritative data; Private data source comparison: verify consistency by matching internal enterprise data; Code executor calculation: Recalculates and verifies formulas and numerical conclusions in the content through code execution; The three results are summarized in the "Pass / Fail" node: if any one fails, an error message is returned; if all pass, the results are integrated.
[0079] After completing the first two layers of verification, the results of the passed content are integrated to finally generate and output compliant content.
[0080] Figure 5The flowchart for agent collaboration in natural language processing tasks is as follows, with the structure and function as follows: After the user inputs natural language text, the system first determines whether there is a historical dialogue context and related features: if so, it directly enters the "task planning agent"; if not, the "problem rewriting agent" optimizes the problem statement based on the context before entering the "task planning agent." The "task planning agent" breaks down the user's needs into "atomic sub-tasks" and matches them with corresponding execution agents (including agents for data analysis, attribution, indicator query, web query, expert interpretation, and world-dimensional tasks). The system continuously checks whether all atomic sub-tasks have been completed: if not, it continues execution; if completed, it enters the integration phase. First, the "integration agent" merges the results of each sub-task, then the "results integration agent" optimizes them; finally, the "reflection and evaluation agent" verifies the output quality: if the quality is substandard, it returns to the task planning phase for reprocessing; if the quality is satisfactory, the results are output to the user.
[0081] Figure 6 The following is a sequence diagram of the entire collaborative process for intelligent agent task processing, with the collaboration logic of each module as follows: After a user (1) raises a question, the task decomposer (2) analyzes and decomposes the question, converting it into subtasks. The agent matcher (4) matches a corresponding agent for each subtask. After receiving the subtask, the agent (5) completes (6) execution and (7) returns the result in sequence. The verification module (8) then verifies the result. If the verification finds a problem with the result (9a), it triggers (9b) to re-execute the process until a valid result (10) is obtained. The result integrator (11) integrates the valid results. If reconstruction is still required after integration, it will trigger the task decomposer (12a) to re-decompose the task and (12b) to re-analyze it. Finally, (13) the answer is returned to the user, and (14) the complete processing path is deposited into the knowledge base for reuse in similar questions in the future.
[0082] In this embodiment, in response to receiving a query instruction, the corresponding target query task is determined based on the natural language text currently input by the user. The target query task is then analyzed and decomposed into multiple atomized subtasks. These atomized subtasks are then matched with various intelligent agents, ensuring each atomized subtask is matched with a corresponding target intelligent agent. The corresponding atomized subtask is then executed based on each target intelligent agent to obtain an execution result. Finally, a natural language response text is generated based on each execution result. Therefore, by decomposing the user's natural language query instruction into atomized subtasks, the problem of traditional single models being unable to efficiently handle complex, multi-dimensional query requirements is solved. This improves the processing capability of complex query tasks, covers multiple scenario requirements, optimizes response efficiency, and enhances result accuracy.
[0083] Corresponding to the multi-agent question-response method described in the above embodiments, Figure 7 This is a structural block diagram of the question-answering device based on multiple agents provided in the embodiments of this application.
[0084] Reference Figure 7 The multi-agent question-and-answer device 700 includes: The determination module 710 is used to determine the corresponding target query task based on the natural language text currently input by the user in response to receiving a query instruction; The decomposition module 720 is used to analyze and break down the target query task to obtain multiple atomized subtasks; The matching module 730 is used to match the plurality of atomized subtasks with each intelligent agent, so that each atomized subtask is matched with the corresponding target intelligent agent. The execution module 740 is used to execute the corresponding atomized subtask based on each target agent to obtain the execution result; The response module 750 is used to generate natural language response text based on the respective execution results.
[0085] Optionally, the determining module 710 is specifically used for: Obtain historical dialogue context and associated features; Based on the historical dialogue context and associated features, a target query task is constructed using the natural language text currently input by the user, and a target data structure is built.
[0086] Optionally, the association features include at least time-dimension association features, business-dimension association features, and interaction-dimension association features; the determining module 710 is specifically used for: Based on one or more of the time-dimensional correlation features, business-dimensional correlation features, and interaction-dimensional correlation features, determine the relevance between the historical dialogue context and the currently input natural language text; Determine the target historical dialogue context whose relevance is greater than a preset threshold; The target query task constructs the target data structure based on the target historical dialogue context and the currently input natural language text.
[0087] Optional, the decomposition module 720 is specifically used for: Based on a structured thinking prompting technology guided by stepwise reasoning, and a framework combining reasoning and action, the target query task is analyzed and decomposed to obtain multiple atomized subtasks, wherein the atomized subtasks are used to represent the smallest execution unit.
[0088] Optionally, the matching module 730 is specifically used for: Feature extraction is performed on each of the atomized subtasks to obtain subtask feature information; The functional description information of each intelligent agent is characterized to obtain intelligent agent feature information; By using a vector similarity calculation method, the feature information of the subtask is matched with the feature information of the agent, and agents whose similarity meets the preset conditions are selected as the target agents corresponding to the atomized subtask.
[0089] Optionally, the execution module is specifically used for: If no target agent corresponding to any atomized subtask is matched, a first agent corresponding to any atomized subtask is constructed; The corresponding atomized subtask is issued to the first target agent to obtain the execution result.
[0090] Optional, the response module 750 is specifically used for: Based on the results, the intelligent agent collects the execution results of each of the atomized subtasks; Perform syntax and logic checks and factual accuracy checks on each of the execution results to obtain the checked execution results; Based on the execution result after verification, a natural language response text that matches the user's query intent is generated.
[0091] In this embodiment, in response to receiving a query instruction, the corresponding target query task is determined based on the natural language text currently input by the user. The target query task is then analyzed and decomposed into multiple atomized subtasks. These atomized subtasks are then matched with various intelligent agents, ensuring each atomized subtask is matched with a corresponding target intelligent agent. The corresponding atomized subtask is then executed based on each target intelligent agent to obtain an execution result. Finally, a natural language response text is generated based on each execution result. Therefore, by decomposing the user's natural language query instruction into atomized subtasks, the problem of traditional single models being unable to efficiently handle complex, multi-dimensional query requirements is solved. This improves the processing capability of complex query tasks, covers multiple scenario requirements, optimizes response efficiency, and enhances result accuracy.
[0092] in addition, Figure 7 The multi-agent question-and-answer device shown can be a software unit, a hardware unit, or a combination of software and hardware built into an existing electronic device. It can also be integrated into the electronic device as a separate component, or exist as a standalone electronic device.
[0093] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0094] Figure 8 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. For example... Figure 8 As shown, the electronic device 5 of this embodiment includes: at least one processor 50 ( Figure 8 (Only one is shown in the diagram) a processor, a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50, wherein the processor 50 executes the computer program 52 to implement the steps in any of the above embodiments of the multi-agent question-and-answer method.
[0095] The electronic device may be a desktop computer, laptop, handheld computer, or cloud server, etc. This electronic device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 8 This is merely an example of electronic device 5 and does not constitute a limitation on electronic device 5. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, etc.
[0096] The processor 50 may be a central processing unit, or it may be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0097] In some embodiments, the memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or memory of the electronic device 5. In other embodiments, the memory 51 may be an external storage device of the electronic device 5, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc., equipped on the electronic device 5. Further, the memory 51 may include both internal storage units and external storage devices of the electronic device 5. The memory 51 is used to store operating systems, applications, boot loaders, data, and other programs, such as the program code of the computer program. The memory 51 can also be used to temporarily store data that has been output or will be output.
[0098] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the above-described method embodiments.
[0099] This application provides a computer program product that, when run on an electronic device, enables the electronic device to implement the steps described in the various method embodiments above.
[0100] If the integrated unit is implemented as a software functional unit and used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a device / electronic device, a recording medium, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.
[0101] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0102] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0103] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0104] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0105] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A question-response method based on multi-agent intelligence, characterized in that, include: In response to receiving a query command, determine the corresponding target query task based on the natural language text currently entered by the user; The target query task is analyzed and decomposed to obtain multiple atomized subtasks; The multiple atomized subtasks are matched with each intelligent agent so that each atomized subtask is matched with the corresponding target intelligent agent. The corresponding atomized subtask is executed for each target agent to obtain the execution result; Based on the execution results, a natural language response text is generated.
2. The method according to claim 1, characterized in that, The step of determining the corresponding target query task based on the natural language text currently input by the user includes: Obtain historical dialogue context and associated features; Based on the historical dialogue context and associated features, a target query task is constructed using the natural language text currently input by the user, and a target data structure is built.
3. The method according to claim 2, characterized in that, The associated features include at least time-dimensional associated features, business-dimensional associated features, and interaction-dimensional associated features; the target query task, based on the historical dialogue context and associated features, and according to the natural language text currently input by the user, constructs the target data structure, including: Based on one or more of the time-dimensional correlation features, business-dimensional correlation features, and interaction-dimensional correlation features, determine the relevance between the historical dialogue context and the currently input natural language text; Determine the target historical dialogue context whose relevance is greater than a preset threshold; The target query task constructs the target data structure based on the target historical dialogue context and the currently input natural language text.
4. The method according to claim 1, characterized in that, The target query task is analyzed and decomposed to obtain multiple atomic subtasks, including: Based on a structured thinking prompting technology guided by stepwise reasoning, and a framework combining reasoning and action, the target query task is analyzed and decomposed to obtain multiple atomized subtasks, wherein the atomized subtasks are used to represent the smallest execution unit.
5. The method according to claim 1, characterized in that, The step of matching the plurality of atomized subtasks with each agent, so that each atomized subtask is matched with a corresponding target agent, includes: Feature extraction is performed on each of the atomized subtasks to obtain subtask feature information; The functional description information of each intelligent agent is characterized to obtain intelligent agent feature information; By using a vector similarity calculation method, the feature information of the subtask is matched with the feature information of the agent, and agents whose similarity meets the preset conditions are selected as the target agents corresponding to the atomized subtask.
6. The method according to claim 1, characterized in that, The step of executing the corresponding atomized subtask for each target agent to obtain the execution result includes: If no target agent corresponding to any atomized subtask is matched, a first agent corresponding to any atomized subtask is constructed; The corresponding atomized subtask is issued to the first target agent to obtain the execution result.
7. The method according to claim 1, characterized in that, The step of generating a natural language response text based on the execution results includes: Based on the results, the intelligent agent collects the execution results of each of the atomized subtasks; Perform syntax and logic checks and factual accuracy checks on each of the execution results to obtain the checked execution results; Based on the execution result after verification, a natural language response text that matches the user's query intent is generated.
8. A question-response device based on multiple agents, characterized in that, include: The determination module is used to determine the corresponding target query task based on the natural language text currently entered by the user in response to the received query command. The decomposition module is used to analyze and break down the target query task to obtain multiple atomized subtasks; The matching module is used to match the plurality of atomized subtasks with each intelligent agent, so that each atomized subtask is matched with the corresponding target intelligent agent; An execution module is used to execute the corresponding atomized subtask for each target agent to obtain an execution result; The response module is used to generate natural language response text based on the execution results of each step.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program, which is loaded by a processor to perform the steps of the method according to any one of claims 1 to 7.
11. A computer program product, characterized in that, When the computer program product is run on an electronic device, it causes the electronic device to perform the steps of the method according to any one of claims 1 to 7.
Citation Information
Cited By
Question and answer method, device and equipment based on intelligent agent and storage medium
CN122088712A