Dialogue generation method and device integrating knowledge base questions and answers and agents

The tools related to target issues are screened through large language models, and the knowledge base question and answer tools or intelligence analysis and reasoning generate answers to solve the problem of low accuracy of answering information in the existing technology and achieve more accurate dialogue generation.

CN119336868APending Publication Date: 2025-01-21BEIJING SUPERMAP SOFTWARE CO LTD +5
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411371235.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The prior art needs to provide relevant information, questions raised by the user and all tools to the agent after each question, resulting in low accuracy of the generated reply information and contains meaningless or unrelated content.

Method used

The target tools related to target issues are described through the target issues and tools through large language models. If there is a knowledge base question and answer tool, it uses it to retrieve relevant information to generate answers. Provide to smart bodies.

Benefits of technology

The accuracy of the generating answer information has been improved, and the response information of generating mixed, meaningless or irrelevant content is avoided, and the problem of lowering information accuracy in the existing technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336868A_ABST
    Figure CN119336868A_ABST
Patent Text Reader

Abstract

The invention discloses a dialogue generation method and device integrating knowledge base questions and answers and intelligent agents. According to the scheme, description information of N tools and a target problem proposed by a user are obtained; screening out M target tools from the N tools through a large language model according to the target problem and the description information; if the knowledge base question-answering tool exists in the M target tools, the knowledge base question-answering tool is utilized to retrieve related information of the target question from a preset knowledge base, and first reply information is generated according to the related information; and if the knowledge base question and answer tool does not exist in the M target tools, analyzing and reasoning the description information and the target question of the M target tools through the intelligent agent, and generating second reply information. According to the technical scheme, the accuracy of the generated reply information is improved, and the technical problem that in the dialogue generation process in the prior art, the accuracy of the generated reply information is low is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and device for generating dialogues integrating knowledge base question-answering and intelligent agents. Background Art

[0002] At present, the big language model has two major application scenarios: knowledge base question and answer and intelligent agent. Knowledge base question and answer is aimed at question and answer applications, that is, after the user asks a question, the relevant knowledge in the preset knowledge base is retrieved, and the big language model gives an answer based on the relevant knowledge. Intelligent agent is aimed at intelligent assistant applications. After the user asks a question, the intelligent agent thinks and plans independently and helps the user solve the problem by calling tools.

[0003] Usually, knowledge base question and answer and intelligent agent are two independent business systems. In order to meet business needs, the existing technology integrates the knowledge base retrieval function of knowledge base question and answer into the intelligent agent to achieve the integration of the functions of knowledge base question and answer and intelligent agent. Specifically, after each question asked by the user, it is necessary to retrieve the relevant information in the preset knowledge base, and provide the relevant information, the questions raised by the user and the information of all tools (such as search engine API, email sending tool, instant messaging API, etc.) to the intelligent agent, and the intelligent agent generates reply information based on all the above content. However, the above scheme requires the relevant information, the questions raised by the user and all tools to be provided to the intelligent agent after each question asked by the user, which easily causes the intelligent agent to generate mixed reply information containing meaningless or irrelevant content, resulting in a low accuracy rate of the generated reply information. Summary of the invention

[0004] Based on the above problems, the present application provides a method and device for generating dialogues integrating knowledge base question and answer and intelligent agent, aiming to solve the technical problem of low accuracy of generated reply information in the dialogue generation process of the prior art.

[0005] The embodiments of the present application disclose the following technical solutions:

[0006] In a first aspect of the present application, a method for generating a dialogue integrating knowledge base question answering and an intelligent agent is provided, the method comprising:

[0007] Obtain description information of N tools and target questions raised by users; N is an integer greater than 1;

[0008] M target tools are selected from N tools according to the target question and description information through a large language model; M is an integer greater than or equal to 1, and M is less than N;

[0009] If there is a knowledge base question-answering tool among the M target tools, the knowledge base question-answering tool is used to retrieve relevant information of the target question from a preset knowledge base, and first reply information is generated according to the relevant information;

[0010] If there is no knowledge base question-answering tool among the M target tools, the intelligent agent analyzes and infers the description information and target questions of the M target tools to generate second reply information.

[0011] In an optional implementation, M target tools are selected from N tools according to the target question and description information by using a large language model, including:

[0012] A first prompt word is constructed based on the target question and the description information; the first prompt word is used to control the large language model to perform a tool screening operation, and the tool screening operation is used to screen out tools related to the target question from N tools;

