Flood prevention question and answer method and device based on intelligent agent, storage medium and equipment

By using a tool classification model and candidate path confidence calculation, the problem of decreased accuracy and wasted resources caused by tool interference in flood control Q&A was solved, achieving efficient and accurate flood control Q&A.

CN121597809APending Publication Date: 2026-03-03BEIJING GLOBAL SAFETY TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202512031580.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

In flood control and emergency management scenarios, the centralized integration of diverse tools into intelligent agents leads to decreased accuracy in responses and increased processing time costs.

Method used

The tool classification model predicts the tool category corresponding to the flood control problem, and only highly relevant tools are used to generate the answer. The final answer is selected by combining the confidence of multiple candidate paths, thus avoiding interference from irrelevant tools and waste of resources.

Benefits of technology

It improved the accuracy of question answering, reduced system resource consumption, maintained the scalability and robustness of the agent, and enhanced user experience and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597809A_ABST
    Figure CN121597809A_ABST
Patent Text Reader

Abstract

The invention discloses a flood prevention question and answer method and device based on an intelligent agent, a storage medium and equipment, and belongs to the technical field of deep learning. Acquiring a flood prevention problem input by the user; a tool classification model is utilized to predict a tool category corresponding to the flood prevention problem, the tool category is obtained by classifying tools capable of being mounted by the intelligent agent, and each tool category is associated with at least two tools with non-overlapping functions; if the tool category corresponding to the flood prevention question is not predicted, the flood prevention question is input into n candidate paths for answer generation, and different candidate paths correspond to different answer generation modes; calculating the confidence coefficient of the candidate path according to the candidate answer generated by each candidate path for the flood prevention question; and generating a final answer of the flood prevention question according to the candidate answer corresponding to the candidate path with the highest confidence coefficient. According to the method, only a small number of tools highly related to questions can be mounted, the accuracy of questions and answers is ensured, and multiple candidate processing paths can be dynamically evaluated and adaptively selected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of deep learning technology, and in particular to a flood control question-answering method, apparatus, storage medium and device based on intelligent agents. Background Technology

[0002] Data in disaster emergency scenarios is complex and diverse. When using intelligent agents for flood prevention question answering, various types of data, models, and algorithms need to be mounted onto the large model in the intelligent agent in the form of tools. This places high demands on the reasoning, data processing capabilities, and answer accuracy of the large model.

[0003] For example, in flood control emergency management scenarios, to quickly respond to sudden rainstorms and floods, it is essential to efficiently address specialized issues such as real-time water level monitoring, flood risk assessment, and emergency resource allocation. The data sources involved in flood control emergency management are complex and diverse, requiring reliance on multiple tools to complete tasks, including weather forecasts, rainstorm warnings, communication infrastructure, emergency response information, disaster damage data, real-time rainfall details, and equipment operation monitoring. However, if all these diverse tools are integrated into a single large model, the sheer number of irrelevant tools and their varying usage scenarios can lead to decreased accuracy and potentially increased time costs for reasoning and processing. Summary of the Invention

[0004] This application provides a flood prevention question-answering method, apparatus, storage medium, and device based on an intelligent agent, to address the problem that when an intelligent agent is equipped with multiple tools, interference from numerous irrelevant tools can lead to a decrease in the accuracy of answers and potentially increase the time cost of reasoning and processing. The technical solution is as follows: According to a first aspect of this application, a flood control question-and-answer method based on an intelligent agent is provided, the method comprising: Obtain user input regarding flood control issues; The tool category corresponding to the flood control problem is predicted by using a pre-trained tool classification model. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap. If the tool category corresponding to the flood control problem is not predicted, then the flood control problem is input into n candidate paths to generate an answer, where different candidate paths correspond to different answer generation methods, and n≥2; Calculate the confidence level of each candidate path based on the candidate answers generated for the flood control problem; The final answer to the flood control problem is generated based on the candidate answer corresponding to the candidate path with the highest confidence.

[0005] In one possible implementation, the method further includes: If the tool category corresponding to the flood control problem is predicted, then the tools in the tool category are attached to the intelligent agent; The intelligent agent invokes the mounted tools to generate an answer to the flood control problem, thus obtaining the answer to the flood control problem.

