Slot information supplement method, device and equipment based on multi-agent interaction
Through multi-agent interaction to identify and supplement slot information, the problem of insufficient information in large language models in multiple rounds of dialogue is solved, and the integrity and accuracy of dialogue information are improved.
Patent Information
- Application Number
- CN202410823949.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-25
AI Technical Summary
Existing large language models cannot effectively guide users to supplement important dialogue information in multiple rounds of dialogue, especially when knowledge and tasks beyond the capabilities of the model are involved, leading to the problem of insufficient information.
The slot information supplement method based on multi-agent interaction is adopted. The target intention and slot list are determined through the intention recognition agent. Combined with the node judgment process table, the slots to be supplemented are identified and prompt information is output to guide the user to supplement the information.
It effectively solves the problem of users' insufficient information supplement in multiple rounds of dialogue, improves the integrity and accuracy of dialogue information, and enhances the interactive ability of multi-agent collaboration.
Smart Images

Figure CN118378658B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a slot information supplement method, device and equipment based on multi-agent interaction. Background Art
[0002] With the emergence of Large Language Models (LLM), agent systems built around LLM have received widespread attention recently. Agent systems aim to utilize the inductive reasoning capabilities of LLM to complete complex tasks by assigning roles and task information to different agents and equipping them with corresponding tool plug-ins. Currently, the more common frameworks mostly focus on single-agent scenarios. The core of single-agent is the coordination between LLM and tools. LLM understands the user's task, infers the tools that need to be called, and gives feedback to the user based on the call results.
[0003] With the continuous development of artificial intelligence technology, multi-turn dialogue systems are becoming more and more important in various application scenarios. Traditional multi-turn dialogue systems usually require a large number of manual rules and the participation of domain experts, making it difficult to expand to different fields and tasks. However, in practice, multi-turn dialogues usually involve knowledge and tasks beyond the capabilities of the model itself, such as key information tracing, which poses a challenge to the application of the model. For example, due to the lack of professionalism of users, many questions in the dialogue process may lack necessary relevant information, and the existing large language model cannot guide users to effectively supplement important dialogue information. Summary of the invention
[0004] In view of this, the present invention provides a slot information supplement method, device and equipment based on multi-agent interaction to solve the problem of being unable to guide users to effectively supplement important dialogue information.
[0005] In a first aspect, the present invention provides a slot information supplement method based on multi-agent interaction, the method comprising:
[0006] Obtaining current conversation information of the target user, and determining the target intent of the current conversation information and the intent type of the target intent through an intent recognition agent;
[0007] When the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, the target intent is determined as the initial intent, and the slot recognition agent determines a slot list corresponding to the initial intent according to a preset slot information table, and determines slot information corresponding to each slot in the slot list based on the current dialogue information;
[0008] Obtaining a node judgment flow table of the initial intention, and determining a slot to be supplemented corresponding to the current conversation information according to the node judgment flow table and the slot information corresponding to each slot in the slot list, wherein the node judgment flow table includes: a slot judgment order corresponding to the initial intention and a judgment rule for each slot;
[0009] The prompting agent outputs prompt information corresponding to the slot to be supplemented, so as to obtain dialogue information of the target user for supplementing the slot to be supplemented.
[0010] The target intent and intent type of the target user's current dialogue information are identified through the intention recognition agent, so as to determine the slot list corresponding to the target intent, and then the slot information corresponding to each slot in the slot list in the current dialogue information is determined through the slot recognition agent, and the slots to be supplemented in the current dialogue information are determined according to the node judgment flow table corresponding to the target intent, and the corresponding prompt information is output to guide the user to supplement and complete the dialogue information. Through the interactive collaboration between multiple agents, the problem of being unable to guide users to effectively supplement important dialogue information is effectively solved.
[0011] In an optional embodiment, the method further includes:
[0012] When the intent type of the target intent corresponding to the current dialogue information is a slot supplement intent, the slot list corresponding to the initial intent is filled according to the current dialogue information, and the slot information of each slot in the currently filled slot list is determined by the slot recognition agent;
[0013] The step of determining the slot to be supplemented corresponding to the current dialogue information is performed according to the slot information corresponding to each slot in the node judgment process table and the slot list.
[0014] By filling the conversation information with the intent type of slot filling intention into the slot list corresponding to the initial intent, and determining the current slot to be filled according to the slot information in each filled slot, it is possible to judge the slot information of each slot after filling, further determine the current slot to be filled, and improve the conversation information.
[0015] In an optional embodiment, the method further includes:
[0016] When the intent type of the target intent corresponding to the current dialogue information is a no-slot intent, outputting a reply result of the current dialogue information through the question-answering agent;
[0017] The question-answering agent is constructed as follows:
[0018] A question-answering training data set is constructed based on vertical field question-answering data, a model of a first preset language model is trained based on the question-answering training data set, model parameters are adjusted during the training process to obtain a first language model, and a question-answering intelligent agent is constructed based on the trained first language model.
[0019] By using the question-and-answer agent to promptly reply to conversation messages with the intent type of no-slot intent, user messages that do not require slot judgment can be processed in a timely manner to ensure the timeliness of responses. At the same time, targeted training using vertical field question-and-answer data can further ensure the accuracy of responses.
[0020] In an optional implementation manner, determining the slot to be supplemented corresponding to the current dialogue information according to the slot information corresponding to each slot in the node judgment process table and the slot list includes:
[0021] Determine the target slot in the slot list according to the judgment order in the node judgment flow table;
[0022] Determine whether the target slot is empty, and if so, determine the target slot as a slot to be replenished, and execute the step of outputting prompt information corresponding to the slot to be replenished by the prompting agent;
[0023] If it is not empty, judging whether the slot information corresponding to the target slot meets the preset requirements according to the judgment rule corresponding to the target slot;
[0024] When the slot information corresponding to the target slot meets the preset requirement, determining whether the target slot is the last slot in the determination sequence;
[0025] If not, updating the target slot according to the determination sequence, and executing the step of determining whether the target slot is empty;
[0026] If yes, determine the reply result corresponding to the initial intention according to the slot information corresponding to each current slot.
[0027] By determining whether the slot information corresponding to each slot meets the requirements through the judgment order in the node judgment process table and the judgment rules corresponding to each slot, and changing the target slot for a new judgment based on the judgment result, the slot information that needs to be supplemented in the current slot list can be more accurately judged to ensure the accuracy of subsequent prompt information and improve the effectiveness of subsequent target user supplementary information.
[0028] In an optional implementation, the intention recognition agent is constructed as follows:
[0029] Determine a first prompt template corresponding to the intention recognition agent, wherein the first prompt template includes: an intention recognition task description module, a limited intention list module, a user input module and an intention output module;
[0030] Acquire conversation sample data, determine the intent label corresponding to the conversation sample data, fill the user input module and the intent output module of the first prompt template based on the conversation sample data and the corresponding intent label, and construct an intent recognition training data set;
[0031] Training a second language model to be trained based on the intention recognition training data set to obtain a second language model, and constructing an intention recognition agent according to the trained second language model;
[0032] The slot recognition agent is constructed as follows:
[0033] Determine a second prompt template corresponding to the slot recognition agent, the second prompt template comprising: a slot recognition task description module, an information input module and an information output module, the slot recognition task description module comprising: a description of each slot in a slot list corresponding to each intention;
[0034] Acquire dialogue sample data, determine slot information annotations corresponding to the dialogue sample data, fill in the information input module and the information output module of the second prompt template based on the dialogue sample data and the corresponding slot information annotations, and construct a slot recognition training data set;
[0035] A third preset language model is trained based on the slot recognition training data set to obtain a third language model, and an intent recognition agent is constructed according to the trained third language model.
[0036] By filling the prompt template with sample data and corresponding annotation information, we can construct targeted intent recognition training data sets and slot recognition training data sets, and then train the preset language model. This can ensure that the intent recognition agent and slot recognition agent constructed based on the language model have good recognition effects when performing intent recognition and slot recognition.
[0037] In an optional implementation, judging whether the slot information corresponding to the target slot meets a preset requirement according to a judgment rule corresponding to the target slot includes:
[0038] Determine a global variable table corresponding to the target slot, and determine whether the slot information corresponding to the target slot meets a preset requirement based on whether the slot information corresponding to the target slot is located in the global variable table.
[0039] By comparing the slot information of the target slot with the global variable table, it is possible to accurately determine whether the slot information of the target slot meets the requirements, thereby ensuring the accuracy of slot judgment.
[0040] In an optional implementation, the outputting of prompt information corresponding to the slot to be replenished by the prompting agent includes:
[0041] Calling a seed speech table, wherein the seed speech table includes: seed speech corresponding to different slots;
[0042] The prompt agent determines the target seed speech corresponding to the slot to be supplemented according to the seed speech table, and generates corresponding prompt information based on the target seed speech.
[0043] By determining the target seed words in the seed words table and the corresponding slots to be supplemented, the prompt agent can output more accurate prompt information to ensure the effectiveness and readability of the prompt information.
[0044] In a second aspect, the present invention provides a slot information supplement device based on multi-agent interaction, the device comprising:
[0045] An intention recognition module is used to obtain the current conversation information of the target user and determine the target intention of the current conversation information and the intention type of the target intention through an intention recognition agent;
[0046] A slot recognition module, configured to determine the target intent as an initial intent when the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, and the slot recognition agent determines a slot list corresponding to the initial intent according to a preset slot information table, and determines slot information corresponding to each slot in the slot list based on the current dialogue information;
[0047] A slot judgment module is used to obtain a node judgment flow table of the initial intention, and determine the slot to be supplemented corresponding to the current dialogue information according to the node judgment flow table and the slot information corresponding to each slot in the slot list, wherein the node judgment flow table includes: a slot judgment order corresponding to the initial intention and a judgment rule for each slot;
[0048] The information prompt module is used to output the prompt information corresponding to the slot to be supplemented through the prompting agent, so as to obtain the dialogue information used by the target user to supplement the slot to be supplemented.
[0049] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the slot information supplementation method based on multi-agent interaction of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the slot information supplementation method based on multi-agent interaction of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 is a flowchart of a slot information supplement method based on multi-agent interaction according to an embodiment of the present invention;
[0053] Figure 2 is a flowchart of another slot information supplement method based on multi-agent interaction according to an embodiment of the present invention;
[0054] Figure 3 is an example diagram of an intelligent agent model construction architecture according to an embodiment of the present invention;
[0055] Figure 4 is an example diagram of the execution flow of a slot information supplement system based on multi-agent interaction according to an embodiment of the present invention;
[0056] Figure 5 is a structural block diagram of a slot information supplement device based on multi-agent interaction according to an embodiment of the present invention;
[0057] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0059] With the emergence of Large Language Models (LLM), agent systems built around LLM have received widespread attention recently. Agent systems aim to utilize the inductive reasoning capabilities of LLM to complete complex tasks by assigning roles and task information to different agents and equipping them with corresponding tool plug-ins. Currently, the more common frameworks mostly focus on single-agent scenarios. The core of single-agent is the coordination between LLM and tools. LLM understands the user's task, infers the tools that need to be called, and gives feedback to the user based on the call results.
[0060] With the continuous development of artificial intelligence technology, multi-turn dialogue systems are becoming more and more important in various application scenarios. Traditional multi-turn dialogue systems usually require a large number of manual rules and the participation of domain experts, making it difficult to expand to different fields and tasks. However, in practice, multi-turn dialogues usually involve knowledge and tasks beyond the capabilities of the model itself, such as key information tracing, which poses a challenge to the application of the model. For example, due to the lack of professionalism of users, many questions in the dialogue process may lack necessary relevant information, and the existing large language model cannot guide users to effectively supplement important dialogue information.
[0061] To this end, an embodiment of the present invention provides a slot information supplement method based on multi-agent interaction, which identifies the target intent and intent type of the target user's current dialogue information through an intent recognition agent, thereby determining a slot list corresponding to the target intent, and then determining the slot information corresponding to each slot in the slot list in the current dialogue information through the slot recognition agent, and determining the slot to be supplemented in the current dialogue information according to the node judgment flow table corresponding to the target intent, and outputting corresponding prompt information to guide the user to supplement and complete the dialogue information. Through the interactive collaboration between multiple agents, the problem of being unable to guide the user to effectively supplement important dialogue information is effectively solved.
[0062] According to an embodiment of the present invention, an embodiment of a slot information supplement method based on multi-agent interaction is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0063] In this embodiment, a slot information supplement method based on multi-agent interaction is provided, which can be used for the above-mentioned slot information supplement. Figure 1 is a flow chart of a slot information supplement method based on multi-agent interaction according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0064] Step S101, obtain the current dialogue information of the target user, and determine the target intent of the current dialogue information and the intent type of the target intent through an intent recognition agent.
[0065] It can be understood that with the development of natural language recognition models, in many scenarios, intelligent customer service can be generated by agents built based on natural language models to respond to user questions. In some cases, the user's current dialogue information may lack necessary elements, resulting in an inability to answer the questions in the dialogue information. In this case, guidance can be provided based on the user's intention to enable the user to supplement relevant information.
[0066] After the intelligent customer service receives the user's conversation information, it can determine the target intent of the conversation information through the intent recognition agent. The intent contained in different conversation information is also different, and different intents correspond to different intent types. For example, some conversation intents do not carry slot information, and do not need to call other tools. You can directly perform semantic recognition on the conversation and respond; while some conversation intents need to call other tools. At this time, it is necessary to determine whether the amount of information in the conversation is sufficient, that is, whether the slot information corresponding to each slot meets the requirements.
[0067] This can be understood through an illustrative example. Taking the banking field as an example, assuming that the user's dialogue information is "the process of applying for a credit card", there is no need to call other tools to reply to the dialogue. The target intent of the dialogue information is process query, and there is no need to identify the slots for it. It can be answered directly according to the trained answer model; assuming that the user's dialogue information is "What is the current exchange rate of the US dollar?" Such a dialogue requires calling the exchange rate tool to determine the specific reply, that is, the target intent corresponding to the dialogue is to query the exchange rate, and its intent type is a slot intent, that is, it is necessary to identify whether the slot information meets the requirements. This requires determining whether the slot information in the current dialogue information is complete, for example, whether it contains the original exchange currency and the currency to be exchanged.
[0068] The target intent corresponding to the target user's conversation information and the intent type corresponding to the target intent can be determined through the intent recognition agent, so that a corresponding reply can be made according to the intent type of the conversation information in the subsequent processing.
[0069] Step S102, when the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, the target intent is determined as the initial intent, the slot recognition agent determines the slot list corresponding to the initial intent according to the preset slot information table, and determines the slot information corresponding to each slot in the slot list based on the current dialogue information.
[0070] It can be understood that when the intention recognition agent recognizes that the intention type of the target intention corresponding to the dialogue information initiated by the target user is an intention with slots, the target intention can be determined as the initial intention. For example, when the dialogue information initiated by the user is "What is the current exchange rate of the US dollar?", its target intention is "Query exchange rate", and the intention type of this intention is an intention with slots, that is, for the dialogue information corresponding to the intention, it is necessary to judge whether the information corresponding to each slot in the dialogue information meets the requirements. Taking "Query exchange rate" as an example, its corresponding slots include "source currency" and "target currency", "source currency" means which currency needs to be exchanged, and "target currency" means which currencies need to be exchanged. In the dialogue information, the "source currency" is the US dollar, but there is no slot information corresponding to the slot of the "target currency", that is, the user did not say which currency he wants to exchange. Since the intention type of the target intention "Query exchange rate" corresponding to the dialogue information currently sent by the target user is an intention with slots, the target intention can be defined as the initial intention, so that if the slot information needs to be filled in later, it can be filled on the basis of the initial intention.
[0071] After determining the initial intent, the slot recognition agent can be used to determine the slot list corresponding to the initial intent. Specifically, the slot list corresponding to the initial intent can be found in the preset slot information table. Taking the above-mentioned dialogue information as an example, when the dialogue information sent by the user is "What is the current exchange rate of the US dollar?", the target intention is "query the exchange rate", and "query the exchange rate" is used as the initial intention. In the preset slot information table, the slot lists corresponding to various intentions can be pre-stored according to the actual dialogue scenario. Taking banking business as an example, the preset slot information table can include slot lists corresponding to various intents related to banking business. For example, the slot information table for personal foreign exchange business is shown in Table 1:
[0072] Table 1
[0073]
[0074] In the above table, the slot list corresponding to the initial intent "query exchange rate" is "source currency" and "target currency". After determining the slot list corresponding to the initial intent, the slot recognition agent can determine the slot information corresponding to each slot in the dialogue information according to the specific dialogue information. For example, in the dialogue information of "What is the exchange rate of the US dollar today", the slot information corresponding to the "source currency" is "US dollar", and the information corresponding to the "target currency" is "none", that is, there is no slot information corresponding to the "target currency" in the current dialogue information.
[0075] Step S103, obtain the node judgment process table of the initial intention, and determine the slot to be supplemented corresponding to the current dialogue information according to the slot information corresponding to each slot in the node judgment process table and the slot list. The node judgment process table includes: the slot judgment order corresponding to the initial intention and the judgment rules for each slot.
[0076] It can be understood that after identifying the slot information corresponding to each slot in the current conversation information, the slot information corresponding to each slot is judged and processed according to the node judgment process table corresponding to the initial intention, so as to determine which slots need to be supplemented and whether the slot information meets the requirements. The node process judgment table can determine the specific node process judgment table according to the business operation process corresponding to the user's various consulting intentions and the slot list corresponding to various intentions, and the node process judgment table includes: the judgment order and judgment rules of each slot.
[0077] In one example, a process modeling agent can be constructed to extract specific business handling knowledge and obtain business operation processes corresponding to different intentions. At the same time, the process modeling agent can combine the slot lists corresponding to each intent to obtain the node judgment process table corresponding to each intent, and store these node judgment process tables.
[0078] When it is necessary to judge the slot information of each slot in the current conversation information of the target user, the node judgment process table corresponding to the intention of the current conversation information stored in the above-mentioned process modeling agent can be called, so as to judge the slot information of each slot based on the judgment order and judgment rules in the node judgment process table. In one example, the slot judgment process agent can be trained according to the judgment process corresponding to the above-mentioned different intentions, so that it can judge whether the slot information meets the requirements based on the slot information recognized by the slot recognition agent and the node judgment process table in the process modeling agent, thereby obtaining the slots to be supplemented that need to be supplemented.
[0079] Step S104, the prompting agent outputs prompt information corresponding to the slot to be supplemented, so as to obtain the dialogue information of the target user for supplementing the slot to be supplemented.
[0080] After determining the slot to be supplemented corresponding to the current dialogue information, the prompting agent can output corresponding prompting information according to the specific slot to be supplemented, thereby prompting the user to supplement the slot information corresponding to the slot to be supplemented. For example, when the slot to be supplemented corresponding to the user's current dialogue information is "target currency", the prompting agent can output "Please enter the currency you want to exchange" or "Please enter the currency you want to exchange US dollars for?", and through such similar prompting information, the user is prompted to enter new dialogue information to supplement the slot information corresponding to the slot to be supplemented.
[0081] The slot information supplement method based on multi-agent interaction provided in this embodiment identifies the target intent and intent type of the target user's current dialogue information through an intent recognition agent, thereby determining a slot list corresponding to the target intent, and then determining the slot information corresponding to each slot in the slot list in the current dialogue information through the slot recognition agent, and determining the slots to be supplemented in the current dialogue information according to the node judgment flow table corresponding to the target intent, and outputting corresponding prompt information to guide the user to supplement and complete the dialogue information. Through the interactive collaboration between multiple agents, the problem of being unable to guide the user to effectively supplement important dialogue information is effectively solved.
[0082] According to an embodiment of the present invention, another slot information supplement method embodiment based on multi-agent interaction is provided, which can be used for the above-mentioned slot information supplement. Figure 2 is a flowchart of another slot information supplement method based on multi-agent interaction according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0083] Step S201, obtain the current dialogue information of the target user, and determine the target intent and the intent type of the target intent of the current dialogue information through an intent recognition agent.
[0084] Specifically, in step S201, the intention recognition agent is constructed as follows:
[0085] Determine a first prompt template corresponding to the intention recognition agent, the first prompt template comprising: an intention recognition task description module, a limited intention list module, a user input module and an intention output module;
[0086] Acquire conversation sample data, determine the intent label corresponding to the conversation sample data, fill in the user input module and the intent output module of the first prompt template based on the conversation sample data and the corresponding intent label, and construct an intent recognition training data set;
[0087] The second language model to be trained is trained based on the intention recognition training data set to obtain a second language model, and an intention recognition intelligent agent is constructed according to the trained second language model.
[0088] It can be understood that before constructing an intent recognition agent for identifying user intentions, it is necessary to first train the preset language model so that the trained language model has a certain ability to recognize dialogue intentions, and then construct the intent recognition agent through the trained language model to ensure that the constructed intent recognition agent has the trained ability to recognize dialogue intentions.
[0089] In order to ensure the training effect of the model, before training the language model, it is necessary to prepare targeted training data. Therefore, the corresponding prompt template can be determined according to the actual application scenario of the intention recognition agent, that is, the first prompt template mentioned above, and the collected sample conversations are marked with the corresponding intent type labels, and then the sample conversations and the corresponding labels are filled into the corresponding modules in the prompt template, so as to obtain targeted training data.
[0090] The prompt template corresponding to the intent recognition agent includes an intent recognition task description module, a limited intent list module, a user input module, and an intent output module. The main content of the intent recognition task description module is the work goal of the intent recognition agent; the limited intent list module stores the intentions that users may be involved in actual application scenarios; the user input module is used to store the collected sample conversations; and the intent output module is used to store the labels for the sample conversations. For ease of understanding, the prompt template corresponding to the intent recognition agent can be as follows:
[0091] Task description: Classify the intent of [user input] and classify it into one of the [limited intent list].
[0092] Limited intent list: {buy currency, check exchange rate, fill slot, other intents}
[0093] User input: {userinput}
[0094] Output: {Output}, outputs the user's intention based on the user's specific input content.
[0095] The collected sample conversations and corresponding labels are respectively filled into the user input module and the output module, and a training data set is constructed. For example, the sample conversation is "What is the exchange rate between the US dollar and the RMB today?" The intention label corresponding to the conversation is determined to be "query exchange rate" through manual labeling. The sample conversation is filled into the user input module, and the sample label is filled into the intention output module. By processing a large amount of collected sample conversation data in this way, an intention recognition training data set can be obtained. The preset language model is trained with the intention recognition training data set. The preset language model can be an existing language intention recognition model. During the training process, the model parameters are adjusted through targeted business data so that the trained language model can better recognize the conversation intentions in certain specific fields.
[0096] Step S202, when the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, the target intent is determined as the initial intent, and the slot recognition agent determines the slot list corresponding to the initial intent according to the preset slot information table, and determines the slot information corresponding to each slot in the slot list based on the current dialogue information.
[0097] Specifically, in step S202, the slot recognition agent is constructed as follows:
[0098] Determine a second prompt template corresponding to the slot recognition agent, the second prompt template comprising: a slot recognition task description module, an information input module and an information output module, the slot recognition task description module comprising: a description of each slot in the slot list corresponding to each intention;
[0099] Acquire the dialogue sample data, determine the slot information annotation corresponding to the dialogue sample data, fill the information input module and the information output module of the second prompt template based on the dialogue sample data and the corresponding slot information annotation, and construct a slot recognition training data set;
[0100] The third preset language model is trained based on the slot recognition training data set to obtain a third language model, and an intent recognition intelligent agent is constructed according to the trained third language model.
[0101] The specific construction method can refer to the construction method of the intention recognition agent in the above step S201. The collected sample data are all labeled. However, when labeling the sample data corresponding to the slot recognition agent, it is necessary to label the slot type and corresponding slot information of each slot in the sample data, and fill the sample data and the corresponding labeling information into the prompt template corresponding to the slot recognition agent to obtain targeted training data.
[0102] The prompt template corresponding to the slot recognition agent may include: a slot recognition task description module, an information input module, and an information output module, wherein the slot recognition task description module may include: the description of each slot in the slot list corresponding to the work goal of the slot recognition agent and each intention; the information input module is used to store sample data; the information output module is used to store the annotations corresponding to the sample data. For example, the prompt template corresponding to the slot recognition agent may be as follows:
[0103] Task description: You are a parameter extractor. Given a piece of text Text, please extract the corresponding parameter content in the text Text and return it according to the given parameter list Param.
[0104] Param (type, description):{}Few Shot:{}
[0105] Input:Text:{}
[0106] Output: Parameter content corresponding to the user input text, for example: {\"source currency\": \"US dollar\" , \"target currency\": \"RMB\"}
[0107] After the prompt template is filled with a sample dialogue data intended to query the exchange rate, the format of the prompt template filled with the sample dialogue and the corresponding tags is as follows:
[0108] {"instruction": "\nYou are a parameter extractor. Provide a text Text. Please extract the corresponding parameter content in the text Text according to the given parameter list Param and return it.\nParam (type, description):\n\t(1)\"Source Currency\": the original currency\n\t(2)\"Target Currency\": the currency to be exchanged\nFew Shot:\nText:\nI want to know how many euros can be exchanged for 100 US dollars?\nOutput:\n {\"Source Currency\":\"US Dollar\", \"Target Currency\":\"Euro\"}\n\nText:\nWhat is the US dollar exchange rate?\nOutput:\n {\"Source Currency\":\"US Dollar\", \"Target Currency\":\"None\"}\n
[0109] "input": "What is the exchange rate between USD and RMB today?"
[0110] "output": "{\"Source currency\": \"USD\" , \"Target currency\": \"RMB\"}"
[0111] }
[0112] The content corresponding to Few Shot in the above template is an inserted small sample example, which can improve the learning effect of the language model. Specifically, after the sample data is filled into the prompt template to obtain the training data, the training data can be saved in json format.
[0113] By filling the prompt template with sample data and corresponding annotation information, we can construct targeted intent recognition training data sets and slot recognition training data sets, and then train the preset language model. This can ensure that the intent recognition agent and slot recognition agent constructed based on the language model have good recognition effects when performing intent recognition and slot recognition.
[0114] Step S203, when the intent type of the target intent corresponding to the current dialogue information is a slot supplement intent, fill the slot list corresponding to the initial intent according to the current dialogue information, and determine the slot information of each slot in the currently filled slot list through the slot recognition agent;
[0115] The step of determining the slot to be supplemented corresponding to the current dialog information by executing the slot information corresponding to each slot in the node judgment process table and the slot list.
[0116] The supplementary slot intention of the intent type of the target intent of the current dialogue information input by the user can be understood as the intention of the current dialogue information input by the user is to supplement the dialogue information input previously.
[0117] For example, the dialogue information previously entered by the user is "What is the exchange rate of the US dollar?" Due to the system processing between multiple agents, the processing method of this part can refer to Figure 1 The implementation process of the illustrated embodiment determines that there is a slot to be replenished in the current dialogue information, that is, the information corresponding to the slot of "target currency" is missing, so the user is prompted to enter the slot information corresponding to the slot to be replenished, that is, what the target currency is, to guide the user to enter the slot information corresponding to the slot to be replenished.
[0118] For example, when the dialogue information currently input by the user is "RMB", since it is a single noun, the intent recognition agent can recognize it as an information supplement intention, and the type of this intent is the slot supplement intention. At this time, the current dialogue information is filled into the slot to be supplemented in the slot list corresponding to the initial intention "query exchange rate", that is, the "target currency" slot. It can be understood that the current dialogue information and the previous dialogue information are spliced so that the slot information corresponding to each slot in the slot list is completed. After the slots are supplemented, the slot information of each slot in the current slot list is obtained through the slot recognition agent, and then the slot information corresponding to each slot in the slot list is executed according to the node judgment process table and the slot information, and the step of determining the slot to be supplemented corresponding to the current dialogue information is executed. The specific content of this step can be referred to. Figure 1 The specific content of step S103 in the illustrated embodiment will not be repeated here.
[0119] Step S204, when the intent type of the target intent corresponding to the current dialogue information is a no-slot intent, the answer result of the current dialogue information is output through the question-and-answer agent.
[0120] It can be understood that when some conversations initiated by users are relatively direct questions or some casual chat content, the question-and-answer agent can be used to respond to the user's conversation questions.
[0121] Specifically, in step S204, the question-answering agent is constructed as follows:
[0122] A question-answering training dataset is constructed based on vertical field question-answering data, a model of a first preset language model is trained based on the question-answering training dataset, model parameters are adjusted during the training process to obtain a first language model, and a question-answering intelligent agent is constructed based on the trained first language model.
[0123] It can be understood as constructing training data through question-and-answer data in vertical fields under actual application scenarios, training the preset language model through these training data, adjusting the model parameters during the training process to ensure the response effect of the language model, and after the model training is completed, building a question-and-answer agent based on the language model to answer the user's non-slot intention conversation.
[0124] By using the question-and-answer agent to promptly reply to conversation messages with the intent type of no-slot intent, user messages that do not require slot judgment can be processed in a timely manner to ensure the timeliness of responses. At the same time, targeted training using vertical field question-and-answer data can further ensure the accuracy of responses.
[0125] Step S205, obtain the node judgment process table of the initial intention, and determine the slot to be supplemented corresponding to the current dialogue information according to the slot information corresponding to each slot in the node judgment process table and the slot list. The node judgment process table includes: the slot judgment order corresponding to the initial intention and the judgment rules for each slot.
[0126] Specifically, the judgment flow chart can be generated by pre-building a process modeling agent, which can extract professional knowledge in the business field and generate judgment flow charts corresponding to various businesses. For example, in the field of intelligent customer service for personal foreign exchange business, the business handling knowledge is the Chinese personal foreign exchange business service guide. The process modeling agent uses the Chinese personal foreign exchange business service guide to build a judgment flow chart for handling different personal foreign exchange businesses.
[0127] Specifically, in step S205, the slot information corresponding to each slot in the node judgment process table and the slot list is determined to determine the slot to be supplemented corresponding to the current dialogue information, including:
[0128] Determine the target slot in the slot list according to the judgment order in the node judgment flow table;
[0129] Determine whether the target slot is empty. If it is empty, determine the target slot as a slot to be supplemented, and execute the step of outputting prompt information corresponding to the slot to be supplemented by prompting the intelligent agent;
[0130] If it is not empty, determine whether the slot information corresponding to the target slot meets the preset requirements according to the judgment rule corresponding to the target slot;
[0131] When the slot information corresponding to the target slot meets the preset requirements, determining whether the target slot is the last slot in the determination sequence;
[0132] If not, update the target slot according to the judgment order and execute the step of judging whether the target slot is empty;
[0133] If yes, determine the reply result corresponding to the initial intention according to the slot information corresponding to each current slot.
[0134] It can be understood that after obtaining the slot information corresponding to each current slot and the node judgment process table corresponding to the initial intention, each slot can be defined as a target slot in turn according to the judgment order in the node judgment process table, thereby judging the slot information of the target slot.
[0135] When making a judgment, first determine whether the slot information of the target slot is empty. If it is empty, directly determine the slot as a slot to be supplemented, and output the subsequent prompt information. When the slot information corresponding to the target slot is not empty, it can be determined whether the slot information meets the preset requirements according to the judgment rule corresponding to the slot.
[0136] In one example, a slot judgment agent specifically used to perform the above-mentioned slot judgment steps can be constructed. For this agent, its training process can also be to generate corresponding training data through corresponding prompt templates, thereby training the corresponding language model, and then constructing the corresponding slot judgment agent.
[0137] Specifically, judging whether the slot information corresponding to the target slot meets the preset requirements according to the judgment rule corresponding to the target slot includes:
[0138] Determine a global variable table corresponding to the target slot, and determine whether the slot information corresponding to the target slot meets preset requirements based on whether the slot information corresponding to the target slot is located in the global variable table.
[0139] It can be understood that different slots correspond to specific global variable tables. For example, taking the "target currency" slot under the "query exchange rate" intent as an example, its corresponding global variable table can be "US dollars, RMB, Euro, British pound, franc...", and whether the slot information corresponding to the slot is in the preset global variable table is used to determine whether the slot information meets the preset requirements. By comparing the slot information of the target slot with the global variable table, it can be accurately determined whether the slot information of the target slot meets the requirements, ensuring the accuracy of the slot judgment. In an example, the global variables corresponding to different slots can be shown in Table 2:
[0140] Table 2
[0141]
[0142] When the slot information does not meet the preset requirements, you can refuse to answer the user's question, or you can set the target slot as a slot to be supplemented and output corresponding prompt information so that the user can modify and supplement the slot information, so as to re-judge whether it meets the requirements later.
[0143] When the slot information meets the preset requirements, the target slot can be further judged, that is, whether the target slot is the last slot in the judgment order. If the current target slot is the last slot, it means that all slots in the slot list now have corresponding slot information, and all slot information meets the requirements, that is, the current dialogue information is complete, so the reply result corresponding to the initial intention can be determined based on the slot information of each slot. When replying, the above-mentioned question-answer reply agent can be used to answer based on the slot information of each slot; if the current target slot is not the last slot in the judgment order, the next slot needs to be updated to the target slot according to the judgment order, and a new round of judgment is performed.
[0144] By determining whether the slot information corresponding to each slot meets the requirements through the judgment order in the node judgment process table and the judgment rules corresponding to each slot, and changing the target slot for a new judgment based on the judgment result, the slot information that needs to be supplemented in the current slot list can be more accurately judged to ensure the accuracy of subsequent prompt information and improve the effectiveness of subsequent target user supplementary information.
[0145] Step S206, the prompting agent outputs prompt information corresponding to the slot to be supplemented, so as to obtain dialogue information of the target user for supplementing the slot to be supplemented.
[0146] Specifically, in step S206, the prompting agent outputs prompt information corresponding to the slot to be supplemented, including:
[0147] Call the seed phrase table, which includes: seed phrases corresponding to different slots;
[0148] The prompt agent determines the target seed speech corresponding to the slot to be supplemented according to the seed speech table, and generates corresponding prompt information based on the target seed speech.
[0149] It can be understood that seed phrases corresponding to different slots to be supplemented can be pre-set, and these seed phrases are stored in the seed phrase table. When the prompting agent needs to output the prompt information corresponding to the slot to be supplemented, it is necessary to first determine the seed phrase corresponding to the slot to be supplemented, that is, the target seed phrase mentioned above, and perform certain text optimization according to the target seed phrase to output appropriate prompt information, so that the prompting agent outputs more accurate prompt information, ensuring the effectiveness and readability of the prompt information. At the same time, more diverse questions can also be generated based on the seed phrase to obtain the missing slot information. In an exemplary example, the seed phrase table can be shown in Table 3:
[0150] Table 3
[0151]
[0152] The slot information supplement method based on multi-agent interaction provided by the embodiment of the present invention identifies the specific intention type of the current dialogue information, thereby performing slot identification according to the current dialogue information, or filling the slots according to the current dialogue information to obtain specific slot information of each slot, and then performing slot judgment based on the slot information of these slots to determine the slots to be supplemented in the dialogue information that need to be supplemented, thereby outputting targeted prompt information to guide the user to supplement the corresponding slot information, solving the problem of being unable to guide the user to effectively supplement important dialogue information, and facilitating intelligent reply customer service in some specific fields to provide more accurate answers to user conversations.
[0153] In order to facilitate understanding of the model construction methods corresponding to various intelligent agents in the embodiments of the present invention, an intelligent agent model construction architecture diagram is provided, such as Figure 3 As shown in the figure, it is an example diagram of an intelligent agent model construction architecture according to an embodiment of the present invention. First, the corresponding business data is prepared according to the actual business application scenario. Taking the banking field as an example, it is necessary to prepare professional business data such as foreign exchange, provident fund, insurance, etc. At the same time, it is also necessary to collect question-and-answer dialogue data in different scenarios according to the actual dialogue scenario, such as the question-and-answer dialogue data in the actual situation of the consulting scenario, customer service scenario, network scenario, etc. The data is sorted out for business to obtain certain sample data.
[0154] Then, in combination with the content corresponding to the prompt template in the above-mentioned embodiment of the invention, the format of these sample data is adjusted to generate fine-tuning instruction data, that is, training data is constructed, and then different intelligent agents are trained according to these training data, that is, intelligent agents with intention recognition, slot recognition, question and answer, process modeling, slot judgment, and prompt functions are trained accordingly.
[0155] At the same time, according to the preset data such as the preset slot order judgment list, judgment process table, global variable table, seed speech table, etc., the above-mentioned trained intelligent agents can interact with each other, so as to jointly realize functions in certain specific fields. For example, these intelligent agents can interact with each other and act as executors such as virtual artificial customer service or virtual lobby managers to realize the function of guiding customers to supplement information in actual application scenarios.
[0156] This embodiment also provides a slot information supplement system based on multi-agent interaction, which includes: an intention recognition agent, a slot recognition agent, a question-answering agent, a process modeling agent, a slot judgment agent, and a prompting agent. Figure 4 Shown is an example diagram of the execution process of a slot information supplement system based on multi-agent interaction according to an embodiment of the present invention.
[0157] like Figure 4 As shown, the intent recognition agent receives the dialogue information sent by the user. After receiving the dialogue information, it will determine the specific intent type of the dialogue information. When its specific intent type is a pending slot intention, it will update the intent of the dialogue information to the initial intent, and at the same time call and save the slot list corresponding to the intent of the dialogue information in the system.
[0158] Then the dialogue information and the corresponding slot list are sent to the slot identification agent, which can identify the slot information corresponding to each slot in the dialogue information based on the dialogue information and each slot in the slot list. At the same time, the process judgment table corresponding to the intention of the dialogue information is determined by the process modeling agent, and the process judgment table includes the judgment nodes and judgment rules corresponding to each slot.
[0159] The process judgment table and the slot information of each slot are sent to the slot judgment agent. Since the intention of the dialogue information is the initial intention, it can be processed from the first process node in the process judgment table. When the slot judgment agent performs the judgment function, the prompt template corresponding to the process slot judgment agent can be filled according to the slot information corresponding to the current process node and the judgment rules in the judgment process table. The slot judgment agent judges the slot information of each process node based on the prompt template.
[0160] When making a slot judgment, first determine whether the slot information is empty. If it is empty, directly determine the slot corresponding to the process node as the slot to be supplemented. If it is not empty, determine whether the slot information meets the conditions, that is, whether the slot information is located in the corresponding global variable table. If it does not meet the conditions, refuse to answer the customer's dialogue information. If it meets the conditions, determine whether the current process node is the last node. If so, it means that the slot information of each slot currently meets the requirements, and the corresponding answer can be output based on the slot information of each slot. If it does not meet the conditions, continue to execute the above steps with the slot information corresponding to the next node.
[0161] After determining the slots to be supplemented, it is necessary to request the user to supplement the corresponding slot information. The prompting agent can determine the seed words corresponding to the slots to be supplemented in the seed words table, and thus generate corresponding prompt information based on the seed words.
[0162] In another case, if the intent type corresponding to the dialogue information is a slot-filling intent, determine whether the current initial intent is an intent with a slot. If not, it means that there was no dialogue with a slot intent before the current dialogue, so you can refuse to answer the dialogue. If yes, it means that there was dialogue information before the current dialogue, and the current dialogue information is a supplement to the previous dialogue information. At this time, you can get the most recently saved slot list, and fill the user's current dialogue information into the corresponding slot in the slot list according to the previous question, that is, the question used to guide the user to fill in the slot information. Then, the slot information of each slot in the current slot list is identified by the slot recognition agent, and a new round of judgment is performed according to the current judgment flow table and the node reached by the last slot judgment. The judgment content is not repeated here.
[0163] In multiple rounds of dialogue, for a certain task, it can identify whether the slot information in the user input is complete. If it is incomplete, the user is guided to complete the slot information, providing a more comprehensive dialogue interaction capability. Compared with the traditional dialogue system, the present invention uses multiple intelligent agents, each of which completes different tasks. Let them work together to better cope with certain professional task scenarios in vertical fields, provide a more intelligent dialogue experience, and improve the accuracy and practicality of the dialogue system.
[0164] For example, the construction method of each agent in the above system can be as follows:
[0165] Step 1: Divide the tasks.
[0166] First, we need to divide the tasks to clarify the possible tasks in the conversation and determine what intent these tasks belong to, so as to facilitate the subsequent data preparation and model training. The following are the specific steps and examples:
[0167] Step 1.1: Define the mission.
[0168] In this step, we first identify the various tasks that may occur in the conversation between the user and the bank's personal foreign exchange business intelligent customer service. These tasks may include, but are not limited to, purchasing foreign exchange, checking exchange rates, chatting, etc. By analyzing customer needs and typical conversations in the personal foreign exchange field, we list possible tasks. Example: The tasks that may be involved in the conversation of the personal foreign exchange business intelligent customer service include: purchasing foreign exchange, checking exchange rates, filling slots, and other intentions.
[0169] Step 1.1: Delineate domain boundaries.
[0170] In this step, tasks that require certain key information to be solved are divided into intents with slots, inputs used to complete key information are defined as intents to fill slots, and other idle chats or purposeless conversations are defined as intents without slots. In the bank's personal foreign exchange business scenario, foreign exchange purchases and exchange rate inquiries are defined as intents with slots, because such tasks require the use of a large slot model to identify specific slots in the user's conversation, and then query an external knowledge base or call a third-party interface based on the slot information, which cannot be directly handled by a general large model.
[0171] For example, the user input intent is to check the exchange rate. User: "I want to know how many euros I can get for 100 US dollars?".
[0172] The input used to fill the slot in the previous question is the slot filling intention. For example, the US dollar is the slot in the exchange rate query. If the user wants to query the exchange rate but does not provide the source currency and target currency of the large model, the user needs to fill the currency slot. For example: User: "US dollar".
[0173] Other small talk or simple knowledge questions and answers can be directly handed over to the question-and-answer agent and classified as no-slot intent.
[0174] Step 2: Training data preparation.
[0175] In the embodiment of the present invention, step 2 is intended to prepare for the training of the base model of the intent recognition agent, slot recognition agent, question-answering agent and process modeling agent. The data preparation stage includes collecting, marking and organizing the conversation data, and providing the necessary information for the model, such as intent labels, slot type definitions and prompt templates. The following are the specific data preparation steps:
[0176] Step 2.1: Collect training samples.
[0177] First, you need to collect or generate conversation samples related to personal foreign exchange business to build training sets, validation sets, and test sets. These conversation samples should include single-round and multi-round conversations and cover a variety of possible tasks and scenarios. Conversation samples can be obtained from bank customer service records, online chat records, or simulated conversations. Here is an example: User: "I want to know how many euros I can get for 100 US dollars?".
[0178] Step 2.2: Intent label generation.
[0179] For each round of dialogue, a clear intent label needs to be generated for the user's intent. These labels will be used to train the large model of the intent recognition agent. The intent label for the bank's personal foreign exchange business should include the tasks defined in step 1, such as purchasing foreign exchange, checking exchange rates, and filling slots. For the dialogue example shown in step 2.1, the intent label should be marked as checking exchange rates. Because checking exchange rates belongs to the intent with slots in step 1, the sample is first identified as an intent with slots by the intent recognition agent, and then thrown to the slot recognition agent to identify the slots.
[0180] Step 2.3: Mark the slot information.
[0181] In the conversation data, there may be slot information that needs to be identified and extracted. Therefore, the slot information needs to be marked in the training samples to train the large model to have the ability to identify slot information. For example, in the above example of querying exchange rates, the slot information is: {"source currency":"US dollar", "target currency":"Euro"}.
[0182] First, the intent recognition agent identifies that the question is about the exchange rate. Then, the intent routing sends the question to the slot recognition agent to identify the slot, i.e. the source currency and the target currency. Therefore, when the sample is put into the large model of the slot recognition agent for training, the label is the sample's slot type and its specific value.
[0183] Step 2.4: Prompt template design.
[0184] In order to guide the large model to better identify the intentions of different tasks, prompt templates for different agents are designed to better utilize the capabilities of the large model. In the scenario of personal foreign exchange business in banks, the prompt template of the intention recognition agent can be:
[0185] Task description: Classify the intent of [user input] and classify it into one of the [limited intent list].
[0186] Limited intent list: {buy currency, check exchange rate, fill slot, other intents}
[0187] User input: {userinput}
[0188] Output: "{Output}, output the user's intention based on the user's specific input content.
[0189] The prompt template for the slot recognition agent can be:
[0190] Task description: You are a parameter extractor. Given a piece of text Text, please extract the corresponding parameter content in the text Text and return it according to the given parameter list Param.
[0191] ------------Param (type, description):{}
[0192] ------------Few Shot:{}
[0193] ------------Input:Text:{}
[0194] Output: Parameter content corresponding to the user input text, for example: {\"source currency\": \"US dollar\" , \"target currency\": \"RMB\"}.
[0195] The slot type and its description should be given in the prompt template according to different intentions, and several examples should be given to achieve contextual learning to help the large model easier to understand.
[0196] The prompt template for the slot judgment agent can be:
[0197] Task description: You are a slot judge. Output the next node based on the input slot value Param and the judgment rule Rule.
[0198] Param (type, value): {}
[0199] Rule:{}
[0200] Output: Output the next node according to the specific judgment rule. For example, if the current node is node 1 and the next node of the node is determined to be node 2 according to the judgment rule, then node 2 is output.
[0201] Due to the limited capabilities of the large model, if we hand over the entire judgment process table to the slot judgment agent, the effect may not be good. We designed a loop to hand over the judgment process of each slot to the large model step by step. For an intent with a slot, the judgment starts from the first slot node in the judgment process table, and outputs the next node name according to the judgment condition. The next time, the judgment process of the next slot is found according to the node name until the entire traversal reaches the last node, completing the entire slot judgment input by the user.
[0202] Step 2.5: Build the instruction dataset.
[0203] Combine the instruction templates of different large models with the training samples to generate fine-tuning instruction data, which is stored in JSON format. For example, the instruction data for training the slot recognition large model is:
[0204] {
[0205] "instruction": "\nYou are a parameter extractor. Provide a text Text. Please extract the corresponding parameter content in the text Text according to the given parameter list Param and return it.\n------------Param (type, description):\n\t(1)\"Source Currency\": the original currency\n\t(2)\"Target Currency\": the currency to be exchanged\n------------Few Shot:\nText:\nI want to know how many euros can be exchanged for 100 US dollars?\nOutput:\n {\"Source Currency\":\"US Dollar\", \"Target Currency\":\"Euro\"}\n\nText:\nWhat is the exchange rate for US dollars?\nOutput:\n {\"Source Currency\":\"US Dollar\", \"Target Currency\":\"None\"}\n------------Input:\nText:\nWhat is the current exchange rate?\nOutput:\n",
[0206] "input": "",
[0207] "output": "{\"Source Currency\": \"None\" , \"Target Currency\": \"None\"}"
[0208] }
[0209] Step 3: Model training.
[0210] Step 3 aims to train large models of different agents so that they can effectively identify and handle different tasks. The following are the specific model training steps, taking the bank's personal foreign exchange business intelligent customer service as an example:
[0211] We first train a large model that can recognize intent. Its task is to recognize the specific task intent of the user input. This model will achieve efficient recognition through supervised fine-tuning. For bank intelligent customer service, we will use open source large pre-trained language models (such as ChatGLM2-6b). Then, we use the intent label data in the field of personal foreign exchange business of the bank and the instruction data constructed by the prompt template to supervise the model to ensure that it can accurately recognize the user's intent.
[0212] We then train a large model that can identify slots. This model is responsible for identifying slot information in user questions based on different intents. We can also use open source large pre-trained language models (such as ChatGLM2-6b), use conversation data with slot information annotated in the field of personal foreign exchange banking, and instruction data constructed with prompt templates, and fine-tune the model in a supervised manner to ensure that it can accurately identify slots in user input.
[0213] We also need to train a large vertical model and use an open source large language model (such as ChatGLM2-6b) to fine-tune it with vertical question-and-answer data. This large model serves as the core of the question-and-answer agent and answers questions entered by users.
[0214] After the model is trained, the fine-tuned large model becomes the brain of each intelligent agent, forming intention recognition agent, slot recognition agent, slot judgment agent, process modeling agent, question and answer agent, and prompt agent.
[0215] Step 4: Knowledge preparation.
[0216] Some external knowledge needs to be prepared, and the intelligent agent needs to refer to this knowledge to generate results. This reference knowledge includes business processing knowledge, slot information table, global variable table, and seed speech table.
[0217] In the field of intelligent customer service for personal foreign exchange business, the business handling knowledge is the Chinese personal foreign exchange business service guide. The process modeling agent uses the Chinese personal foreign exchange business service guide to construct a judgment process table for handling different personal foreign exchange businesses. The slot information table, global variable table, and seed speech table can refer to the corresponding exemplary content in the above method embodiment, which will not be repeated here.
[0218] Step 5: Process modeling.
[0219] The process modeling agent extracts the process of business processing knowledge. The process modeling agent must first obtain the slots for each intent based on the slot information table. The process modeling agent then constructs a judgment process table based on the business processing knowledge. Our judgment process table is expressed in json format, as shown below.
[0220] [{
[0221] "type": "decision",
[0222] "name": "Currency is None",
[0223] "description": "Judge whether the currency slot is empty",
[0224] "next": [
[0225] {
[0226] "condition": "Yes",
[0227] "nextnode": "Request slot replenishment"
[0228] },
[0229] {
[0230] "condition": "No",
[0231] "nextnode": "The currency exchange type is none"
[0232] } ]
[0234] },
[0235] {
[0236] "type": "decision",
[0237] "name": "Whether the currency supports processing",
[0238] "description": "Judge whether the currency supports processing",
[0239] "next": [
[0240] {
[0241] "condition": "Yes",
[0242] "nextnode": "The currency exchange type is none"
[0243] },
[0244] {
[0245] "condition": "No",
[0246] "nextnode": "Exit"
[0247] } ]
[0249] },
[0250] {
[0251] "type": "decision",
[0252] "name": "The banknote type is none",
[0253] "description": "Judge whether the banknote type is None",
[0254] "next": [
[0255] {
[0256] "condition": "Yes",
[0257] "nextnode": "Request slot replenishment"
[0258] },
[0259] {
[0260] "condition": "No",
[0261] "nextnode": "Customer type is none"
[0262] } ]
[0264] },……]
[0265] Each intention with slots corresponds to a judgment flow table, each slot corresponds to a node, and each node specifies the rules for judging whether the slot is empty or meets the requirements. The judgment flow table is combined with the prompt template and handed over to the slot judgment agent, and the slot judgment agent can realize the process control of judging the slot. Each new intention task with slots starts with the first slot. As shown in the above foreign exchange purchase intention, the first slot is the currency slot. The judgment starts from the currency slot. If the currency is empty, the agent is prompted to output a counter-question about the currency; if the currency is not empty, further judge whether the currency supports processing, and judge whether the proportion is supported by comparing with the global variables of the currency slot. If it is supported, the currency slot is judged and the next slot is judged.
[0266] Step 6: Multi-agent interaction.
[0267] Intention recognition agents, slot recognition agents, slot judgment agents, process modeling agents, question-answering agents, and prompt agents are combined into our intelligent customer service. Taking an exemplary processing flow as an example, the processing process can be as follows: In advance, the process modeling agent needs to convert the business handling knowledge into a judgment flow table. The user inputs: "I want to buy foreign exchange, what should I do?" Then the intention recognition agent recognizes that the intention is to buy foreign exchange, because buying foreign exchange is a slot intention, and finds and saves the slot information table of the intention to buy foreign exchange, and then hands the question to the slot recognition agent to identify its slot value:
[0268] {"Currency":"None","Banknote Type":"None","Customer Type":"None","Source of Purchased Currency":"None"}
[0269] Query the judgment process table of the intention to purchase foreign exchange, start from the first slot, find the corresponding judgment process of the first slot, combine the prompt template and input it to the slot judgment agent. The slot judgment agent finds that the value of the currency slot is empty and finds that the next step should be to ask the user a question. The prompt agent asks the user a question, and the user replies: "US dollars".
[0270] The problem of the missing slot and the user filling the slot are spliced together, and the slot recognition agent is handed over to re-identify the slot. The slot judgment agent then determines that the currency slot is US dollars. The next step is to determine whether the proportion supports processing. The slot value "US dollars" is compared with the global variable of the currency. It is found that it supports processing. Until the last node of the judgment process table is traversed, the slot is filled and the answer is output.
[0271] Based on the excellent intent recognition capability of large language models, the intent recognition agent can recognize the intent of the user's input. If the user's input is a slot-containing intent, the slot information table and judgment flow table of the intent are searched and saved. The slot recognition agent identifies the slot of the question based on the slot information table. The slot judgment agent determines whether the slot is empty and whether the slot meets the requirements based on the judgment flow table. If the user's input is a slot-free intent, the question-answering agent directly answers the question. If the slot is missing, the prompt agent outputs a counter-question for the missing slot. The user then enters the slot of the previous question, which is spliced together with the previous question and handed over to the slot recognition agent to recognize the slot again, achieving seamless switching during the interaction process.
[0272] In this embodiment, a slot information supplement device based on multi-agent interaction is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0273] This embodiment provides a slot information supplement device based on multi-agent interaction, such as Figure 5 As shown, including:
[0274] The intention recognition module 401 is used to obtain the current conversation information of the target user and determine the target intention and the intention type of the target intention of the current conversation information through the intention recognition agent;
[0275] The slot identification module 402 is used to determine the target intent as the initial intent when the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, and the slot identification agent determines the slot list corresponding to the initial intent according to the preset slot information table, and determines the slot information corresponding to each slot in the slot list based on the current dialogue information;
[0276] The slot judgment module 403 is used to obtain the node judgment flow table of the initial intention, and determine the slot to be supplemented corresponding to the current dialogue information according to the slot information corresponding to each slot in the node judgment flow table and the slot list. The node judgment flow table includes: the slot judgment order corresponding to the initial intention and the judgment rules of each slot;
[0277] The information prompt module 404 is used to output prompt information corresponding to the slot to be supplemented by the prompting agent, so as to obtain the dialogue information used by the target user to supplement the slot to be supplemented.
[0278] In some optional implementations, the slot identification module 402 is further used to fill the slot list corresponding to the initial intent according to the current dialogue information when the intent type of the target intent corresponding to the current dialogue information is the slot supplement intent, and determine the slot information of each slot in the currently filled slot list through the slot identification agent. Thus, the slot judgment module 403 performs the step of determining the slot to be supplemented corresponding to the current dialogue information according to the slot information corresponding to each slot in the node judgment flow table and the slot list.
[0279] In some optional implementations, the slot identification module 402 is further configured to output a reply result of the current dialogue information through the question-answering agent when the intent type of the target intent corresponding to the current dialogue information is a no-slot intent;
[0280] The question-answering agent is constructed as follows:
[0281] A question-answering training dataset is constructed based on vertical field question-answering data, a model of a first preset language model is trained based on the question-answering training dataset, model parameters are adjusted during the training process to obtain a first language model, and a question-answering intelligent agent is constructed based on the trained first language model.
[0282] In some optional implementations, the slot determination module 403, when determining the slot to be supplemented corresponding to the current dialog information according to the slot information corresponding to each slot in the node determination process table and the slot list, includes:
[0283] Determine the target slot in the slot list according to the judgment order in the node judgment flow table;
[0284] Determine whether the target slot is empty. If it is empty, determine the target slot as a slot to be supplemented, and execute the step of outputting prompt information corresponding to the slot to be supplemented by prompting the intelligent agent;
[0285] If it is not empty, determine whether the slot information corresponding to the target slot meets the preset requirements according to the judgment rule corresponding to the target slot;
[0286] When the slot information corresponding to the target slot meets the preset requirements, determining whether the target slot is the last slot in the determination sequence;
[0287] If not, update the target slot according to the judgment order and execute the step of judging whether the target slot is empty;
[0288] If yes, determine the reply result corresponding to the initial intention according to the slot information corresponding to each current slot.
[0289] In some optional implementations, the intention recognition agent in the intention recognition module 401 is constructed as follows:
[0290] Determine a first prompt template corresponding to the intention recognition agent, the first prompt template comprising: an intention recognition task description module, a limited intention list module, a user input module and an intention output module;
[0291] Acquire conversation sample data, determine the intent label corresponding to the conversation sample data, fill in the user input module and the intent output module of the first prompt template based on the conversation sample data and the corresponding intent label, and construct an intent recognition training data set;
[0292] Training a second language model to be trained based on the intention recognition training data set to obtain a second language model, and constructing an intention recognition agent according to the trained second language model;
[0293] The slot identification agent in the slot identification module 402 is constructed as follows:
[0294] Determine a second prompt template corresponding to the slot recognition agent, the second prompt template comprising: a slot recognition task description module, an information input module and an information output module, the slot recognition task description module comprising: a description of each slot in the slot list corresponding to each intention;
[0295] Acquire the dialogue sample data, determine the slot information annotation corresponding to the dialogue sample data, fill the information input module and the information output module of the second prompt template based on the dialogue sample data and the corresponding slot information annotation, and construct a slot recognition training data set;
[0296] The third preset language model is trained based on the slot recognition training data set to obtain a third language model, and an intent recognition intelligent agent is constructed according to the trained third language model.
[0297] In some optional implementations, the slot determination module 403, when determining whether the slot information corresponding to the target slot meets the preset requirement according to the determination rule corresponding to the target slot, includes:
[0298] Determine a global variable table corresponding to the target slot, and determine whether the slot information corresponding to the target slot meets preset requirements based on whether the slot information corresponding to the target slot is located in the global variable table.
[0299] In some optional implementations, the information prompt module 404, when outputting the prompt information corresponding to the slot to be replenished through the prompt agent, includes:
[0300] Call the seed phrase table, which includes: seed phrases corresponding to different slots;
[0301] The prompt agent determines the target seed speech corresponding to the slot to be supplemented according to the seed speech table, and generates corresponding prompt information based on the target seed speech.
[0302] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0303] The slot information supplement device based on multi-agent interaction in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0304] The embodiment of the present invention also provides a computer device having the above Figure 5 The slot information supplement device based on multi-agent interaction is shown.
[0305] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0306] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0307] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0308] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0309] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0310] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0311] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device may be a touch screen.
[0312] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0313] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A slot information supplement method based on multi-agent interaction, characterized in that: The method comprises: Obtaining current conversation information of the target user, and determining the target intent of the current conversation information and the intent type of the target intent through an intent recognition agent; When the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, the target intent is determined as the initial intent, and the slot recognition agent determines a slot list corresponding to the initial intent according to a preset slot information table, and determines slot information corresponding to each slot in the slot list based on the current dialogue information; Obtaining a node judgment flow table of the initial intention, and determining a slot to be supplemented corresponding to the current conversation information according to the node judgment flow table and the slot information corresponding to each slot in the slot list, wherein the node judgment flow table includes: a slot judgment order corresponding to the initial intention and a judgment rule for each slot; Outputting prompt information corresponding to the slot to be supplemented by the prompting agent to obtain dialogue information for the target user to supplement the slot to be supplemented; When the intent type of the target intent corresponding to the current dialogue information is a no-slot intent, outputting a reply result of the current dialogue information through the question-answering agent; The question-answering agent is constructed as follows: Constructing a question-answering training data set based on vertical field question-answering data, training a model of a first preset language model based on the question-answering training data set, adjusting model parameters during the training process to obtain a first language model, and constructing a question-answering intelligent agent based on the trained first language model; The determining the slot to be supplemented corresponding to the current dialogue information according to the node judgment process table and the slot information corresponding to each slot in the slot list includes: Determine the target slot in the slot list according to the judgment order in the node judgment flow table; Determine whether the target slot is empty, and if so, determine the target slot as a slot to be replenished, and execute the step of outputting prompt information corresponding to the slot to be replenished by the prompting agent; If it is not empty, judging whether the slot information corresponding to the target slot meets the preset requirements according to the judgment rule corresponding to the target slot; When the slot information corresponding to the target slot meets the preset requirement, determining whether the target slot is the last slot in the determination sequence; If not, updating the target slot according to the determination sequence, and executing the step of determining whether the target slot is empty; If yes, determine the reply result corresponding to the initial intention according to the slot information corresponding to each current slot; The intention recognition agent is constructed as follows: Determine a first prompt template corresponding to the intention recognition agent, wherein the first prompt template includes: an intention recognition task description module, a limited intention list module, a user input module and an intention output module; Acquire conversation sample data, determine the intent label corresponding to the conversation sample data, fill the user input module and the intent output module of the first prompt template based on the conversation sample data and the corresponding intent label, and construct an intent recognition training data set; Training a second language model to be trained based on the intention recognition training data set to obtain a second language model, and constructing an intention recognition agent according to the trained second language model; The slot recognition agent is constructed as follows: Determine a second prompt template corresponding to the slot recognition agent, the second prompt template comprising: a slot recognition task description module, an information input module and an information output module, the slot recognition task description module comprising: a description of each slot in a slot list corresponding to each intention; Acquire dialogue sample data, determine slot information annotations corresponding to the dialogue sample data, fill in the information input module and the information output module of the second prompt template based on the dialogue sample data and the corresponding slot information annotations, and construct a slot recognition training data set; A third preset language model is trained based on the slot recognition training data set to obtain a third language model, and a slot recognition agent is constructed according to the trained third language model.
2. The method according to claim 1, characterized in that The method further comprises: When the intent type of the target intent corresponding to the current dialogue information is a slot supplement intent, the slot list corresponding to the initial intent is filled according to the current dialogue information, and the slot information of each slot in the currently filled slot list is determined by the slot recognition agent; The step of determining the slot to be supplemented corresponding to the current dialogue information is performed according to the slot information corresponding to each slot in the node judgment process table and the slot list.
3. The method according to claim 1, characterized in that The determining, according to the determination rule corresponding to the target slot, whether the slot information corresponding to the target slot meets the preset requirement includes: Determine a global variable table corresponding to the target slot, and determine whether the slot information corresponding to the target slot meets a preset requirement based on whether the slot information corresponding to the target slot is located in the global variable table.
4. The method according to claim 1, characterized in that: The outputting of the prompt information corresponding to the slot to be supplemented by the prompting agent includes: Calling a seed speech table, wherein the seed speech table includes: seed speech corresponding to different slots; The prompt agent determines the target seed speech corresponding to the slot to be supplemented according to the seed speech table, and generates corresponding prompt information based on the target seed speech.
5. A slot information supplement device based on multi-agent interaction, characterized in that: The device comprises: An intention recognition module is used to obtain the current conversation information of the target user and determine the target intention of the current conversation information and the intention type of the target intention through an intention recognition agent; A slot recognition module, configured to determine the target intent as an initial intent when the intent type of the target intent corresponding to the current dialogue information is an intent with a slot, and the slot recognition agent determines a slot list corresponding to the initial intent according to a preset slot information table, and determines slot information corresponding to each slot in the slot list based on the current dialogue information; A slot judgment module is used to obtain a node judgment flow table of the initial intention, and determine the slot to be supplemented corresponding to the current dialogue information according to the node judgment flow table and the slot information corresponding to each slot in the slot list, wherein the node judgment flow table includes: a slot judgment order corresponding to the initial intention and a judgment rule for each slot; An information prompting module, used to output prompting information corresponding to the slot to be supplemented by prompting the intelligent agent, so as to obtain dialogue information for the target user to supplement the slot to be supplemented; The slot identification module is further configured to output a reply result of the current dialogue information through the question-answering agent when the intent type of the target intent corresponding to the current dialogue information is a no-slot intent; The question-answering agent is constructed as follows: Constructing a question-answering training data set based on vertical field question-answering data, training a model of a first preset language model based on the question-answering training data set, adjusting model parameters during the training process to obtain a first language model, and constructing a question-answering intelligent agent based on the trained first language model; The slot determination module, when determining the slot to be supplemented corresponding to the current dialogue information according to the slot information corresponding to each slot in the node determination process table and the slot list, includes: Determine the target slot in the slot list according to the judgment order in the node judgment flow table; Determine whether the target slot is empty, and if so, determine the target slot as a slot to be replenished, and execute the step of outputting prompt information corresponding to the slot to be replenished by the prompting agent; If it is not empty, judging whether the slot information corresponding to the target slot meets the preset requirements according to the judgment rule corresponding to the target slot; When the slot information corresponding to the target slot meets the preset requirement, determining whether the target slot is the last slot in the determination sequence; If not, updating the target slot according to the determination sequence, and executing the step of determining whether the target slot is empty; If yes, determine the reply result corresponding to the initial intention according to the slot information corresponding to each current slot; The intention recognition agent is constructed as follows: Determine a first prompt template corresponding to the intention recognition agent, wherein the first prompt template includes: an intention recognition task description module, a limited intention list module, a user input module and an intention output module; Acquire conversation sample data, determine the intent label corresponding to the conversation sample data, fill the user input module and the intent output module of the first prompt template based on the conversation sample data and the corresponding intent label, and construct an intent recognition training data set; Training a second language model to be trained based on the intention recognition training data set to obtain a second language model, and constructing an intention recognition agent according to the trained second language model; The slot recognition agent is constructed as follows: Determine a second prompt template corresponding to the slot recognition agent, the second prompt template comprising: a slot recognition task description module, an information input module and an information output module, the slot recognition task description module comprising: a description of each slot in a slot list corresponding to each intention; Acquire dialogue sample data, determine slot information annotations corresponding to the dialogue sample data, fill in the information input module and the information output module of the second prompt template based on the dialogue sample data and the corresponding slot information annotations, and construct a slot recognition training data set; A third preset language model is trained based on the slot recognition training data set to obtain a third language model, and a slot recognition agent is constructed according to the trained third language model.
6. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the slot information supplementation method based on multi-agent interaction as described in any one of claims 1 to 4 by executing the computer instructions.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the slot information supplement method based on multi-agent interaction as described in any one of claims 1 to 4.