[0013] The first prompt word is input into the large language model, and the large language model selects M target tools from N tools based on the first prompt word.

[0014] In an optional implementation, the knowledge base question-answering tool is used to retrieve relevant information of the target question from a preset knowledge base, and first reply information is generated according to the relevant information, including:

[0015] Obtain historical conversation information and target configuration parameters; the target configuration parameters are used to control the retrieval operation of the knowledge base question-answering tool in the preset knowledge base; the historical conversation information is the conversation information related to the target question during the user conversation;

[0016] Calling a dialogue function in the knowledge base question-answering tool, and having the dialogue function retrieve relevant information from a preset knowledge base based on a target question and target configuration parameters;

[0017] The first reply information is generated by the dialogue function based on the relevant information, historical dialogue information and the target question.

[0018] In an optional implementation, if there is no knowledge base question-answering tool in the M target tools, the intelligent agent analyzes and infers the description information and target questions of the M target tools to generate second reply information, including:

[0019] Constructing a second prompt word according to the description information of the M target tools and the target question;

[0020] The intelligent agent decides whether to call the target tool to solve the target problem according to the second prompt word, and obtains a decision result;

[0021] If the decision result is the first decision result, the intelligent agent selects K target processing tools from the M target tools according to the second prompt word, and uses the K target processing tools to process the target problem to generate second reply information; K is an integer greater than or equal to 1, and K is less than or equal to M.

[0022] In an optional implementation manner, if the decision result is the second decision result, the dialogue generation method further includes:

[0023] The intelligent agent directly analyzes and reasons about the target question to generate third-party response information.

[0024] In a second aspect of the present application, a device for generating a dialogue integrating knowledge base question and answer and an intelligent agent is provided, the device comprising:

[0025] The acquisition module is used to obtain description information of N tools and target questions raised by users; N is an integer greater than 1;

[0026] A screening module, used to screen M target tools from N tools according to the target question and description information through a large language model; M is an integer greater than or equal to 1, and M is less than N;

[0027] A first generating module is used for, if there is a knowledge base question and answer tool among the M target tools, using the knowledge base question and answer tool to retrieve relevant information of the target question from a preset knowledge base, and generating first reply information according to the relevant information;

[0028] The second generation module is used to generate second reply information by analyzing and reasoning the description information and target questions of the M target tools through an intelligent agent if there is no knowledge base question-answering tool among the M target tools.

[0029] Optionally, the screening module includes:

[0030] A prompt word construction unit is used to construct a first prompt word based on the target question and the description information; the first prompt word is used to control the large language model to perform a tool screening operation, and the tool screening operation is used to screen out tools related to the target question from N tools;

[0031] The screening unit is used to input the first prompt word into the large language model, and the large language model screens M target tools from N tools based on the first prompt word.

[0032] Optionally, the first generating module includes:

[0033] The acquisition unit is used to acquire historical conversation information and target configuration parameters; the target configuration parameters are used to control the retrieval operation of the knowledge base question-answering tool in the preset knowledge base; the historical conversation information is the conversation information related to the target question during the user conversation process;

[0034] An information retrieval unit, used to call a dialogue function in the knowledge base question-answering tool, and the dialogue function retrieves relevant information from a preset knowledge base based on a target question and target configuration parameters;

[0035] The first generating unit is used to generate first reply information based on relevant information, historical dialogue information and target question by the dialogue function function.

[0036] Optionally, the second generating module includes:

[0037] A construction unit, used to construct a second prompt word according to the description information of the M target tools and the target problem;

[0038] A decision-making unit, used for the agent to decide whether to call a target tool to process a target problem according to the second prompt word, and obtain a decision result;

[0039] The second generation unit is used for, if the decision result is the first decision result, the intelligent agent selects K target processing tools from M target tools according to the second prompt word, and uses the K target processing tools to process the target problem to generate second reply information; K is an integer greater than or equal to 1, and K is less than or equal to M.

[0040] Optionally, the dialogue generating device further includes:

[0041] The third generation unit is used for the intelligent agent to directly analyze and reason about the target question and generate third response information.

[0042] Compared with the prior art, this application has the following beneficial effects:

[0043] In the technical solution of the present application, M target tools are screened out from N tools based on the description information of the N tools obtained and the target question raised by the user through a large language model, and M target tools related to the target question can be screened out, so as to ensure that the functions of the selected tools (i.e., the M target tools) are more in line with the actual needs of the target question; if there is a pre-set knowledge base question and answer tool among the M target tools, the knowledge base question and answer tool is used to retrieve relevant information of the target question from the preset knowledge base, and the first reply information is generated based on the relevant information, without providing the relevant information to the intelligent agent; if there is no pre-set knowledge base question and answer tool among the M target tools, the description information of the M target tools and the target question are directly analyzed and inferred by the intelligent agent to generate the second reply information, without retrieving relevant information of the target question from the preset knowledge base, avoiding the need to provide the relevant information, the target question and the description information of all tools to the intelligent agent after each question asked by the user, resulting in the generation of mixed reply information containing meaningless or irrelevant content, thereby improving the accuracy of the generated reply information, and further solving the technical problem of low accuracy of the generated reply information in the dialogue generation process of the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0045] Figure 1 A flowchart of a method for generating a dialogue integrating knowledge base question and answer and intelligent agent provided in an embodiment of the present application;

[0046] Figure 2 A flowchart of another method for generating a dialogue integrating knowledge base question and answer and intelligent agent provided in an embodiment of the present application;

[0047] Figure 3 A flowchart of a tool screening process provided in an embodiment of the present application;

[0048] Figure 4 A schematic diagram of a first reply information provided in an embodiment of the present application;

[0049] Figure 5 A flowchart of a process for generating second reply information and third reply information provided in an embodiment of the present application;

[0050] Figure 6 A schematic diagram of a second reply information provided in an embodiment of the present application;

[0051] Figure 7 A schematic diagram of the structure of a device for generating dialogues integrating knowledge base question and answer and intelligent agent provided in an embodiment of the present application;

[0052] Figure 8 A schematic diagram of the structure of a screening module provided in an embodiment of the present application;

[0053] Fig. 9 A schematic diagram of the structure of a first generation module provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] As described above, the current knowledge base question and answer and intelligent agent are two independent business systems. In order to meet business needs, the existing technology integrates the knowledge base retrieval function of the knowledge base question and answer into the intelligent agent to achieve the integration of the functions of the knowledge base question and answer and the intelligent agent. Specifically, after each question asked by the user, it is necessary to retrieve the relevant knowledge in the preset knowledge base and provide the relevant knowledge to the intelligent agent; at the same time, the questions raised by the user and the information of all tools (such as search engine API, email sending tool, instant messaging API, etc.) are provided to the intelligent agent, and the intelligent agent generates reply information based on all the above content. However, the above scheme requires that the relevant information, the questions raised by the user and all tools be provided to the intelligent agent after each question asked by the user, which easily causes the intelligent agent to generate mixed reply information containing meaningless or irrelevant content, resulting in a low accuracy rate of the generated reply information.

[0055] After research, the inventor proposed to pre-set a knowledge base question and answer function (i.e., a function of retrieving relevant information of a target question from a preset knowledge base and generating reply information based on the relevant information) as a knowledge base question and answer tool; after a user raises a target question, M target tools are screened out from the N tools based on the description information of the N tools obtained and the target question raised by the user through a large language model, so that the M target tools related to the target question can be screened out, thereby ensuring that the functions of the selected tools are more in line with the actual needs of the target question; if a preset knowledge base question and answer tool exists among the M target tools, the knowledge base question and answer tool is used to retrieve relevant information of the target question from the preset knowledge base, and based on the relevant The first reply information is generated based on the relevant information, without providing the relevant information to the intelligent agent; if there is no pre-set knowledge base question-answering tool among the M target tools, the description information and the target question of the M target tools are directly analyzed and inferred by the intelligent agent to generate the second reply information, without retrieving the relevant information of the target question from the preset knowledge base, thereby avoiding the need to provide the relevant information, the target question and the description information of all tools to the intelligent agent after each question asked by the user, resulting in the generation of mixed reply information containing meaningless or irrelevant content, thereby improving the accuracy of the generated reply information, and further solving the technical problem of low accuracy of the generated reply information in the dialogue generation process of the prior art.

[0056] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0057] Method Embodiment

[0058] The present application provides an embodiment of a method for generating a dialogue integrating knowledge base question and answer and an intelligent agent. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device such as a set of computer executable instructions. In addition, although the logical order is shown in the flowchart, it is only an example order provided. In some cases, the steps shown or described can be executed in a different order from that shown here. In this embodiment, the computer device is a server as an example for explanation.