[0006] In one possible implementation, the method further includes: If the agent fails to generate an answer to the flood control problem after calling the mounted tool, then the flood control problem is input into n candidate paths to generate an answer; Calculate the confidence level of each candidate path based on the candidate answers generated for the flood control problem; The final answer to the flood control problem is generated based on the candidate answer corresponding to the candidate path with the highest confidence.

[0007] In one possible implementation, calculating the confidence level of the candidate path based on the answer generated for the flood control problem for each candidate path includes: For each candidate path, select the m candidate answers with the highest scores from the multiple candidate answers generated for the flood control problem based on the candidate path; Obtain the weight corresponding to each candidate answer, wherein the score of the candidate answer is positively correlated with the magnitude of the weight; The confidence level of the candidate path is calculated based on the m candidate answers and their corresponding weights.

[0008] In one possible implementation, the method further includes: Compare the n confidence scores with the preset confidence threshold. If there is a confidence level greater than the confidence threshold, then the step of generating the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence level is triggered. If there is no confidence level greater than the confidence threshold, a prompt message is generated and displayed so that the user can provide supplementary explanations for the flood control issue based on the prompt message.

[0009] In one possible implementation, generating the prompt information includes: The reason for using the n candidate paths to generate the answer is determined; If the reason is that the tool category corresponding to the flood control problem was not predicted, then a prompt message containing a functional description of each tool category will be generated; If the reason is that the agent fails to generate an answer to the flood control problem after calling the mounted tool, then a prompt message containing a description of the necessary parameters of the tool will be generated.

[0010] In one possible implementation, the n candidate paths include at least two of the following: knowledge base retrieval path, large model generation path, and external search engine query path.

[0011] According to a second aspect of this application, a flood control question-and-answer device based on an intelligent agent is provided, the device comprising: The acquisition module is used to acquire flood control questions input by the user; The prediction module is used to predict the tool category corresponding to the flood control problem using a pre-trained tool classification model. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap. The candidate module is used to generate an answer by inputting the flood control problem into n candidate paths if the tool category corresponding to the flood control problem is not predicted. Different candidate paths correspond to different answer generation methods, and n≥2. The calculation module is used to calculate the confidence level of the candidate path based on the candidate answers generated for the flood control problem for each candidate path; The generation module is used to generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

[0012] According to a third aspect of this application, a computer-readable storage medium is provided, wherein at least one instruction is stored therein, the at least one instruction being loaded and executed by a processor to implement the agent-based flood control question-and-answer method as described above.

[0013] According to a fourth aspect of this application, a computer device is provided, the computer device including the above-described agent-based flood control question-and-answer device.

[0014] The beneficial effects of the technical solution provided in this application include at least the following: The flood control question input by the user is first inferred by the tool classification model to obtain a category; then, a small number of pre-configured tools are dynamically attached to the agent according to the tool category to complete the subsequent tool calling and response generation process. Since only a small number of tools that are highly relevant to the current flood control question are attached each time, the recognition conflict caused by too many tools can be effectively avoided, ensuring the accuracy of question answering, while significantly reducing system resource consumption and improving the stability of tool calling.

[0015] By moving the tool selection problem forward to a tool classification model trained on historical data, the tool management logic and the large model generation logic are decoupled. This allows the agent to maintain good scalability, robustness, and user experience even as the scale of tools continues to expand, demonstrating significant technical advantages and application value.

[0016] In scenarios where the tool category or execution failure cannot be predicted, multiple candidate processing paths are dynamically evaluated and adaptively selected to dynamically choose the optimal processing method. This avoids invalid retrieval and blind generation, improves the stability, response rationality, and user interaction experience of the system under complex and uncertain problem conditions, and can also guide users to clarify their needs when uncertainty is high, thereby improving the overall response success rate and stability of the system. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart of an agent-based flood control question-and-answer method provided in one embodiment of this application; Figure 2 This is a schematic diagram illustrating the training process of a tool classification model provided in one embodiment of this application; Figure 3 This is a flowchart of a flood control question-and-answer method based on an intelligent agent provided in another embodiment of this application; Figure 4 This is a structural block diagram of a flood control question-and-answer device based on an intelligent agent provided in one embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0020] like Figure 1 The diagram illustrates a flowchart of a flood control question-and-answer method based on an agent according to an embodiment of this application. This agent-based flood control question-and-answer method can be applied to computer devices. The agent-based flood control question-and-answer method may include: Step 101: Obtain the flood control question input by the user.

