Intelligent dialogue method and apparatus, electronic device, and storage medium
Patent Information
- Application Number
- PCT/CN2025/095837
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-02-21
- Filing Date
- 2025-05-19
- Publication Date
- 2026-08-27
Smart Images

Figure CN2025095837_27082026_PF_FP_ABST
Abstract
Description
Intelligent dialogue methods, devices, electronic devices and storage media
[0001] Relevant publicly available cross-references
[0002] This disclosure claims priority to Chinese Patent Application No. 202510195811X, filed on February 21, 2025, entitled “Intelligent Dialogue Method, Apparatus, Electronic Device and Storage Medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] This disclosure relates to the field of artificial intelligence technology, and more specifically, to an intelligent dialogue method, apparatus, electronic device, and storage medium. Background Technology
[0004] With the rapid development of artificial intelligence technology and the remarkable performance of large language models in the field of dialogue in recent years, chatbots are increasingly appearing in our daily lives. For chatbots used by businesses, most are applied to customer service, sales promotion, and other scenarios. In these scenarios, controllability and proactivity are key attributes of chatbots. Controllability requires chatbots to follow SOPs (Standard Operating Procedures). Proactivity requires chatbots to be able to guide the conversation toward the goal even when the user is uncooperative.
[0005] Currently, machine learning techniques are commonly used to enable robots to engage in dialogue. However, this approach relies on large amounts of labeled data and predefined rules, which often have limitations, making it difficult for robots to handle complex dialogue scenarios. Additionally, there is the method of using large language models for dialogue. While this approach can handle various dialogue scenarios, it cannot avoid model illusions, which can easily lead to dialogue straying from its target.
[0006] Public content
[0007] In view of the above, the purpose of this disclosure is to provide an intelligent dialogue method, apparatus, electronic device and storage medium.
[0008] To achieve the above objectives, the technical solutions adopted in the embodiments of this disclosure are as follows:
[0009] Firstly, this disclosure provides an intelligent dialogue method, the intelligent dialogue method comprising:
[0010] During a conversation with a user, each candidate conversation node for the next step is obtained based on all conversation nodes in the preset conversation SOP tree and the current conversation node.
[0011] All candidate dialogue nodes are used as dialogue constraint information, and the target dialogue node for the next step is determined based on the dialogue SOP tree, the dialogue constraint information and historical dialogue information using a preset large language model.
[0012] Based on the target dialogue node, the large language model is used to generate the next response content, and the response content is fed back to the user.
[0013] In an optional implementation, each dialogue node contains dialogue action information;
[0014] The step of determining the next target dialogue node based on the dialogue SOP tree, the dialogue constraint information, and historical dialogue information using a preset large language model includes:
[0015] Based on the dialogue SOP tree, the dialogue constraint information, and the historical dialogue information, an action acquisition instruction is generated.
[0016] The action acquisition instruction is input into the large language model, and reference dialogue action information is generated using the large language model;
[0017] The dialogue action information of each candidate dialogue node is matched with the reference dialogue action information;
[0018] If there is a candidate dialogue node that matches the reference dialogue action information, then the candidate dialogue node is taken as the target dialogue node.
[0019] If no candidate dialogue node matches the reference dialogue action information, a temporary dialogue node and its dialogue action information are generated using the large language model, and the temporary dialogue node is used as the target dialogue node; wherein, the dialogue action information of the temporary dialogue node indicates that the dialogue is guided to the dialogue node in the dialogue SOP tree.
[0020] In an optional implementation, the step of matching the dialogue action information of each candidate dialogue node with the reference dialogue action information includes:
[0021] Calculate the similarity between the dialogue action information of each candidate dialogue node and the reference dialogue action information to obtain the similarity corresponding to each candidate dialogue node;
[0022] If there are candidate dialogue nodes whose similarity reaches a preset first threshold, then the candidate dialogue node with the highest similarity will be used as the candidate dialogue node that matches the reference dialogue action information.
[0023] If there is no candidate dialogue node whose similarity reaches the first threshold, it is determined that there is no candidate dialogue node that matches the reference dialogue action information.
[0024] In an optional implementation, the step of generating the next response content based on the target dialogue node using the large language model includes:
[0025] If the target dialogue node is a temporary dialogue node, a first script acquisition instruction is generated based on the dialogue action information of the temporary dialogue node.
[0026] The first script acquisition instruction is input into the large language model, and the large language model is used to generate a guiding script, which is then used as the response content for the next step.
[0027] In an optional implementation, each dialogue node also includes multiple standard dialogue lines;
[0028] The step of generating the next response content based on the target dialogue node using the large language model includes:
[0029] If the target dialogue node is a candidate dialogue node, obtain each standard dialogue of the candidate dialogue node to obtain each candidate dialogue.
[0030] All candidate dialogues are used as dialogue constraint information, and a second dialogue acquisition instruction is generated based on the dialogue constraint information.
[0031] The second script acquisition instruction is input into the large language model, and the target script is generated using the large language model;
[0032] Select the next response from the target response and all candidate responses.
[0033] In an optional implementation, the step of selecting the next response content from the target script and all candidate scripts includes:
[0034] Calculate the similarity between the target speech and each of the candidate speech;
[0035] If the similarity between the target message and at least one of the candidate messages reaches a preset second threshold, then the target message will be used as the response content for the next step.
[0036] If the similarity between the target message and all candidate messages does not reach the second threshold, then the candidate message with the highest similarity will be used as the response content for the next step.
[0037] Secondly, this disclosure provides an intelligent dialogue device, the intelligent dialogue device comprising:
[0038] The dialogue planning module is configured to obtain each candidate dialogue node for the next step based on all dialogue nodes in the preset dialogue SOP tree and the current dialogue node during a dialogue with the user.
[0039] All candidate dialogue nodes are used as dialogue constraint information, and the target dialogue node for the next step is determined based on the dialogue SOP tree, the dialogue constraint information and historical dialogue information using a preset large language model.
[0040] The dialogue generation module is configured to generate the next response content based on the target dialogue node using the large language model, and then feed the response content back to the user.
[0041] In an optional implementation, each dialogue node contains dialogue action information, and the dialogue planning module is further configured to:
[0042] Based on the dialogue SOP tree, the dialogue constraint information, and the historical dialogue information, an action acquisition instruction is generated.
[0043] The action acquisition instruction is input into the large language model, and reference dialogue action information is generated using the large language model;
[0044] The dialogue action information of each candidate dialogue node is matched with the reference dialogue action information;
[0045] If there is a candidate dialogue node that matches the reference dialogue action information, then the candidate dialogue node is taken as the target dialogue node.
[0046] If no candidate dialogue node matches the reference dialogue action information, a temporary dialogue node and its dialogue action information are generated using the large language model; wherein, the dialogue action information of the temporary dialogue node indicates that the dialogue will be guided to the dialogue node in the dialogue SOP tree.
[0047] Thirdly, this disclosure provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the intelligent dialogue method described in any of the foregoing embodiments.
[0048] Fourthly, this disclosure provides a storage medium storing a computer program, which, when executed by a processor, implements the intelligent dialogue method described in any of the foregoing embodiments.
[0049] The intelligent dialogue method, apparatus, electronic device, and storage medium provided in this disclosure include: during a dialogue with a user, obtaining each candidate dialogue node for the next step based on all dialogue nodes in a preset dialogue SOP tree and the current dialogue node; then using all candidate dialogue nodes as dialogue constraint information, and based on the dialogue SOP tree, the dialogue constraint information, and historical dialogue information, determining the target dialogue node for the next step using a preset large language model; next, based on the target dialogue node, generating the response content for the next step using the large language model, and feeding the response content back to the user. By using all candidate nodes as dialogue constraint information, combined with the SOP tree and historical dialogue information, the large language model determines the next dialogue node and generates the response content to engage in dialogue with the user, thereby ensuring the controllability and flexibility of the dialogue, improving the fluency and accuracy of the dialogue, and enhancing the user experience.
[0050] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this disclosure and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 shows a block diagram of an electronic device provided in an embodiment of the present disclosure;
[0053] Figure 2 shows one of the flowcharts of the intelligent dialogue method provided in the embodiments of this disclosure;
[0054] Figure 3 shows a second schematic flowchart of the intelligent dialogue method provided in this embodiment of the present disclosure;
[0055] Figure 4 shows a functional block diagram of the intelligent dialogue device provided in an embodiment of this disclosure.
[0056] Icons: 100 - Electronic device; 110 - Bus; 120 - Processor; 130 - Memory; 150 - I / O module; 170 - Communication module; 300 - Intelligent dialogue device; 310 - Dialogue planning module; 330 - Dialogue generation module. Detailed Implementation
[0057] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0058] Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely to illustrate selected embodiments of the disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of this disclosure.
[0059] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0060] Please refer to Figure 1, which is a block diagram of an electronic device 100 provided in an embodiment of this disclosure. The electronic device 100 includes a bus 110, a processor 120, a memory 130, an I / O module 150, and a communication module 170.
[0061] Bus 110 is a circuit that connects the above-mentioned components to each other and transmits signals between the components.
[0062] Processor 120 can receive commands from other components (e.g., memory 130, I / O module 150, communication module 170, etc.) via bus 110, interpret the received commands, and perform calculations or data processing based on the interpreted commands. Processor 120 can be an integrated circuit chip with signal processing capabilities. Processor 120 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), application-specific integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0063] The memory 130 can store commands or data received from the processor 120 or other components (such as I / O module 150, communication module 170, etc.) or commands or data generated by the processor 120 or other components. The memory 130 can be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), and electrically erasable programmable read-only memory (EEPROM).
[0064] The I / O module 150 can receive commands or data input by the user via input-output means (e.g., sensors, keyboard, touch screen, etc.), and can transmit the received commands or data to the processor 120 or memory 130 via the bus 110. It is also used to display various information received, stored, and processed from the aforementioned components (e.g., multimedia data, text data), and can display video, images, data, etc., to the user.
[0065] The communication module 170 can be configured to communicate with other devices for signaling or data.
[0066] It is understood that the structure shown in Figure 1 is only a schematic diagram of the electronic device 100, and the electronic device 100 may include more or fewer components than shown in Figure 1, or have a different configuration than shown in Figure 1. The components shown in Figure 1 may be implemented using hardware, software, or a combination thereof.
[0067] The above-mentioned electronic device 100 will be used as the execution subject to execute the various steps of the various methods provided in the embodiments of this disclosure and achieve the corresponding technical effects.
[0068] Please refer to Figure 2, which is a flowchart illustrating an intelligent dialogue method provided in an embodiment of this disclosure.
[0069] Step S202: During the dialogue with the user, obtain each candidate dialogue node for the next step based on all dialogue nodes in the preset dialogue SOP tree and the current dialogue node.
[0070] In this embodiment, a dialogue SOP tree is pre-set according to the dialogue scenario to define the various dialogue nodes in that scenario. Then, during a dialogue with the user, the next possible dialogue node can be obtained based on all dialogue nodes in the pre-set dialogue SOP tree and the current dialogue node, thus obtaining each candidate dialogue node. For example, the next-level dialogue node after the current dialogue node can be obtained from the dialogue SOP tree, i.e., each candidate dialogue node.
[0071] Optionally, each dialogue node in the dialogue SOP tree can be set according to the preset goal of the dialogue scenario and the path to achieve the goal.
[0072] For example, in a conversation inviting a user to a store for a test drive, the following dialogue nodes might be set up: opening greeting and identifying oneself, asking the user if they are interested in a test drive, introducing store promotions and inviting the user to test drive a particular model, negotiating the time and location for the test drive, reminding the user of relevant test drive information, thanking the user and ending the conversation, etc. It can be understood that each dialogue node in the dialogue SOP tree is an intermediate step related to that dialogue scenario that needs to be confirmed or executed.
[0073] Step S204: All candidate dialogue nodes are used as dialogue constraint information, and the target dialogue node for the next step is determined based on the dialogue SOP tree, dialogue constraint information and historical dialogue information using a preset large language model.
[0074] Step S206: Based on the target dialogue node, use the large language model to generate the next response content and then send the response content back to the user.
[0075] In this embodiment, after obtaining each candidate dialogue node, all candidate dialogue nodes are used as dialogue constraint information. Then, based on the dialogue constraint information, the SOP tree, and historical dialogue information with the user, a preset large language model is used to determine the target dialogue node for the next step. This target dialogue node can be understood as the actual dialogue node to be executed. Next, based on the target dialogue node, the large language model is used to generate the next response content and provide feedback to the user. Each step is executed in a similar manner, thus realizing intelligent dialogue between the large language model and the user.
[0076] This can be understood as follows: the embodiments disclosed herein use all candidate dialogue nodes as constraints for the large language model to engage in dialogue with the user in the next step. Combined with the SOP tree and historical dialogue information, the large language model determines the appropriate dialogue node and generates response content based on the dialogue scenario and context to engage in dialogue with the user. This ensures the controllability and flexibility of the dialogue, improves the fluency and accuracy of the dialogue, and enhances the user experience.
[0077] As can be seen from the above steps, during the dialogue with the user, each candidate dialogue node for the next step is obtained based on all dialogue nodes in the preset dialogue SOP tree and the current dialogue node. Then, all candidate dialogue nodes are used as dialogue constraint information, and based on the dialogue SOP tree, dialogue constraint information, and historical dialogue information, a preset large language model is used to determine the target dialogue node for the next step. Next, based on the target dialogue node, the large language model is used to generate the next response content, and the response content is fed back to the user. By using all candidate nodes as dialogue constraint information, combined with the SOP tree and historical dialogue information, the large language model determines the next dialogue node and generates response content to engage in dialogue with the user, thereby ensuring the controllability and flexibility of the dialogue, improving the fluency and accuracy of the dialogue, and enhancing the user experience.
[0078] Optionally, for step S204, which involves determining the target dialogue node for the next step based on the dialogue SOP tree, dialogue constraint information, and historical dialogue information using a preset large language model, this embodiment of the disclosure provides a possible implementation method, as shown in Figure 3.
[0079] Step S204-1: Generate action acquisition instructions based on the dialogue SOP tree, dialogue constraint information, and historical dialogue information.
[0080] Step S204-2: Input the action acquisition instruction into the large language model, and use the large language model to generate reference dialogue action information.
[0081] Step S204-3: Match the dialogue action information of each candidate dialogue node with the reference dialogue action information.
[0082] Step S204-4: If there is a candidate dialogue node that matches the reference dialogue action information, then the candidate dialogue node is taken as the target dialogue node.
[0083] Step S204-5: If there is no candidate dialogue node that matches the reference dialogue action information, then a temporary dialogue node and its dialogue action information are generated using the large language model, and the temporary dialogue node is used as the target dialogue node; wherein, the dialogue action information of the temporary dialogue node indicates that the dialogue is guided to the dialogue node in the dialogue SOP tree.
[0084] In one possible implementation, the dialogue SOP tree, dialogue constraints, historical dialogue information, the current SOP node, and the ultimate goal are used as background information for the large language model's instructions, allowing the large language model to generate a suitable next dialogue node. Simultaneously, during the large language model's decoding process, subsequent nodes of the current node are used as decoding results for batch decoding. If the decoding result of any node has a similarity higher than a preset threshold, that node is used as the next dialogue node. If no node's decoding result has a similarity higher than the preset threshold, the dialogue node generated by the large language model is used as the target dialogue node; this node is then called a "temporary dialogue node."
[0085] This temporary dialogue node can be understood as an intermediate node where temporary dialogues and guidance take place, leading the dialogue to an existing node in the dialogue SOP tree that facilitates achieving the final goal.
[0086] In this embodiment, each dialogue node in the dialogue SOP tree contains dialogue action information, which can be understood as the action that the dialogue node is to perform.
[0087] To facilitate understanding, the following example illustrates a dialogue scenario where a user is invited to a store for a test drive. The dialogue nodes and dialogue action information in the dialogue SOP tree for this scenario are shown in the table below.
[0088] It should be understood that the above dialogue scenarios and the contents of the table above are merely examples. The dialogue scenarios and dialogue SOP trees can be set according to actual circumstances, and this disclosure embodiment is not limited in this regard.
[0089] For example, assuming the current dialogue node is dialogue node 3, its next-level dialogue nodes, namely dialogue nodes 4-1 and 4-2, are selected as candidate dialogue nodes, and dialogue nodes 4-1 and 4-2 are used as dialogue constraint information. Then, the dialogue SOP tree, dialogue constraint information, historical dialogue information, and preset action generation rules are concatenated to obtain the action acquisition instruction.
[0090] Next, the action acquisition instruction is input to the large language model so that the large language model can generate the dialogue action it believes should be executed next based on the dialogue SOP tree, the dialogue constraint information (dialogue nodes 4-1 and 4-2), and the dialogue content of historical dialogue nodes 1 to 3, and output reference dialogue action information.
[0091] Next, the dialogue action information of dialogue nodes 4-1 and 4-2 is matched with the reference dialogue action information to determine whether there is a candidate dialogue node that matches the reference dialogue action information. If it does, it means that the current dialogue follows the dialogue SOP tree, and the matching candidate dialogue node is taken as the target dialogue node. If it does not, it means that the current dialogue has deviated from the dialogue SOP tree, and a temporary dialogue node and its dialogue action information are generated using the large language model. The temporary dialogue node is taken as the target dialogue node, and the dialogue action information indicates that the dialogue should be guided to a dialogue node in the dialogue SOP tree.
[0092] In one possible implementation, the dialogue SOP tree, dialogue constraint information, historical dialogue information, the current SOP node, and the final goal can be used as background information for the large language model's instructions, allowing the large language model to generate a suitable next dialogue node.
[0093] Meanwhile, during the decoding and generation process of the large language model, the two nodes "Dialogue Node 4-1: Negotiating the time for the user to test drive Model A" and "Dialogue Node 4-2: Negotiating the time for the user to test drive Model B" are used as decoding results. The large language model is used for batch decoding. If the similarity of the decoding result of a certain node is higher than the preset threshold, then the node is used as the next dialogue node. If the similarity of the decoding result of no node is higher than the preset threshold, then the dialogue node generated by the large language model is used as the target dialogue node. At this time, the node is called the "temporary dialogue node".
[0094] For example, if a user asks whether there are other car models besides A and B available for test drives, the decoding results of the two nodes, "Dialogue Node 4-1: Negotiating the time for the user to test drive car A" and "Dialogue Node 4-2: Negotiating the time for the user to test drive car B," will both have a similarity below the threshold. In this case, the large language model will generate a temporary dialogue node word by word. This node, generated autonomously by the large language model, should be "introducing test drive information for other car models." Then, this temporary dialogue node will be used as the current dialogue node, and dialogue actions will be generated. That is, the large language model will use the test drive information of other car models to generate specific replies and inquiry scripts.
[0095] If the user still indicates interest in car model A, then the decoding result of the "Dialogue Node 4-1: Negotiating the User's Test Drive Time for Car Model A" node in the next selection node of the large language model will have a similarity higher than the preset threshold. At this point, the node can be used as the next dialogue node, indicating that the dialogue has returned to the SOP tree.
[0096] In addition, if the user has any needs or questions during the conversation that cause the conversation to deviate from the conversation SOP tree, a temporary conversation node will be generated to temporarily respond to the user's needs or questions. At the same time, the conversation will be guided to a node in the conversation SOP tree to continue the subsequent conversation.
[0097] It can be understood that the embodiments of this disclosure match the reference dialogue action information generated by the large language model with the dialogue action information of the candidate dialogue nodes to determine whether the dialogue has left the dialogue SOP tree. If the dialogue has left the dialogue SOP tree, the dialogue is guided back to the dialogue SOP tree by generating a temporary dialogue node and its dialogue action information, thereby ensuring the controllability and flexibility of the dialogue.
[0098] Optionally, for step S204-3, this disclosure provides a possible implementation method.
[0099] Step S204-3-1: Calculate the similarity between the dialogue action information of each candidate dialogue node and the reference dialogue action information to obtain the similarity corresponding to each candidate dialogue node.
[0100] Step S204-3-2: If there are candidate dialogue nodes whose similarity reaches the preset first threshold, then the candidate dialogue node corresponding to the maximum similarity is taken as the candidate dialogue node that matches the reference dialogue action information.
[0101] Step S204-3-3: If there is no candidate dialogue node whose similarity reaches the first threshold, then it is determined that there is no candidate dialogue node that matches the reference dialogue action information.
[0102] To facilitate understanding, let's continue with the example above. For instance, in one implementation, suppose the user's reply to dialogue node 3 is about car model A, and the reference dialogue action information output by the large language model is: confirming the user's information about test driving car model A. Then, we calculate the similarity between this reference dialogue action information and the dialogue action information of dialogue nodes 4-1 and 4-2, respectively, to obtain the corresponding similarity scores for dialogue nodes 4-1 and 4-2.
[0103] Then, the similarity scores corresponding to dialogue nodes 4-1 and 4-2 are compared with a preset first threshold. If only one dialogue node's similarity score reaches the first threshold, then that candidate dialogue node is selected as a candidate dialogue node to match the reference dialogue action information. For example, if car model A is Tesla and car model B is Xiaomi, and after similarity calculation, only dialogue node 4-1's similarity score reaches the first threshold, then dialogue node 4-1 is selected as a candidate dialogue node for matching.
[0104] If multiple dialogue nodes have similarity scores that reach the first threshold, then the candidate dialogue node with the highest similarity score is selected as the candidate dialogue node for matching the reference dialogue action information. For example, if vehicle type A is Tesla Model X and vehicle type B is Tesla Model Y, and after similarity calculation, the similarity scores of dialogue nodes 4-1 and 4-2 both reach the first threshold, and the similarity score of dialogue node 4-1 is greater than that of dialogue node 4-2, then dialogue node 4-1 is selected as the candidate dialogue node for matching.
[0105] In another implementation, suppose the user's reply to dialogue node 3 is about car model C, and the reference dialogue action information output by the large language model is: confirming the user's information about test driving car model C. Then, the similarity between this reference dialogue action information and the dialogue action information of dialogue nodes 4-1 and 4-2 is calculated to obtain the corresponding similarity scores for dialogue nodes 4-1 and 4-2 respectively.
[0106] Then, the similarity scores corresponding to dialogue nodes 4-1 and 4-2 are compared with a preset first threshold. If the similarity scores of all candidate dialogue nodes do not reach the first threshold, it is determined that there are no candidate dialogue nodes matching the reference dialogue action information. For example, if car model A is Tesla, car model B is Xiaomi, and car model C is NIO, and after similarity calculation, the similarity scores of dialogue nodes 4-1 and 4-2 do not reach the first threshold, then it is determined that there are no matching candidate dialogue nodes.
[0107] It is understandable that large language models output text by outputting tokens, i.e. characters, one by one. Therefore, based on the tokens output by the large language model, the similarity between the output tokens and the dialogue action information of each candidate dialogue node can be calculated in real time, so as to obtain the similarity between the reference dialogue action information and the dialogue action information of each candidate dialogue node.
[0108] Optionally, for step S206, this disclosure provides a possible implementation method.
[0109] Step S206-a1: If the target dialogue node is a temporary dialogue node, generate the first dialogue acquisition instruction based on the dialogue action information of the temporary dialogue node.
[0110] In step S206-a2, the first dialogue acquisition instruction is input into the large language model, and the large language model is used to generate a guiding dialogue, which is then used as the response content for the next step.
[0111] To facilitate understanding, let's continue with the example above. For instance, if the user's reply to dialogue node 3 is "C model," and there is no candidate dialogue node that matches the reference dialogue action information output by the large language model, then the temporary dialogue node generated by the large language model will be used as the target dialogue node.
[0112] When the target dialogue node is a temporary dialogue node, the dialogue action information of the temporary dialogue node is concatenated with the preset first dialogue generation rule to obtain the first dialogue acquisition instruction. This first dialogue acquisition instruction is then input into the large language model to generate a guiding dialogue. This guiding dialogue is then used as the response content for the next step and fed back to the user, allowing the dialogue to return to the dialogue SOP tree.
[0113] Optionally, the dialogue SOP tree, dialogue constraints, historical dialogue information, the current SOP node, and the ultimate goal can be used as background information for the large language model's instructions, with the temporary dialogue node serving as the target of the current response, allowing the large language model to generate an appropriate reply. Furthermore, previous SOP nodes and neighboring nodes can be provided as target nodes for guiding dialogue, allowing the large language model to generate an appropriate reply that guides the user back to a specific node. Both parts are generated autonomously by the large language model based on the background information.
[0114] For example, the large language model can generate prompts explaining that only models A and B have special offers and recommend test drives of these two models, thus guiding the conversation to dialogue node 3. The large language model can also generate prompts explaining that model A or model B has advantages over model C, thus guiding the conversation to dialogue node 4-1 or dialogue node 4-2.
[0115] Optionally, for step S206, this disclosure also provides a possible implementation.
[0116] Step S206-b1: If the target dialogue node is a candidate dialogue node, obtain each standard dialogue of the candidate dialogue node to obtain each candidate dialogue.
[0117] Step S206-b2: All candidate dialogues are used as dialogue constraint information, and a second dialogue acquisition instruction is generated based on the dialogue constraint information.
[0118] Step S206-b3: Input the second speech acquisition instruction into the large language model and use the large language model to generate the target speech.
[0119] Step S206-b4: Select the response content for the next step from the target message and all candidate messages.
[0120] In this embodiment, each dialogue node in the dialogue SOP tree also contains multiple standard dialogue scripts.
[0121] To facilitate understanding, let's continue with the example above. For instance, if the user's reply to dialogue node 3 is "model A", then dialogue node 4-1 is a candidate dialogue node that matches the reference dialogue action information, and dialogue node 4-1 is chosen as the target dialogue node.
[0122] When the target dialogue node is a candidate dialogue node (dialogue node 4-1), each standard dialogue word of dialogue node 4-1 is obtained, resulting in each candidate dialogue word. Then, all candidate dialogue words are used as dialogue constraint information, and this information is concatenated with a preset second dialogue word generation rule to obtain a second dialogue word retrieval instruction. This second dialogue word retrieval instruction is then input into the large language model, causing it to generate the target dialogue word based on these candidate dialogue words. Finally, the next response content is selected from the target dialogue word and all candidate dialogue words.
[0123] In some embodiments, the second dialogue acquisition instruction can be input into the large language model. During the process of decoding and generating dialogue in the large language model, all candidate dialogues are used as the decoding results. The large language model is used for batch decoding. If the similarity of the decoding result of a candidate dialogue is higher than the preset threshold, the candidate dialogue is considered to meet the set standard, that is, the target dialogue matches the dialogue action information of dialogue node 4-1. Then, the candidate dialogue is used as the next response content to be fed back to the user. If the similarity of the decoding result of no candidate dialogue is higher than the preset threshold, the candidate dialogue with the highest similarity is used as the next response content to be fed back to the user.
[0124] This can be understood as follows: the embodiments disclosed herein use all the standard utterances of the matched candidate dialogue nodes as utterance constraint information to guide the large language model to generate similar utterances. This avoids model illusion and improves the accuracy and fluency of the dialogue.
[0125] Optionally, in step S206-b4, this embodiment of the present disclosure provides a possible implementation.
[0126] Step S206-b4-1: Calculate the similarity between the target message and each candidate message.
[0127] Step S206-b4-2: If the similarity between the target message and at least one candidate message reaches a preset second threshold, then the target message is used as the response content for the next step.
[0128] Step S206-b4-3: If the similarity between the target message and all candidate messages does not reach the second threshold, then the candidate message with the highest similarity will be used as the response content for the next step.
[0129] To facilitate understanding, let's continue with the example above. For instance, suppose dialogue node 4-1 contains three standard phrases, resulting in three candidate phrases. Then, we calculate the similarity between the target phrase and each of these three candidate phrases.
[0130] If the similarity between the target message and at least one candidate message reaches the preset second threshold, it means that the target message meets the set standard, that is, the target message matches the dialogue action information of dialogue node 4-1. Then the target message will be used as the next response content to be fed back to the user.
[0131] If the similarity between the target message and all candidate messages does not reach the second threshold, it means that the target message does not meet the set standard, that is, the target message does not match the dialogue action information of dialogue node 4-1. In this case, the candidate message with the highest similarity will be used as the next response content to be fed back to the user.
[0132] This disclosure can be understood as follows: by calculating the similarity between the speech generated by the large language model and the standard speech, the response content is selected, thereby further avoiding model illusion and improving the accuracy and fluency of the dialogue.
[0133] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of an intelligent dialogue device is given below. Please refer to Figure 4, which is a functional block diagram of the intelligent dialogue device provided in this embodiment. It should be noted that the intelligent dialogue device 300 provided in this embodiment has the same basic principle and technical effects as the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The intelligent dialogue device 300 includes:
[0134] The dialogue planning module 310 is configured to obtain each candidate dialogue node for the next step based on all dialogue nodes in the preset dialogue SOP tree and the current dialogue node during the dialogue with the user; use all candidate dialogue nodes as dialogue constraint information; and determine the target dialogue node for the next step based on the dialogue SOP tree, dialogue constraint information and historical dialogue information using a preset large language model.
[0135] The dialogue generation module 330 is configured to generate the next response content based on the target dialogue node using a large language model, and then feed the response content back to the user.
[0136] Optionally, the dialogue planning module 310 is further configured to: generate action acquisition instructions based on the dialogue SOP tree, dialogue constraint information, and historical dialogue information; input the action acquisition instructions into a large language model and use the large language model to generate reference dialogue action information; match the dialogue action information of each candidate dialogue node with the reference dialogue action information; if there is a candidate dialogue node that matches the reference dialogue action information, then the candidate dialogue node is used as the target dialogue node; if there is no candidate dialogue node that matches the reference dialogue action information, then a temporary dialogue node and its dialogue action information are generated using the large language model, and the temporary dialogue node is used as the target dialogue node; wherein, the dialogue action information of the temporary dialogue node indicates that the dialogue is guided to the dialogue node in the dialogue SOP tree.
[0137] Optionally, the dialogue planning module 310 is further configured to: calculate the similarity between the dialogue action information of each candidate dialogue node and the reference dialogue action information to obtain the similarity corresponding to each candidate dialogue node; if there is a candidate dialogue node whose similarity reaches a preset first threshold, then the candidate dialogue node corresponding to the maximum similarity is taken as the candidate dialogue node that matches the reference dialogue action information; if there is no candidate dialogue node whose similarity reaches the first threshold, then it is determined that there is no candidate dialogue node that matches the reference dialogue action information.
[0138] Optionally, the dialogue generation module 330 is further configured to: generate a first dialogue acquisition instruction based on the dialogue action information of the temporary dialogue node when the target dialogue node is a temporary dialogue node; input the first dialogue acquisition instruction into the large language model, generate a guiding dialogue using the large language model, and use the guiding dialogue as the response content for the next step.
[0139] Optionally, the dialogue generation module 330 is further configured to: when the target dialogue node is a candidate dialogue node, obtain each standard dialogue word of the candidate dialogue node to obtain each candidate dialogue word; use all candidate dialogue words as dialogue constraint information, and generate a second dialogue word acquisition instruction based on the dialogue constraint information; input the second dialogue word acquisition instruction into the large language model, and use the large language model to generate the target dialogue word; and select the response content for the next step from the target dialogue word and all candidate dialogue words.
[0140] Optionally, the dialogue generation module 330 is further configured to: calculate the similarity between the target dialogue and each candidate dialogue; if the similarity between the target dialogue and at least one candidate dialogue reaches a preset second threshold, then the target dialogue is used as the response content for the next step; if the similarity between the target dialogue and all candidate dialogues does not reach the second threshold, then the candidate dialogue with the highest similarity is used as the response content for the next step.
[0141] This disclosure also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the intelligent dialogue method disclosed in this disclosure.
[0142] This disclosure also provides a storage medium storing a computer program that, when executed by a processor, implements the intelligent dialogue method disclosed in this disclosure.
[0143] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0144] In addition, the functional modules in the various embodiments of this disclosure can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0145] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0146] The above description is merely a preferred embodiment of this disclosure and is not intended to limit this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure. Industrial applicability
[0147] By adopting the above approach and using a large language model to generate the next response, the controllability and flexibility of the dialogue are ensured, the fluency and accuracy of the dialogue are improved, and the user experience is enhanced.
Claims
1. An intelligent dialogue method, characterized in that, The intelligent dialogue method includes: During a conversation with a user, each candidate conversation node for the next step is obtained based on all conversation nodes in the preset conversation SOP tree and the current conversation node. All candidate dialogue nodes are used as dialogue constraint information, and the target dialogue node for the next step is determined based on the dialogue SOP tree, the dialogue constraint information and historical dialogue information using a preset large language model. Based on the target dialogue node, the large language model is used to generate the next response content, and the response content is fed back to the user.
2. The intelligent dialogue method according to claim 1, characterized in that, The step of obtaining each candidate dialogue node for the next step based on all dialogue nodes in the preset dialogue SOP tree and the current dialogue node includes: Obtain the next-level dialogue node from all dialogue nodes to obtain each candidate dialogue node for the next step.
3. The intelligent dialogue method according to claim 1 or 2, characterized in that, Each dialogue node contains dialogue action information; the dialogue action information is used to indicate the action that the dialogue node is to perform. The step of determining the next target dialogue node based on the dialogue SOP tree, the dialogue constraint information, and historical dialogue information using a preset large language model includes: Based on the dialogue SOP tree, the dialogue constraint information, and the historical dialogue information, an action acquisition instruction is generated. The action acquisition instruction is input into the large language model, and reference dialogue action information is generated using the large language model; The dialogue action information of each candidate dialogue node is matched with the reference dialogue action information; If there is a candidate dialogue node that matches the reference dialogue action information, then the candidate dialogue node is taken as the target dialogue node. If no candidate dialogue node matches the reference dialogue action information, a temporary dialogue node and its dialogue action information are generated using the large language model, and the temporary dialogue node is used as the target dialogue node; wherein, the dialogue action information of the temporary dialogue node indicates that the dialogue is guided to the dialogue node in the dialogue SOP tree.
4. The intelligent dialogue method according to claim 3, characterized in that, The step of generating an action acquisition instruction based on the dialogue SOP tree, the dialogue constraint information, and the historical dialogue information includes: The dialogue SOP tree, the dialogue constraint information, the historical dialogue information, and the preset action generation rules are concatenated to obtain the action acquisition instruction.
5. The intelligent dialogue method according to claim 3 or 4, characterized in that, The step of matching the dialogue action information of each candidate dialogue node with the reference dialogue action information includes: Calculate the similarity between the dialogue action information of each candidate dialogue node and the reference dialogue action information to obtain the similarity corresponding to each candidate dialogue node; If there are candidate dialogue nodes whose similarity reaches a preset first threshold, then the candidate dialogue node with the highest similarity will be used as the candidate dialogue node that matches the reference dialogue action information. If there is no candidate dialogue node whose similarity reaches the first threshold, it is determined that there is no candidate dialogue node that matches the reference dialogue action information.
6. The intelligent dialogue method according to claim 5, characterized in that, The step of selecting the candidate dialogue node with the highest similarity as the candidate dialogue node matching the reference dialogue action information if a candidate dialogue node with a similarity reaching a preset first threshold includes: If a candidate dialogue node has a similarity that reaches the first threshold, then the candidate dialogue node is used as a candidate dialogue node that matches the reference dialogue action information. If multiple candidate dialogue nodes have a similarity that reaches the first threshold, then the candidate dialogue node with the highest similarity is selected as the candidate dialogue node that matches the reference dialogue action information.
7. The intelligent dialogue method according to any one of claims 1-6, characterized in that, The step of generating the next response content based on the target dialogue node using the large language model includes: If the target dialogue node is a temporary dialogue node, a first script acquisition instruction is generated based on the dialogue action information of the temporary dialogue node. The first script acquisition instruction is input into the large language model, and the large language model is used to generate a guiding script, which is then used as the response content for the next step.
8. The intelligent dialogue method according to claim 7, characterized in that, The step of inputting the first dialogue acquisition instruction into the large language model, generating a guiding dialogue using the large language model, and using the guiding dialogue as the response content for the next step includes: If the target dialogue node is a candidate dialogue node, the large language model generates guiding dialogue based on the standard dialogue of the target dialogue node, and uses the guiding dialogue as the response content for the next step. If the target dialogue node is a temporary dialogue node, the large language model generates guiding remarks based on the neighboring nodes of the target dialogue node, and uses the guiding remarks as the response content for the next step.
9. The intelligent dialogue method according to claim 8, characterized in that, The step of generating a first dialogue acquisition instruction based on the dialogue action information of the temporary dialogue node includes: The dialogue action information of the temporary dialogue node is concatenated with the preset first dialogue generation rule to obtain the first dialogue acquisition instruction.
10. The intelligent dialogue method according to any one of claims 1-9, characterized in that, Each dialogue node also includes several standard scripts; The step of generating the next response content based on the target dialogue node using the large language model includes: If the target dialogue node is a candidate dialogue node, obtain each standard dialogue of the candidate dialogue node to obtain each candidate dialogue. All candidate dialogues are used as dialogue constraint information, and a second dialogue acquisition instruction is generated based on the dialogue constraint information. The second script acquisition instruction is input into the large language model, and the target script is generated using the large language model; Select the next response from the target response and all candidate responses.
11. The intelligent dialogue method according to claim 10, characterized in that, The step of selecting the next response content from the target script and all candidate scripts includes: Calculate the similarity between the target speech and each of the candidate speech; If the similarity between the target message and at least one of the candidate messages reaches a preset second threshold, then the target message will be used as the response content for the next step. If the similarity between the target message and all candidate messages does not reach the second threshold, then the candidate message with the highest similarity will be used as the response content for the next step.
12. The intelligent dialogue method according to any one of claims 1-11, characterized in that, The process of creating the preset dialog SOP tree is as follows: Based on the preset goals of the dialogue scenario and the path to achieve those goals, set up each dialogue node in the dialogue SOP tree. Based on each dialogue node, the preset dialogue SOP tree is generated.
13. The intelligent dialogue method according to any one of claims 1-12, characterized in that, The process of creating the preset dialog SOP tree is as follows: Large language models are used to generate simulated dialogue data in batches in dialogue scenarios; Identify the dialogue branch node; Based on the simulated dialogue data and the dialogue branch nodes, the preset dialogue SOP tree is generated.
14. An intelligent dialogue device, characterized in that, The intelligent dialogue device includes: The dialogue planning module is configured to obtain each candidate dialogue node for the next step based on all dialogue nodes in the preset dialogue SOP tree and the current dialogue node during a dialogue with the user. All candidate dialogue nodes are used as dialogue constraint information, and the target dialogue node for the next step is determined based on the dialogue SOP tree, the dialogue constraint information and historical dialogue information using a preset large language model. The dialogue generation module is configured to generate the next response content based on the target dialogue node using the large language model, and then feed the response content back to the user.
15. The intelligent dialogue device according to claim 14, characterized in that, Each dialogue node contains dialogue action information, which indicates the action to be performed by the dialogue node; the dialogue planning module is also configured to: Based on the dialogue SOP tree, the dialogue constraint information, and the historical dialogue information, an action acquisition instruction is generated. The action acquisition instruction is input into the large language model, and reference dialogue action information is generated using the large language model; The dialogue action information of each candidate dialogue node is matched with the reference dialogue action information; If there is a candidate dialogue node that matches the reference dialogue action information, then the candidate dialogue node is taken as the target dialogue node. If no candidate dialogue node matches the reference dialogue action information, a temporary dialogue node and its dialogue action information are generated using the large language model; wherein, the dialogue action information of the temporary dialogue node indicates that the dialogue will be guided to the dialogue node in the dialogue SOP tree.
16. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a computer program, and when the processor executes the computer program, it implements the intelligent dialogue method according to any one of claims 1-13.
17. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the intelligent dialogue method according to any one of claims 1-13.