[0059] See also Figure 1 , which is a flowchart of a method for generating a dialogue integrating knowledge base question answering and intelligent agent provided in an embodiment of the present application, and the method comprises the following steps:

[0060] Step S101, obtaining description information of N tools and target questions raised by users.

[0061] In an optional embodiment, a system for generating dialogues integrating knowledge base question and answer and intelligent agent can be used as the execution subject of the method for generating dialogues integrating knowledge base question and answer and intelligent agent in the embodiment of the present application. For the convenience of description, the system for generating dialogues integrating knowledge base question and answer and intelligent agent is referred to as system hereinafter.

[0062] In step S101, N is an integer greater than 1; the N tools may include a knowledge base question and answer tool, a search engine API, a weather forecast API, a map service API, a calendar / planning tool, etc. Taking the knowledge base question and answer tool as an example, its corresponding knowledge base description information may be "this tool is a knowledge base question and answer tool, and when the target question raised is related to xxx knowledge, this tool is called."

[0063] In this embodiment, if Figure 2 As shown, by pre-encapsulating the dialogue function of the knowledge-based question-answering into a dialogue function function, and then defining the dialogue function function as a knowledge-based question-answering tool that can be called, and defining other tools called by the agent in addition to the knowledge-based question-answering tool; after the target question raised by the user, the system can directly obtain the description information of all tools including the knowledge-based question-answering tool (i.e., the description information of the N tools mentioned above), and provide data preparation for the subsequent screening of the target tool related to the target question raised by the user from the description information of the N tools, so as to provide a data basis for the large language model to determine whether to use the knowledge-based question-answering tool to generate relevant response information. Among them, the name of the knowledge-based question-answering tool can be defined as "knowledge_based_question_answering" or other English phrases that can reflect the function of the tool.

[0064] Optionally, the input parameters of the above dialogue function are as follows: Figure 2The target question raised by the user, historical dialogue information, knowledge base name, number of historical dialogue rounds, number of matching knowledge items, knowledge matching score threshold, etc. are shown in the figure. The output parameters are as follows: Figure 2 The matching knowledge list corresponding to the relevant information shown and the answer content of the large language model to the target question.

[0065] Step S102: M target tools are selected from N tools according to the target question and description information using a large language model.

[0066] In step S102 , M is an integer greater than or equal to 1, and M is less than N.

[0067] In order to ensure that the functions of the selected tools are more in line with the actual needs of the target problem, thereby improving the accuracy of the reply information generated during the dialogue with the user, in the embodiment of the present application, Figure 2 As shown in FIG, the system can use the large language model to filter out M target tools related to the target question from N tools based on the target question raised by the user and the description information of N tools. Figure 3 , Figure 3 A flowchart of a tool screening process provided in an embodiment of the present application, the process includes the following steps:

[0068] Step S1021: construct a first prompt word based on the target question and the description information.

[0069] In step S1021, the first prompt word is used to control the large language model to perform a tool screening operation, wherein the tool screening operation is used to screen out tools related to the target problem from N tools.

[0070] In this embodiment, the system can construct a first prompt word based on the target question raised by the user and the description information of N tools, so that the large language model can perform a tool screening operation of screening out tools related to the target question from the N tools based on the first prompt word. Exemplarily, the first prompt word can be as follows:

[0071]

[0072] Step S1022: input the first prompt word into the large language model, and the large language model selects M target tools from N tools based on the first prompt word.

[0073] Taking the target question raised by the user as "As of the end of 2022, how many types of mineral resources have been discovered in the country?" as an example, the system can use the large language model to filter out target tools related to the target question from the above N tools, including: knowledge base question and answer tools, search engine API, and web crawler tools.

[0074] Step S103: If there is a knowledge base question and answer tool among the M target tools, the knowledge base question and answer tool is used to retrieve relevant information of the target question from a preset knowledge base, and first reply information is generated according to the relevant information.

[0075] In this embodiment, the preset knowledge base may be a pre-set encyclopedia knowledge base, an industry-specific knowledge base, a legal and regulatory knowledge base, and the like.