[0021] The intelligent agent includes an input interface where users can input flood prevention questions to be answered. These questions can be text, voice, or video; this embodiment does not impose any limitations.

[0022] Step 102: Use a pre-trained tool classification model to predict the tool category corresponding to the flood control problem. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap.

[0023] The data sources involved in flood control scenarios are complex and diverse, requiring reliance on multiple tools such as weather forecasts, rainstorm warnings, communication infrastructure, emergency response information, disaster damage status, real-time rainfall details, and equipment operation monitoring to complete the task. If all these diverse tools are integrated into a single intelligent agent, interference from numerous irrelevant tools will lead to a decrease in the accuracy of the answers and may increase the time cost of reasoning and processing.

[0024] To address this issue, the tools to be attached can be categorized into multiple tool categories, each associated with a small number of non-overlapping tools. Then, after the user inputs a flood prevention question, the system first predicts the tool category to which the likely tools will be invoked, and then attaches the tools from that category to the agent. Next, the large model generates the tool invocation intent and parameter information based on the current task context. The agent executes the corresponding tool according to this intent and parameter information and obtains the execution result. The large model then integrates the execution results into the answer to the flood prevention question and outputs it. This approach accurately matches the required tools, reduces the number of tools the agent needs to attach, avoids interference from irrelevant tools in the answer, and reduces the time cost of inference processing.

[0025] When categorizing tools, we can obtain the functional attributes of each tool and group tools with non-overlapping functions but common characteristics into a single tool category. For example, a category could be "Intelligent Recommendation," which includes tools for expert recommendation, rescue team recommendation, and contingency plan recommendation.

[0026] When predicting the tool category to be used based on a user's input of a flood prevention question, one approach is to obtain a pre-trained tool classification model. The flood prevention question is then input into this model, which extracts a feature vector from the question and uses this vector to predict the tool category. For example, when a user asks, "Please recommend experts in the field of flood prevention," the tool classification model can predict that the tool category is the intelligent recommendation category.

[0027] like Figure 2 As shown, the tool classification model needs to be trained before it can be used: (1) Data preparation A large amount of historical question-and-answer data was collected and cleaned. Then, flood control questions and the tools used to answer them were extracted. Each flood control question and the tool category to which it belongs were treated as a sample. Based on their function, the samples were divided into training samples and validation samples. The training samples were used to train the model, and the validation samples were used to evaluate the model's performance.

[0028] (2) Model initialization Load or initialize the model structure and model parameters. The model structure can be of many types, such as a Bidirectional Encoder Representations from Transformers (BERT) model, etc., which is not limited in this embodiment.

[0029] (3) Training data The model is trained using the prepared training samples, and the model parameters are updated.

[0030] (4) Model evaluation The model is evaluated using prepared validation samples to determine if its performance meets the requirements. If the model's performance meets the requirements, a trained tool classification model can be obtained.

[0031] (5) Model Deployment The qualified tool classification models will be deployed to real-world application environments to provide services to external parties.

[0032] Step 103: If the tool category corresponding to the flood control problem is not predicted, the flood control problem is input into n candidate paths to generate the answer. Different candidate paths correspond to different answer generation methods, and n≥2.

[0033] If the tool classification model outputs another category, it means no tool category was matched to the flood control problem. Alternatively, the flood control problem may be too general for the model to recognize its intent. In this case, the model might be unable to predict the tool category corresponding to the flood control problem, thus failing to select the appropriate tool and generate an answer by calling the tool. In such situations, generating an answer using n candidate paths avoids the agent being unable to output an answer, improving the user experience.

[0034] Each candidate path can independently generate at least one candidate answer to the flood control problem, and each candidate path handles the flood control problem in a different way.

[0035] Step 104: Calculate the confidence level of the candidate path based on the candidate answers generated for each candidate path to the flood control problem.

[0036] Since the quality of the candidate answers generated by each candidate path is different, it is also necessary to generate the confidence level of the candidate paths based on the candidate answers, and then select the best answer based on the confidence level.

[0037] Step 105: Generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

[0038] Generally speaking, the higher the confidence level, the better the quality of the candidate answers. Therefore, we can choose the candidate path with the highest confidence level and generate the final answer to the flood control question based on the candidate answers generated by that candidate path, thereby improving the accuracy of the question and answer.

[0039] In summary, the flood control question-and-answer method based on intelligent agents provided in this application embodiment... like Figure 3 The diagram illustrates a flowchart of an agent-based flood control question-and-answer method according to an embodiment of this application. This agent-based flood control question-and-answer method can be applied to computer devices. The agent-based flood control question-and-answer method may include: Step 301: Obtain the flood control question input by the user.

[0040] The intelligent agent includes an input interface where users can input flood prevention questions to be answered. These questions can be text, voice, or video; this embodiment does not impose any limitations.

[0041] Step 302: Use a pre-trained tool classification model to predict the tool category corresponding to the flood control problem. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap.

[0042] In this embodiment, the tool interface needs to be encapsulated according to the format specified by the agent, defining the calling method, address, input / output parameter types and descriptions, giving each tool a unique name, recording the mapping relationship between tool names and tools, and classifying all tools according to their functional descriptions to obtain multiple tool categories. Each tool category is associated with a small number of tools with non-overlapping functions. Then, after the user inputs a flood prevention question, the system first predicts the tool category to which the tool might be called, and then attaches the tools in that category to the agent. Next, the large model generates the tool calling intent and parameter information based on the context of the current task. The agent executes the corresponding tool according to the calling intent and parameter information and obtains the execution result. The large model then integrates the execution result into the answer to the flood prevention question and outputs it. In this way, the required tools can be accurately matched, the number of tools that the agent needs to attach to can be reduced, interference from irrelevant tools can be avoided, and the time cost of inference processing can be reduced.

[0043] When categorizing tools, we can obtain the functional attributes of each tool and group tools with non-overlapping functions but common characteristics into a single tool category. For example, a category could be "Intelligent Recommendation," which includes tools for expert recommendation, rescue team recommendation, and contingency plan recommendation.

[0044] When predicting the tool category to be used based on a user's input of a flood prevention question, one approach is to obtain a pre-trained tool classification model. The flood prevention question is then input into this model, which extracts a feature vector from the question and uses this vector to predict the tool category. For example, when a user asks, "Please recommend experts in the field of flood prevention," the tool classification model can predict that the tool category is the intelligent recommendation category.

[0045] Step 303: If the tool category corresponding to the flood control problem is not predicted, the flood control problem is input into n candidate paths to generate the answer. Different candidate paths correspond to different answer generation methods, and n≥2.

[0046] If the tool classification model outputs another category, it means no tool category was matched to the flood control problem. Alternatively, the flood control problem may be too general for the model to recognize its intent. In this case, the model might be unable to predict the tool category corresponding to the flood control problem, thus failing to select the appropriate tool and generate an answer by calling the tool. In such situations, generating an answer using n candidate paths avoids the agent being unable to output an answer, improving the user experience.

[0047] Each candidate path can independently generate at least one candidate answer to the flood control problem, and each candidate path handles the flood control problem in a different way.

[0048] In one implementation, the n candidate paths include at least two of the following: knowledge base retrieval path, large model generation path, and external search engine query path.

[0049] When the candidate path is a knowledge base retrieval path, the user's question can be vectorized, and semantic retrieval can be performed in a pre-built vector knowledge base to find the most relevant candidate answers (e.g., Top 3).

[0050] When the candidate path is a path generated by a large model, the user's flood control question can be directly input into the large model. The large model generates the most relevant candidate answers (e.g., Top 3) based on the massive amount of general knowledge and logical reasoning ability it has learned during training.