[0076] In order to improve the accuracy of the generated reply information and avoid the problem of generating mixed reply information containing meaningless or irrelevant content, in this application, Figure 2 As shown, the system can determine whether to use the knowledge base question and answer tool to generate relevant reply information by judging whether there is a knowledge base question and answer tool among the M target tools. Specifically, if there is a knowledge base question and answer tool among the M target tools, the knowledge base question and answer tool is used to retrieve relevant information of the target question from the preset knowledge base, and generate the first reply information based on the relevant information. Taking the above-mentioned target question "As of the end of 2022, how many types of mineral resources have been discovered in the country?" as an example, the target tools screened out by the large language model include: knowledge base question and answer tools, search engine APIs, and web crawler tools. If there is a knowledge base question and answer tool, the system can use the knowledge base question and answer tool to retrieve relevant information of the target question from the preset knowledge base, and generate a first reply information based on the relevant information. Figure 4 The knowledge base matching results (i.e. relevant information) shown in the first reply information "As of the end of 2022, a total of 173 types of mineral resources have been discovered in the country. Among them, there are 13 types of energy minerals, 59 types of metal minerals, 95 types of non-metallic minerals, and 6 types of water and gas minerals."

[0077] It should be noted that when there is a knowledge base question and answer tool among the M target tools screened out by the large language model, the knowledge base question and answer tool is directly used to retrieve relevant information of the target question from the preset knowledge base, and the first reply information is generated based on the relevant information. There is no need to provide the relevant information to the intelligent agent, thereby avoiding the need to provide the relevant information, the target question and the description information of all tools to the intelligent agent after each question asked by the user, resulting in the generation of mixed reply information containing meaningless or irrelevant content, thereby improving the accuracy of the generated reply information (i.e., the first reply information).

[0078] Optionally, in order to further improve the accuracy of the generated reply information, in an embodiment of the present application, the system may obtain historical conversation information and target configuration parameters; wherein the target configuration parameters are used to control the retrieval operation of the knowledge base question and answer tool in a preset knowledge base; historical conversation information is conversation information related to the target question during the user conversation process; then the system may call the conversation function function in the knowledge base question and answer tool, and the conversation function function may retrieve relevant information from the preset knowledge base based on the target question and the target configuration parameters; finally, the system may generate the first reply information based on the relevant information, historical conversation information and the target question by the conversation function function.

[0079] In this embodiment, the target configuration parameters include but are not limited to the knowledge base name, the number of matching knowledge items, and the knowledge matching score threshold. The system can retrieve multiple relevant knowledge (i.e., relevant information) with a high degree of matching with the target problem from the preset knowledge base based on the target configuration parameters and the target problem by the dialogue function function; the historical dialogue information is the dialogue information related to the target problem filtered out from all dialogue information by the system through a preset number of historical dialogue rounds. The system can generate accurate first reply information based on the relevant information, historical dialogue information and the target problem by the dialogue function function.

[0080] Step S104: If there is no knowledge base question-answering tool among the M target tools, the intelligent agent analyzes and infers the description information and target questions of the M target tools to generate second reply information.

[0081] In order to further improve the accuracy of the generated reply information and avoid the problem of generating mixed reply information containing meaningless or irrelevant content, in this embodiment, when the system determines that there is no knowledge base question-answering tool among the M target tools screened by the large language model, the system uses the agent to analyze and reason about the description information and target questions of the M target tools to generate the second reply information. Figure 5 , Figure 5 A flowchart of a process for generating second reply information and third reply information provided in an embodiment of the present application, the process comprising the following steps:

[0082] Step S1041: construct a second prompt word according to the description information of the M target tools and the target question.

[0083] Step S1042: The intelligent agent decides whether to call the target tool to process the target problem based on the second prompt word, and obtains a decision result.

[0084] In this embodiment, the system constructs a second prompt word based on the description information of the M target tools and the target problem to decide whether to call the target tool to process the target problem, so as to determine whether to screen out K target processing tools that can actually process the target problem from the M target tools, wherein the second prompt word can be as follows:

[0085]

[0086] Step S1043, if the decision result is the first decision result, the intelligent agent selects K target processing tools from the M target tools according to the second prompt word, and uses the K target processing tools to process the target problem to generate second reply information.

[0087] In step S1043 , K is an integer greater than or equal to 1, and K is less than or equal to M.