[0051] When the candidate path is an external search engine query path, the flood control question is converted into keywords suitable for the search engine, and then the search engine API (such as Bing Search, Google Search) is called to obtain the most relevant candidate answers (e.g., Top 3).

[0052] Step 304: Calculate the confidence level of the candidate path based on the candidate answers generated for each candidate path to the flood control problem.

[0053] Specifically, calculating the confidence level of a candidate path based on the answers generated for the flood control question for each candidate path can include: for each candidate path, selecting the m highest-scoring candidate answers from the multiple candidate answers generated for the flood control question, where m is a positive integer; obtaining the weight corresponding to each candidate answer; and calculating the confidence level of the candidate path based on the m candidate answers and their corresponding weights. The score of a candidate answer is positively correlated with its weight; that is, the higher the score of a candidate answer, the higher its quality, and assigning it a larger weight can enhance the contribution of the most relevant candidate answer to the overall confidence level. Assuming m=3, the weight corresponding to the top 1 candidate answer is denoted as w1, the weight corresponding to the top 2 candidate answer is denoted as w2, and the weight corresponding to the top 3 candidate answer is denoted as w3, then w1 > w2 > w3. In one example, w1=0.5, w2=0.3, and w3=0.2.

[0054] Assuming the candidate path is a knowledge base retrieval path, the three candidate answers generated are sorted into s1, s2 and s3 according to the score from high to low, and the corresponding three weights are w1, w2 and w3 respectively. Then the confidence of the candidate path is C = (w1s1 + w2s2 + w3s3) / (w1 + w2 + w3).

[0055] In this embodiment, the n confidence levels can also be compared with a preset confidence threshold. If there is a confidence level greater than the confidence threshold, step 305 is triggered. If there is no confidence level greater than the confidence threshold, a prompt message is generated and displayed so that the user can provide supplementary explanations on the flood control issue based on the prompt message.

[0056] Specifically, generating prompt information may include: determining the reason for using n candidate paths to generate the answer; if the reason is that the tool category corresponding to the flood control problem was not predicted, then generating prompt information containing functional descriptions of each tool category.

[0057] If the tool category is not predicted, it may be because the flood control problem is too general, making it impossible for the tool classification model to identify its intent. In this case, the user needs to provide supplementary information about the current flood control problem to clarify the requirements, and then execute step 201 again.

[0058] To help users clearly identify the information they need to add, the system can also display functional descriptions of all tool categories. This allows users to add the required functional descriptions to new flood control problems, enabling the tool classification model to predict tool categories based on these descriptions and thus improving the accuracy of category predictions.

[0059] Step 305: Generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

[0060] Generally speaking, the higher the confidence level, the better the quality of the candidate answers. Therefore, we can choose the candidate path with the highest confidence level and generate the final answer to the flood control question based on the candidate answers generated by that candidate path, thereby improving the accuracy of the question and answer.

[0061] For multiple candidate answers generated from a candidate path, these candidate answers can be merged to obtain the final answer, or the candidate answer with the highest score can be directly used as the final answer. This embodiment does not limit this.

[0062] Step 306: If the tool category corresponding to the flood control problem is predicted, then the tools in the tool category are attached to the intelligent agent.

[0063] For example, when a user asks "Please recommend experts in the field of flood control", the tool category is determined to be the intelligent recommendation category, and all three tools under the intelligent recommendation category are mounted to the intelligent agent.

[0064] Step 307: Use the intelligent agent to call the mounted tools to generate an answer to the flood control problem, and obtain the answer to the flood control problem.

[0065] When using an agent, you need to write its prompts, which should include: tool selection, parameter extraction, execution results, and output format. In one example, the prompts are as follows: { "role": "user", "content": "System: Your task is to select the appropriate tool from the [Toolset] below based on the input content. You need to pay attention to the following points:" 1. Use a JSON blob to specify a tool by providing the "tool name" and "tool input parameters". 2. The format of $JSON_BLOB is as follows: ``` { "action": The selected tool, "action_input": All parameters required by the tool and their corresponding values} ``` 3. Select only one tool 4. If the input does not contain a parameter for the selection tool, please directly output "Unknown" after that parameter in the `action_input` field of `$JSON_BLOB`. 5. The `action_input` function should only output the parameters included in the selection tool, and should strictly adhere to the format required by the tool parameters. 6. Please follow the [answer format] when answering. ## [Tools Set] rainfall_forecast: Impact analysis of rainfall forecast and short-term forecast, args: {'flag':{'title': 'Flag', 'description': 'Type flags include: rainfall forecast, short-term forecast', 'type': 'string'}, 'type': {'title': 'Type', 'description': 'Equipment type: includes tower, base station, cell', 'type': 'string'}} ## [Answer Format] Question: Briefly summarize the questions to be answered. Observation: Action Results Thinking: I know how to respond. action: ``` $JSON_BLOB ``` Human: Based on the weather station's rainfall forecast analysis, which areas might be at risk of base station disruptions? This was your previous work (but I haven\'t seen any of it! I only see what you return as final answer): Question: Based on the meteorological observatory's rainfall forecast analysis, which areas might be at risk of base station disruption? Observation: Users need to understand the potential impact of specific types of equipment (base stations) on upcoming rainfall forecasts.

[0066] Consideration: Based on user needs, the "rainfall_forecast" tool should be used for rainfall forecasting and short-term forecast impact analysis, with particular attention to potential impacts on base stations.

[0067] action: ``` {"action":"rainfall_forecast","action_input":{"flag":"rainfall forecast","type":"base station"}} ``` Observation: ## Task The following content is summarized with reference to the example. ##Require 1. Summarize using natural language, without requiring further explanation. 2. The final answer should follow the format below: ``` { "action": "Final Answer" "action_input":"Summary content" } ``` return.

[0068] ##Example content {'Analysis of the Impact of Rainfall': 'The rainfall forecast issued by the National Meteorological Center from 08:00 to 20:00 on September 18, 2024, based on model analysis, indicates that communication facilities experienced outages / disruptions due to rainfall, with Henan Province being the most affected, involving 18 counties.'} Summarize According to the rainfall forecast issued by the National Meteorological Center from 08:00 to 20:00 on September 18, 2024, model analysis indicates that communication facilities will be affected by rainfall and experience service outages / disruptions. Henan Province is the most affected province, involving a total of 18 counties.

[0069] ## content {'Analysis of the Impact of Rainfall': 'The rainfall forecast issued by the National Meteorological Center from 08:00 to 20:00 on September 29, 2024, based on model analysis, indicates that communication facilities will experience service outages / disruptions due to rainfall. The provinces most affected are Shaanxi, Inner Mongolia, Sichuan, and Shanxi, involving a total of 59 counties.'} Thought:" } Step 308: If the agent fails to generate an answer to the flood control problem after calling the mounted tool, then input the flood control problem into n candidate paths to generate an answer.

[0070] If the network signal is unstable when calling the tool, or if the flood control problem is too general and lacks the necessary parameters for tool invocation, the tool may fail to generate execution results, thus preventing the generation of an answer through tool invocation. In this case, generating an answer using n candidate paths avoids situations where the agent cannot output an answer, improving the user experience.

[0071] The details of the n candidate paths and the answer generation process are described in step 303, and will not be repeated here.

[0072] Step 309: Calculate the confidence level of the candidate path based on the candidate answers generated for each candidate path to the flood control problem.

[0073] Specifically, calculating the confidence level of each candidate path based on the answers generated for the flood control question can include: for each candidate path, selecting the m highest-scoring candidate answers from the multiple candidate answers generated for the flood control question, where m is a positive integer; obtaining the weight corresponding to each candidate answer; and calculating the confidence level of the candidate path based on the m candidate answers and their corresponding weights. The score of a candidate answer is positively correlated with its weight. For details of the process, please refer to step 304, which will not be repeated here.

[0074] In this embodiment, the n confidence levels can also be compared with a preset confidence threshold. If there is a confidence level greater than the confidence threshold, step 310 is triggered. If there is no confidence level greater than the confidence threshold, a prompt message is generated and displayed so that the user can provide supplementary explanations on flood prevention issues based on the prompt message.

[0075] Specifically, the generated prompt information may include: determining the reason for using n candidate paths to generate the answer; if the reason is that the agent failed to generate an answer to the flood control problem after calling the mounted tool, then a prompt information containing a description of the necessary parameters of the tool will be generated.

[0076] If the tool category is not predicted, it may be because the flood control problem lacks the necessary parameters for tool invocation, making the tool unable to execute. In this case, the user needs to provide supplementary information about the current flood control problem to clarify the necessary parameters, and then execute step 201 again.

[0077] To help users clearly understand what needs to be added, the system can also display descriptions of the necessary parameters required for the tool call, so that users can add the necessary parameters to the new flood control problem, making it easier for the tool to generate execution results and thus increasing the success rate of the tool call.

[0078] Step 310: Generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

[0079] Generally speaking, the higher the confidence level, the better the quality of the candidate answers. Therefore, we can choose the candidate path with the highest confidence level and generate the final answer to the flood control question based on the candidate answers generated by that candidate path, thereby improving the accuracy of the question and answer.

[0080] For multiple candidate answers generated from a candidate path, these candidate answers can be merged to obtain the final answer, or the candidate answer with the highest score can be directly used as the final answer. This embodiment does not limit this.

[0081] In summary, the flood control question-and-answer method based on intelligent agents provided in this application embodiment... like Figure 4The diagram illustrates a structural block diagram of a flood control question-and-answer device based on an embodiment of this application. This device can be applied to computer equipment and includes: The acquisition module 410 is used to acquire flood control questions input by the user; The prediction module 420 is used to predict the tool category corresponding to the flood control problem using a pre-trained tool classification model. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap. Candidate module 430 is used to generate an answer by inputting the flood control problem into n candidate paths if the tool category corresponding to the flood control problem is not predicted. Different candidate paths correspond to different answer generation methods, and n≥2. The calculation module 440 is used to calculate the confidence level of the candidate path based on the candidate answers generated for the flood control problem for each candidate path; The generation module 450 is used to generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

[0082] In an optional embodiment, the device further includes: The mounting module is used to mount the tools in the tool category to the intelligent agent if the tool category corresponding to the flood control problem is predicted. The generation module 450 is also used to generate answers to flood control problems by using the intelligent agent to call the mounted tools.

[0083] In an optional embodiment, the candidate module 430 is further configured to input the flood control problem into n candidate paths to generate an answer if the agent fails to generate an answer to the flood control problem after calling the mounted tool; The calculation module 440 is also used to calculate the confidence level of the candidate path based on the candidate answers generated for the flood control problem for each candidate path; The generation module 450 is also used to generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

[0084] In an optional embodiment, the calculation module 440 is further configured to: For each candidate path, select the m candidate answers with the highest scores from the multiple candidate answers generated for the flood control question based on the candidate path; Obtain the weight corresponding to each candidate answer, where the score of the candidate answer is positively correlated with the weight. The confidence level of a candidate path is calculated based on m candidate answers and their corresponding weights.

[0085] In an optional embodiment, the device further includes: The comparison module is used to compare n confidence levels with a preset confidence threshold. The triggering module is used to trigger the step of generating the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence if there is a confidence level greater than the confidence level threshold. The prompt module is used to generate and display a prompt message if there is no confidence level greater than the confidence threshold, so that users can provide supplementary explanations on flood prevention issues based on the prompt message.

[0086] In an optional embodiment, the prompting module is further configured to: The reason for using n candidate paths to generate the answer is determined; If the reason is that the tool category corresponding to the flood control problem was not predicted, then a prompt message containing the function description of each tool category will be generated; If the reason is that the agent failed to generate an answer to the flood control problem after calling the mounted tool, then a prompt message containing a description of the necessary parameters of the tool will be generated.

[0087] In one optional embodiment, the n candidate paths include at least two of the following: knowledge base retrieval path, large model generation path, and external search engine query path.

[0088] In summary, the flood control question-and-answer device based on intelligent agents provided in this application embodiment, One embodiment of this application provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to implement the agent-based flood control question-and-answer method described above.

[0089] One embodiment of this application provides a computer device, which includes any of the above-described agent-based flood control question-and-answer devices.

[0090] It should be noted that the agent-based flood control question-and-answer device provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the agent-based flood control question-and-answer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the agent-based flood control question-and-answer device and the agent-based flood control question-and-answer method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.

[0091] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0092] The above description is not intended to limit the embodiments of this application. Any adjustments, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of the embodiments of this application.