[0088] In this embodiment, if the decision result is that the agent needs to call the target tool to handle the target problem raised by the user (i.e., the first decision result), the system can Figure 2 As shown, the agent selects K target processing tools from M target tools according to the second prompt word, and uses the K target processing tools to process the target question to generate the second reply information. For example, the M target tools include: weather forecast API and map service API. The system can select "weather forecast API" from the above tools as the actual tool for processing the target question "A area today's weather conditions" raised by the user, and then the system searches for the information of "A area today's weather conditions" by calling "weather forecast API" by the agent, and generates the second reply information containing the information:

[0089] "To provide you with today's weather conditions, I will refer to the most recently acquired information, but please note that since weather conditions may change, it is recommended that you also check the latest weather forecast for the most accurate information. Based on the information currently available to me, today's weather forecast for area A is: Weather: Cloudy; Humidity: 59%; Maximum temperature: 28.0 degrees Celsius; Minimum temperature: 19.0 degrees Celsius; Wind direction: Southeast wind; Wind force: Level 1."

[0090] Another example Figure 6 As shown in the figure, when the target question raised by the user is "What is the total number of energy minerals and water and gas minerals?", the agent can use the target processing tool named "calculator" to calculate "the total number of energy minerals and water and gas minerals", thereby generating a Figure 5 The second reply information includes the tool name, input parameters, processing results, and final reply content of the target processing tool shown in .

[0091] Optionally, in this embodiment, the system may periodically detect whether the intelligent agent has successfully processed the target problem; if the intelligent agent has successfully processed the target problem, a second reply message is generated based on the processing results of K target processing tools; if the intelligent agent has not successfully processed the target problem, the intelligent agent continues to process the target problem based on the target processing tool until the intelligent agent has successfully processed the target problem.

[0092] Step S1044: If the decision result is the second decision result, the intelligent agent directly analyzes and infers the target question to generate third response information.

[0093] In this embodiment, if the decision result is that the agent does not need to call the target tool to handle the target problem raised by the user (i.e., the second decision result), the agent directly analyzes and infers the target problem based on the relevant knowledge it has learned to generate the third reply information. For example, when the agent determines that there is no tool that can solve the target problem raised by the user, the agent can directly analyze and infer the target problem to generate the third reply information of "there is no suitable tool to solve your problem".

[0094] It should be noted that when there is a knowledge base question-and-answer tool among the M target tools screened out by the large language model, the intelligent agent can directly analyze and infer the description information and target questions of the M target tools to generate the second reply information without retrieving the relevant information of the target question from the preset knowledge base. This avoids the need to provide the intelligent agent with relevant information, target questions and description information of all tools after each question asked by the user, resulting in the generation of mixed reply information containing meaningless or irrelevant content, thereby improving the accuracy of the generated reply information.

[0095] In an optional embodiment, the knowledge base question-answering tool of the system in the present application supports multi-round dialogue. When the knowledge base question-answering tool is called in the large language model, the format of the message list (messages) parameter is as follows:

[0096] (1) There are only two message roles: user and assistant.

[0097] (2) The content of the user message is the target question raised by the user.

[0098] (3) The content of the assistant message is the answer of the large language model.

[0099] (4) The message list consists of user messages and assistant messages arranged alternately in sequence.

[0100] In another optional embodiment, the agent in the present application supports multi-round dialogues. When the agent requests a large language model service, the format of the message list parameter is as follows:

[0101] (1) The message roles include system, user and assistant.

[0102] (2) The content of the system message is the second prompt word constructed above.

[0103] (3) The content of the user message is the target question raised by the user.

[0104] (4) The content of the assistant message is a large language model reply message interspersed with tool call commands.

[0105] (5) The first message in the message list is the system message. Starting from the second message in the message list, the user messages and assistant messages are arranged alternately.

[0106] Based on the scheme introduced in the above steps S101 to S104, it can be known that in the present application, it is possible to implement the large language model to screen out M target tools related to the target problem from N tools based on the description information of the N tools obtained and the target question raised by the user, thereby ensuring that the functions of the selected tools are more in line with the actual needs of the target problem; and when there is a pre-set knowledge base question and answer tool among the M target tools, the knowledge base question and answer tool can be used to retrieve the relevant information of the target problem from the preset knowledge base, and generate the first reply information based on the relevant information, without providing the relevant information to the intelligent agent; if there is no pre-set knowledge base question and answer tool among the M target tools, the description information of the M target tools and the target question are directly analyzed and inferred by the intelligent agent to generate the second reply information, without retrieving the relevant information of the target problem from the preset knowledge base, avoiding the need to provide the relevant information, the target question and the description information of all tools to the intelligent agent after each question asked by the user, resulting in the generation of mixed reply information containing meaningless or irrelevant content, thereby improving the accuracy of the generated reply information, and further solving the technical problem of low accuracy of the generated reply information in the dialogue generation process of the prior art.