Claims

1. A flood control question-and-answer method based on intelligent agents, characterized in that, The method includes: Obtain user input regarding flood control issues; The tool category corresponding to the flood control problem is predicted by using a pre-trained tool classification model. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap. If the tool category corresponding to the flood control problem is not predicted, then the flood control problem is input into n candidate paths to generate an answer, where different candidate paths correspond to different answer generation methods, and n≥2; Calculate the confidence level of each candidate path based on the candidate answers generated for the flood control problem; The final answer to the flood control problem is generated based on the candidate answer corresponding to the candidate path with the highest confidence.

2. The flood control question-and-answer method based on intelligent agents according to claim 1, characterized in that, The method further includes: If the tool category corresponding to the flood control problem is predicted, then the tools in the tool category are attached to the intelligent agent; The intelligent agent invokes the mounted tools to generate an answer to the flood control problem, thus obtaining the answer to the flood control problem.

3. The flood control question-and-answer method based on intelligent agents according to claim 2, characterized in that, The method further includes: If the agent fails to generate an answer to the flood control problem after calling the mounted tool, then the flood control problem is input into n candidate paths to generate an answer; Calculate the confidence level of each candidate path based on the candidate answers generated for the flood control problem; The final answer to the flood control problem is generated based on the candidate answer corresponding to the candidate path with the highest confidence.

4. The agent-based flood control question-and-answer method according to claim 1 or 3, characterized in that, The step of calculating the confidence level of the candidate path based on the answer generated for the flood control problem for each candidate path includes: For each candidate path, select the m candidate answers with the highest scores from the multiple candidate answers generated for the flood control problem based on the candidate path; Obtain the weight corresponding to each candidate answer, wherein the score of the candidate answer is positively correlated with the magnitude of the weight; The confidence level of the candidate path is calculated based on the m candidate answers and their corresponding weights.

5. The agent-based flood control question-and-answer method according to claim 1 or 3, characterized in that, The method further includes: Compare the n confidence scores with the preset confidence threshold. If there is a confidence level greater than the confidence threshold, then the step of generating the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence level is triggered. If there is no confidence level greater than the confidence threshold, a prompt message is generated and displayed so that the user can provide supplementary explanations for the flood control issue based on the prompt message.

6. The flood control question-and-answer method based on intelligent agents according to claim 5, characterized in that, The generated prompt information includes: The reason for using the n candidate paths to generate the answer is determined; If the reason is that the tool category corresponding to the flood control problem was not predicted, then a prompt message containing a functional description of each tool category will be generated; If the reason is that the agent fails to generate an answer to the flood control problem after calling the mounted tool, then a prompt message containing a description of the necessary parameters of the tool will be generated.

7. The flood control question-and-answer method based on intelligent agents according to claim 1, characterized in that, The n candidate paths include at least two of the following: knowledge base retrieval path, large model generation path, and external search engine query path.

8. A flood control question-and-answer device based on intelligent agents, characterized in that, The device includes: The acquisition module is used to acquire flood control questions input by the user; The prediction module is used to predict the tool category corresponding to the flood control problem using a pre-trained tool classification model. The tool category is obtained by classifying the tools that the agent can attach to, and each tool category is associated with at least two tools whose functions do not overlap. The candidate module is used to generate an answer by inputting the flood control problem into n candidate paths if the tool category corresponding to the flood control problem is not predicted. Different candidate paths correspond to different answer generation methods, and n≥2. The calculation module is used to calculate the confidence level of the candidate path based on the candidate answers generated for the flood control problem for each candidate path; The generation module is used to generate the final answer to the flood control problem based on the candidate answer corresponding to the candidate path with the highest confidence.

9. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by a processor to implement the agent-based flood control question-and-answer method as described in any one of claims 1 to 7.

10. A computer device, characterized in that, The computer device includes: the agent-based flood control question-and-answer device as described in claim 8.