[0107] Device Embodiment

[0108] The embodiment of the present application provides a dialogue generation device integrating knowledge base question and answer and intelligent agent, wherein: Figure 7 A schematic diagram of a structure of a device for generating a dialogue integrating knowledge base question answering and intelligent agent provided in an embodiment of the present application, such as Figure 7 As shown, the device includes: an acquisition module 11, a screening module 12, a first generation module 13 and a second generation module 14. Figure 7 You can see the connection relationship between several modules.

[0109] The acquisition module is used to obtain description information of N tools and target questions raised by users; N is an integer greater than 1;

[0110] A screening module, used to screen M target tools from N tools according to the target question and description information through a large language model; M is an integer greater than or equal to 1, and M is less than N;

[0111] A first generating module is used for, if there is a knowledge base question and answer tool among the M target tools, using the knowledge base question and answer tool to retrieve relevant information of the target question from a preset knowledge base, and generating first reply information according to the relevant information;

[0112] The second generation module is used to generate second reply information by analyzing and reasoning the description information and target questions of the M target tools through an intelligent agent if there is no knowledge base question-answering tool among the M target tools.

[0113] Optionally, Figure 8 A structural diagram of a screening module provided in an embodiment of the present application is shown in FIG. Figure 8 As shown in FIG. 1 , the module includes: a prompt word construction unit 21 and a screening unit 22. Figure 8 You can see the connection relationship between several modules.

[0114] A prompt word construction unit 21 is used to construct a first prompt word based on the target question and the description information; the first prompt word is used to control the large language model to perform a tool screening operation, and the tool screening operation is used to screen out tools related to the target question from N tools;

[0115] The screening unit 22 is used to input the first prompt word into the large language model, and the large language model screens out M target tools from the N tools based on the first prompt word.

[0116] Optionally, Fig. 9 The first generation module is a schematic diagram of the structure of a first generation module provided in an embodiment of the present application. The first generation module includes: an acquisition unit 31, an information retrieval unit 32 and a first generation unit 33. Fig. 9 You can see the connection relationship between several modules.

[0117] The acquisition unit 31 is used to acquire historical conversation information and target configuration parameters; the target configuration parameters are used to control the search operation of the knowledge base question answering tool in the preset knowledge base; the historical conversation information is the conversation information related to the target question during the user conversation;

[0118] An information retrieval unit 32 is used to call a dialogue function in the knowledge base question-answering tool, and the dialogue function retrieves relevant information from a preset knowledge base based on a target question and target configuration parameters;

[0119] The first generating unit 33 is used to generate first reply information based on relevant information, historical dialogue information and target question by the dialogue function.

[0120] Optionally, the second generating module includes: a building unit, a decision unit and a second generating unit.

[0121] The construction unit is used to construct the second prompt word according to the description information of the M target tools and the target problem;

[0122] A decision-making unit, used for the agent to decide whether to call a target tool to process a target problem according to the second prompt word, and obtain a decision result;

[0123] The second generation unit is used for, if the decision result is the first decision result, the intelligent agent selects K target processing tools from M target tools according to the second prompt word, and uses the K target processing tools to process the target problem to generate second reply information; K is an integer greater than or equal to 1, and K is less than or equal to M.

[0124] Optionally, the dialogue generation device also includes: a third generation unit, which is used to directly analyze and reason on the target question by the intelligent agent to generate third reply information if the decision result is the second decision result.

[0125] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0126] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for generating dialogues integrating knowledge base question answering and intelligent agents, characterized in that: include: Obtain description information of N tools and target questions raised by users; N is an integer greater than 1; Screening out M target tools from the N tools according to the target problem and the description information by using a large language model; M is an integer greater than or equal to 1, and M is less than N; If there is a knowledge base question and answer tool among the M target tools, then using the knowledge base question and answer tool to retrieve relevant information of the target question from a preset knowledge base, and generating first reply information according to the relevant information; If the knowledge base question-and-answer tool does not exist in the M target tools, the intelligent agent analyzes and infers the description information of the M target tools and the target question to generate second reply information.

2. The method according to claim 1, characterized in that The selecting M target tools from the N tools according to the target question and the description information by using the large language model includes: Constructing a first prompt word based on the target question and the description information; the first prompt word is used to control the large language model to perform a tool screening operation, and the tool screening operation is used to screen out tools related to the target question from the N tools; The first prompt word is input into the large language model, and the large language model selects the M target tools from the N tools based on the first prompt word.

3. The method according to claim 1, characterized in that The step of using the knowledge base question-answering tool to retrieve relevant information of the target question from a preset knowledge base, and generating first answer information based on the relevant information, includes: Acquire historical conversation information and target configuration parameters; the target configuration parameters are used to control the search operation of the knowledge base question-answering tool in the preset knowledge base; the historical conversation information is the conversation information related to the target question during the user conversation; Calling a dialogue function in the knowledge base question-answering tool, and having the dialogue function retrieve the relevant information from the preset knowledge base based on the target question and the target configuration parameters; The first reply information is generated by the dialogue function based on the relevant information, the historical dialogue information and the target question.

4. The method according to claim 1, characterized in that: If the knowledge base question-answering tool does not exist in the M target tools, the intelligent agent analyzes and infers the description information of the M target tools and the target question to generate second reply information, including: Constructing a second prompt word according to the description information of the M target tools and the target question; The intelligent agent decides whether to call the target tool to process the target problem according to the second prompt word, and obtains a decision result; If the decision result is the first decision result, the intelligent agent selects K target processing tools from the M target tools based on the second prompt word, and uses the K target processing tools to process the target problem to generate the second reply information; K is an integer greater than or equal to 1, and K is less than or equal to M.

5. The method according to claim 4, characterized in that If the decision result is the second decision result, the method further includes: The intelligent agent directly analyzes and infers the target question to generate third response information.

6. A dialogue generation device integrating knowledge base question answering and intelligent agent, characterized in that: include: The acquisition module is used to obtain the description information of N tools and the target questions raised by the user; N is an integer greater than 1; A screening module, used to screen M target tools from the N tools according to the target problem and the description information through a large language model; M is an integer greater than or equal to 1, and M is less than N; A first generating module is used for, if there is a knowledge base question and answer tool among the M target tools, using the knowledge base question and answer tool to retrieve relevant information of the target question from a preset knowledge base, and generating first reply information according to the relevant information; The second generation module is used to generate second reply information by analyzing and reasoning the description information of the M target tools and the target question through an intelligent agent if the knowledge base question-answering tool does not exist in the M target tools.

7. The device according to claim 6, characterized in that The screening module comprises: a prompt word construction unit, configured to construct a first prompt word based on the target question and the description information; the first prompt word is used to control the large language model to perform a tool screening operation, wherein the tool screening operation is used to screen out tools related to the target question from the N tools; A screening unit is used to input the first prompt word into the large language model, and the large language model screens out the M target tools from the N tools based on the first prompt word.

8. The device according to claim 6, characterized in that The first generation module comprises: an acquisition unit, configured to acquire historical conversation information and target configuration parameters; the target configuration parameters are used to control the search operation of the knowledge base question-answering tool in the preset knowledge base; the historical conversation information is conversation information related to the target question during the user conversation; An information retrieval unit, configured to call a dialogue function in the knowledge base question-answering tool, and have the dialogue function retrieve the relevant information from the preset knowledge base based on the target question and the target configuration parameters; The first generating unit is configured to generate the first reply information based on the relevant information, the historical dialogue information and the target question by the dialogue function.

9. The device according to claim 6, characterized in that The second generation module comprises: A construction unit, configured to construct a second prompt word according to the description information of the M target tools and the target question; A decision-making unit, configured to allow the agent to decide whether to call the target tool to process the target problem according to the second prompt word, and obtain a decision result; The second generating unit is used for, if the decision result is the first decision result, the intelligent agent selects K target processing tools from the M target tools according to the second prompt word, and uses the K target processing tools to process the target problem to generate the second reply information; K is an integer greater than or equal to 1, and K is less than or equal to M.

10. The device according to claim 9, characterized in that The device also includes: The third generation unit is used for the intelligent agent to directly analyze and reason about the target question to generate third response information.

Citation Information

Cited By

  • Intelligent agent-based information processing method and device and storage medium

    CN121031788A

  • Meteorology-based online question and answer service agent construction method and device

    CN121352036A