Session content generation method and device, equipment, storage medium and program product

By interacting with users to obtain pre-prompt words and update the knowledge base, it solves the accuracy problem caused by training data deviation in large language model conversation generation tasks, improves the accuracy and personalization of conversation responses, and ensures the quality and relevance of generated content. sex.

CN118797003APending Publication Date: 2024-10-18CHINA CONSTRUCTION BANK +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410824852.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In conversation generation tasks, large language models produce text content that is less accurate due to biased or outdated training data, and lacks deep expertise and judgment.

Method used

It obtains pre-prompt words through multiple interactions with the user, generates prompt words that are more suitable for the user's conversational style, and uses the updated knowledge base to process these prompt words in the large language model to ensure the accuracy and personalization of the conversation response results.

Benefits of technology

It improves the accuracy and personalization of conversation response results, ensures that the generated content meets the actual needs and personalized habits of users, and enhances the relevance and reliability of conversations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118797003A_ABST
    Figure CN118797003A_ABST
Patent Text Reader

Abstract

The invention relates to the field of artificial intelligence, and particularly discloses a session content generation method and device, computer equipment, a readable storage medium and a program product. The method comprises: in response to a session request of a target user, obtaining a session cue word of the session request and a pre-cue word of the target user, the session cue word comprising target session knowledge; and then, under the condition that the target session knowledge is not in the session knowledge base of the large language model, generating an updated knowledge base according to the application program interface of the target session knowledge and the session knowledge base, and processing the preposed cue word and the session request cue word based on the updated knowledge base to obtain a session response result. Wherein the preposed cue word is obtained according to a plurality of different types of session information preset for the target user. By adopting the method, the accuracy of the text content generated by the large language model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a conversation content generation method, apparatus, computer equipment, readable storage medium and program product. Background Art

[0002] In the field of deep learning, Large Language Models (LLM) are deep learning models trained based on massive text data. They are used to perform various natural language tasks and generate natural language text, such as text summary extraction tasks, conversation generation tasks, and so on.

[0003] Taking the large language model performing the conversation generation task as an example, in the related art, the large language model relies on training data to characterize the conversation generation logic, and parses the input conversation based on the conversation generation logic to output the conversation response. In this case, once the training data of the large language model is biased or distorted, it may cause the conversation generation logic of the large language model to be inaccurate or outdated, which in turn leads to low accuracy of the text content generated by the large language model. Summary of the invention

[0004] Based on this, it is necessary to provide a conversation content generation method, device, computer equipment, readable storage medium and program product to address the above technical problems, so as to improve the accuracy of text content generated by large language models.

[0005] In a first aspect, the present application provides a method for generating conversation content, comprising:

[0006] In response to a conversation request from a target user, a conversation prompt word of the conversation request and a pre-prompt word of the target user are obtained; the pre-prompt word is obtained according to a plurality of different types of conversation information preset for the target user; the conversation prompt word includes target conversation knowledge;

[0007] In the case where the target conversation knowledge is not in the conversation knowledge base of the large language model, generating an updated knowledge base according to the application program interface of the target conversation knowledge and the conversation knowledge base;

[0008] The preceding prompt word and the conversation request prompt word are processed based on the updated knowledge base to obtain a conversation response result.

[0009] In one embodiment, the conversation information includes conversation questions and conversation results, and obtaining the pre-prompt words of the target user includes:

[0010] Display multiple session questions;

[0011] receiving the session results input by the target user for each session question;

[0012] Generate pre-prompt words based on each conversation question and the conversation result of each conversation question.

[0013] In one embodiment, according to each conversation question and the conversation result of each conversation question, a pre-prompt word is generated, including:

[0014] For any conversation question, generate supplementary prompt words based on the conversation question and the conversation result;

[0015] Determine the pre-prompt words based on the supplementary prompt words for each conversation question and the language of the conversation results.

[0016] In one embodiment, the pre-prompt word is determined according to the supplementary prompt word of each conversation question and the language of the conversation result, including:

[0017] According to the language of the conversation result, obtain the cultural background conversation habits corresponding to the language;

[0018] According to the cultural background conversation habits, the supplementary prompt words of each conversation question are added to the preset system prompt words to obtain the pre-prompt words.

[0019] In one embodiment, the large language model includes a prompt word generation module; obtaining the pre-prompt word of the target user includes:

[0020] A plurality of different types of conversation information are input into a prompt word generation module in a large language model, and a pre-prompt word is output through the prompt word generation module.

[0021] In one embodiment, the method further comprises:

[0022] If the target conversation knowledge is in the conversation knowledge base of the large language model, the preceding prompt word and the conversation request prompt word are input into the large language model to obtain a candidate conversation response result;

[0023] Performing authenticity check on candidate conversation response results;

[0024] The session response result is determined according to the verification result of the candidate session response result.

[0025] In one embodiment, verifying the authenticity of the candidate session response result includes:

[0026] Matching the candidate conversation response result with the content in the preset standard information database to obtain the matching degree of the candidate conversation response result;

[0027] If the matching degree is greater than or equal to the preset matching degree threshold, the test result of the candidate session response result is determined to be passed;

[0028] If the matching degree is less than the matching degree threshold, it is determined that the inspection result of the candidate session response result is inspection failure.

[0029] In one embodiment, determining the session response result according to the verification result of the candidate session response result includes:

[0030] If the test result is that the test passes, the candidate session response result is determined as the session response result;

[0031] If the test result is that the test fails, the large language model is called again to generate a new candidate conversation response result, and the authenticity check is performed on the new candidate conversation response result, and the process is executed in a loop until a conversation response result that passes the authenticity check is generated.

[0032] In a second aspect, the present application further provides a conversation content generating device, comprising:

[0033] A request response module, used to respond to a conversation request from a target user, obtain a conversation prompt word of the conversation request and a pre-prompt word of the target user; the pre-prompt word is obtained according to a plurality of different types of conversation information preset for the target user; the conversation prompt word includes target conversation knowledge;

[0034] A knowledge updating module, for generating an updated knowledge base according to an application program interface of the target conversation knowledge and the conversation knowledge base, when the target conversation knowledge is not in the conversation knowledge base of the large language model;

[0035] The result generation module is used to process the pre-prompt word and the conversation request prompt word based on the updated knowledge base to obtain a conversation response result.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.

[0037] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect above.

[0038] The above-mentioned conversation content generation method, device, computer equipment, readable storage medium and program product, in response to the conversation request of the target user, obtain the conversation prompt words of the conversation request and the pre-prompt words of the target user, and the conversation prompt words include the target conversation knowledge. Then, in the case where the target conversation knowledge is not in the conversation knowledge base of the large language model, an updated knowledge base is generated according to the application program interface and the conversation knowledge base of the target conversation knowledge, and the pre-prompt words and conversation request prompt words are processed based on the updated knowledge base to obtain the conversation response result. Among them, the pre-prompt words are obtained according to multiple different types of conversation information preset for the target user. In this method, in response to the conversation request of the target user, the conversation prompt words in the conversation request are obtained to confirm the actual conversation needs of the target user and the target conversation knowledge. In addition, using the preset multiple different types of conversation information, multiple conversations are conducted with the target user to obtain pre-prompt words to characterize the conversation attribute information such as the conversation style, tone, type, etc. of the target user. On this basis, it is determined whether the conversation knowledge base of the large language model includes the target conversation knowledge, and if the target conversation knowledge is not in the conversation knowledge base of the large language model, the conversation information corresponding to the application interface and the conversation knowledge base of the large language model are merged and updated to obtain an updated knowledge base, so that the updated knowledge base has the ability to perform conversation processing on the target conversation knowledge. Further, based on the updated knowledge base, the pre-prompt words and conversation request prompt words are processed, so that the conversation response results generated are more in line with the personalized conversation habits of the target user, and the accuracy of the conversation response results is improved. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0040] Figure 1 is an internal structure diagram of a computer device in one embodiment;

[0041] Figure 2 A schematic diagram of a flow chart of a method for generating conversation content in one embodiment;

[0042] Figure 3 A schematic diagram of a flow chart of a pre-prompt word generation step in one embodiment;

[0043] Figure 4 A schematic diagram of a flow chart of a step of generating a pre-prompt word in another embodiment;

[0044] Figure 5A schematic diagram of a flow chart of a step of generating a pre-prompt word in another embodiment;

[0045] Figure 6 A flowchart of a step for determining a session response result in one embodiment;

[0046] Figure 7 It is a flowchart of a candidate session response result verification step in one embodiment;

[0047] Figure 8 It is a flowchart of a method for generating conversation content in another embodiment;

[0048] Fig. 9 It is a structural block diagram of a conversation content generating device in one embodiment. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, groups, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0050] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with relevant provisions of national laws and regulations.

[0051] The conversation content generation method provided in the embodiment of the present application can be applied to a computer device, which can be a terminal. The internal structure diagram thereof can be as follows: Figure 1As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for generating conversation content is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0052] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0053] Deploy a large language model on a computer device, perform natural language processing tasks by calling the large language model, and output natural language processing results.

[0054] Taking the large language model performing the conversation generation task as an example, in the related art, the large language model relies on training data to characterize the conversation generation logic, and parses the input conversation based on the conversation generation logic to output the conversation response. In this case, once the training data of the large language model is biased or distorted, it may cause the conversation generation logic of the large language model to be inaccurate or outdated, resulting in the lack of deep expertise, experience and good judgment of the large language model, and reliable stability results, which may affect the accuracy of the generated content.

[0055] Based on this, the present application provides a method for generating conversation content, which obtains pre-prompt words that are more appropriate to the user's conversation style through multiple pre-interactions with the user, and uses a large language model to process the pre-prompt words and conversation prompt words to generate more accurate conversation response results.

[0056] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0057] In an exemplary embodiment, Figure 2 As shown, a method for generating session content is provided, comprising the following steps:

[0058] S201, in response to a conversation request of a target user, obtaining conversation prompt words of the conversation request and pre-prompt words of the target user; the pre-prompt words are obtained according to a plurality of different types of conversation information preset for the target user; the conversation prompt words include target conversation knowledge.

[0059] The conversation request is an instruction triggered by the target user to the computer device based on actual needs, and carries the conversation prompt word input by the target user. In the actual conversation scenario, the conversation prompt word can be one or more discrete words, such as "current", "weather conditions", "Area A", etc., or a continuous sentence, such as "What is the current weather condition in Area A?"

[0060] In addition, conversation prompts represent the target user's real conversation needs in actual conversation scenarios, and usually directly or indirectly include target conversation knowledge, such as in the fields of philosophy, economics, and transportation.

[0061] In one embodiment, the conversation prompt words may be parsed according to a preset algorithm to extract the target conversation knowledge from the conversation prompt words.

[0062] The pre-prompt words are personalized description languages ​​that characterize the target user's conversation habits, conversation style, and conversation topics, and are used to guide the computer device to generate conversation generation logic for conversation response results, so that the conversation habits, conversation style, and conversation topics of the conversation response results are as close as possible to the conversation habits, conversation style, and conversation topics of the conversation request.

[0063] In an embodiment of the present application, before processing a conversation request, multiple conversation interactions are performed with the target user based on multiple preset different types of topics to obtain different types of conversation information fed back by the target user for different topics, and then the target user's pre-prompt words are obtained based on each group of conversation information.

[0064] It should be noted that the topic types that the computer device interacts with different target users are the same. However, due to the differences in the conversation habits of different target users, the conversation information of different target users is not the same, and the resulting pre-prompt words are also different. For the same target user, the conversation habits basically do not change, that is, the conversation information of the same target user is always consistent, which makes the pre-prompt words of the same target user reusable.

[0065] In one scenario, in order to improve the response speed to the session request of the target user, it is possible to interact with multiple target users in advance, generate pre-prompt words of multiple target users, and store the mapping relationship between the target users and the pre-prompt words in the storage memory of the computer device. Then, in the case where the session request carries the user identifier of the target user, the pre-prompt word corresponding to the user identifier can be matched from the storage memory according to the user identifier.

[0066] In another scenario, in response to the conversation request of the target user, multiple interactions are performed with the target user according to multiple preset topics of different types to obtain different types of conversation information, and then the target user's pre-prompt words are obtained based on the conversation information. This real-time acquisition method takes into account the fact that the conversation habits of the same target user may change, and the generated pre-prompt words can accurately characterize the conversation habits of the target user in real time.

[0067] S202: When the target conversation knowledge is not in the conversation knowledge base of the large language model, an updated knowledge base is generated according to the application program interface of the target conversation knowledge and the conversation knowledge base.

[0068] Among them, the large language model is a language processing model trained according to a preset standard information database. In the embodiment of the present application, a conversation knowledge base is deployed in the large language model, and the conversation knowledge base includes conversation knowledge in multiple different fields. However, it should be noted that the conversation knowledge in the conversation knowledge base is obtained based on the historical conversation information or general experience value of the target user, and may be different from the target conversation knowledge in the actual conversation interaction.

[0069] Based on this, for the target conversation knowledge, we first determine whether the target conversation knowledge is in the conversation knowledge base of the large language model. If the target conversation knowledge is not in the conversation knowledge base of the large language model, it means that the large language model at this time lacks data information corresponding to the target conversation knowledge. Then, we use information search to determine the application interface of the target conversation knowledge from the public database, and then obtain the data information corresponding to the target conversation knowledge in the application interface. Then, we merge and update the data information corresponding to the application interface and the conversation knowledge base of the large language model to obtain an updated knowledge base that meets user needs. The updated knowledge base is the basis for generating conversation response results.

[0070] When the conversation knowledge in the large language model does not include the target conversation knowledge, an updated knowledge base is generated by introducing an application program interface of the target conversation knowledge and combining it with the conversation knowledge base in the large language model. This enables the updated knowledge base to have the ability to perform conversation processing on the target conversation knowledge, thereby improving the accuracy of the conversation content generation method.

[0071] In another scenario, if the target conversation knowledge is in the conversation knowledge base of the large language model, it means that the large language model at this time can directly process the target conversation knowledge where the conversation request prompt word is located, and then the pre-prompt word and the conversation request prompt word are processed according to the large language model to obtain the conversation response result. For the steps of obtaining the conversation response result in this scenario, please refer to the following embodiment for details, which will not be repeated here.

[0072] S203: Process the preceding prompt word and the conversation request prompt word based on the updated knowledge base to obtain a conversation response result.

[0073] The updated knowledge base includes the data of the target conversation knowledge in the conversation request prompt words, so it also has the ability to process the conversation request prompt words. Based on this, the updated knowledge base can be called to process the pre-prompt words and the conversation request prompt words, so that the generated candidate conversation response results meet the actual needs of the user.

[0074] In an embodiment of the present application, in response to a conversation request of a target user, a conversation prompt word of the conversation request and a pre-prompt word of the target user are obtained, and the conversation prompt word includes the target conversation knowledge. Then, in the case where the target conversation knowledge is not in the conversation knowledge base of the large language model, an updated knowledge base is generated according to the application program interface of the target conversation knowledge and the conversation knowledge base, and the pre-prompt word and the conversation request prompt word are processed based on the updated knowledge base to obtain a conversation response result. Among them, the pre-prompt word is obtained according to multiple different types of conversation information preset for the target user. In this method, in response to a conversation request of the target user, the conversation prompt word in the conversation request is obtained to confirm the actual conversation needs of the target user and the target conversation knowledge. In addition, using the preset multiple different types of conversation information, multiple conversations are conducted with the target user to obtain the pre-prompt word to characterize the conversation attribute information such as the conversation style, tone, and type of the target user. On this basis, it is determined whether the conversation knowledge base of the large language model includes the target conversation knowledge, and if the target conversation knowledge is not in the conversation knowledge base of the large language model, the conversation information corresponding to the application interface and the conversation knowledge base of the large language model are merged and updated to obtain an updated knowledge base, so that the updated knowledge base has the ability to perform conversation processing on the target conversation knowledge. Further, based on the updated knowledge base, the pre-prompt words and conversation request prompt words are processed, so that the conversation response results generated are more in line with the personalized conversation habits of the target user, and the accuracy of the conversation response results is improved.

[0075] From the above embodiments, it can be seen that the pre-prompt word is an important basis for the large language model to obtain the conversation response result. Therefore, obtaining accurate pre-prompt words is also crucial to the accuracy of the conversation response result. Based on this, the following further describes an implementable method of pre-prompt words through an embodiment.

[0076] In an exemplary embodiment, Figure 3 As shown, the session information includes the session question and the session result, and the pre-prompt words of the target user are obtained, including:

[0077] S301, display multiple conversation questions.

[0078] The conversation questions are multiple pre-set questions used to guide the target user to determine the conversation background of the conversation request, user conversation habits and other conversation attribute information. Each conversation question can be in the form of an objective question (selection question or judgment question) or a subjective question, which is not limited in the embodiment of the present application.

[0079] In terms of the display method of conversation questions, each conversation question is set with a corresponding number, and the conversation questions are displayed in order from small to large conversation numbers.

[0080] In another feasible presentation method, multiple conversation questions are presented to the target user at the same time. In this case, the target user can flexibly and selectively respond to each conversation question according to personal preference.

[0081] S302: receiving the conversation results input by the target user for each conversation question.

[0082] Collect the target user's responses to each conversation question and obtain the conversation results of each conversation question.

[0083] S303: Generate a pre-prompt word according to each conversation question and the conversation result of each conversation question.

[0084] Match multiple conversation questions and multiple conversation results, extract supplementary prompt words for each conversation question and the corresponding conversation result, repeat the above steps until multiple supplementary prompt words for each conversation question and each conversation result are obtained, then associate the multiple supplementary prompt words, or append the multiple supplementary prompt words to a preset system prompt word to generate a pre-prompt word.

[0085] For example: if the supplementary prompt word generated by the first conversation question and the conversation result is "the target user is 5 years old", and the supplementary prompt word generated by the first conversation question and the conversation result is "the target user is male", then the generated pre-prompt word can be: the target user is a 5-year-old boy.

[0086] In an embodiment of the present application, a pre-prompt word is determined based on the conversation results of the target user inputting multiple conversation questions. In the process of generating the pre-prompt word, each display of a conversation question and reception of a corresponding conversation result is equivalent to an evaluation of the conversation habits of the target user. Repeating the above steps multiple times is equivalent to evaluating the conversation habits of the target user from multiple dimensions. The pre-prompt word determined in this way is more in line with the conversation habits of the target user itself, so as to better guide the large language model to generate high-quality conversation response results based on the pre-prompt word in the future.

[0087] The following is a further description of S303 "generating a pre-prompt word according to each conversation question and the conversation result of each conversation question" in the above embodiment. Figure 4 ,include:

[0088] S401, for any conversation question, generating a supplementary prompt word based on the conversation question and the conversation result.

[0089] Extract the question keywords of the conversation question and the result keywords of the conversation result, and merge the question keywords and the result keywords to obtain the supplementary prompt words.

[0090] For example: if the conversation question is "How old are you?" and the conversation result is "5", then "age" is extracted as the question keyword and "5" is extracted as the result keyword, and then the two are merged to generate the supplementary prompt word "The target user's age is 5 years old."

[0091] If the conversation question is "Is the gender male or female" and the conversation result is "male", then "gender" is extracted as the question keyword and "male" is extracted as the result keyword, and then the two are merged to generate the supplementary prompt word "the target user is male".

[0092] S402, determining the pre-prompt word according to the supplementary prompt word of each conversation question and the language of the conversation result.

[0093] Due to the language habits of the target users, the conversation results can be input in Chinese, English, Arabic, etc. Further, when the language of the conversation results is determined, the language of each supplementary prompt word can be uniformly converted into a language corresponding to the language of the conversation results, and the supplementary prompt words after language conversion are superimposed to obtain the pre-prompt word.

[0094] In the embodiment of the present application, based on the supplementary prompt words generated by the conversation questions and the conversation results, and the language of the conversation results, the language of the supplementary prompt words is converted, and the converted supplementary prompt words are used to determine the language of the front prompt words, which is equivalent to adjusting the language of the front prompt words according to the actual conversation language of the target user to be compatible with the target users in different language environments, realize cross-language conversation between the computer device and the target user, and improve the scenario applicability of the entire conversation content generation method.

[0095] Taking into account the relevance of the target user's language environment, cultural background and conversation habits, after obtaining the language of the conversation result, the cultural background and conversation habits corresponding to the language can be further integrated to make the pre-prompt words richer and more comprehensive.

[0096] In an exemplary embodiment, Figure 5 As shown, according to the supplementary prompt words of each conversation question and the language of the conversation result, the pre-prompt words are determined, including:

[0097] S501, according to the language of the conversation result, obtaining the cultural background conversation habits corresponding to the language.

[0098] Based on the language of the conversation results, information search is performed to determine the cultural background corresponding to the language and the conversation habits under the cultural background.

[0099] S502, according to the cultural background conversation habits, the supplementary prompt words of each conversation question are added to the preset system prompt words to obtain the pre-prompt words.

[0100] The system prompt words are the basic conversation generation logic framework, which specifically contains some basic constraints on the conversation response results, such as: sensitive words are not allowed, standardized expressions, etc.

[0101] According to the cultural background conversation habits, the system prompt words and the supplementary prompt words of each conversation question are style-converted, and then the supplementary prompt words after style conversion are appended one by one to the system prompt words after style conversion to obtain the pre-prompt words.

[0102] In the embodiment of the present application, according to the language of the conversation result, the cultural background conversation habits corresponding to the language are obtained, and according to the cultural background conversation habits, the style of each supplementary prompt word and the system prompt word is converted to generate the pre-prompt word. The conversation habits under the cultural background corresponding to different languages ​​are taken into consideration, so that the style of the pre-prompt word is flexibly applicable to different language and cultural environments, thereby improving the usability and effectiveness of the pre-prompt word.

[0103] In the embodiment of the present application, the pre-prompt word can be obtained by other language processing models other than the large language model on the computer device, or can be processed by a submodule built into the large language model. Figure 3 The parallel embodiment of the illustrated embodiment describes another method of generating the pre-prompt word.

[0104] In an exemplary embodiment, the large language model includes a prompt word generation module; obtaining the pre-prompt word of the target user includes:

[0105] A plurality of different types of conversation information are input into a prompt word generation module in a large language model, and a pre-prompt word is output through the prompt word generation module.

[0106] The prompt word generation module is a submodule integrated into the large language model and can be used to perform the above Figure 3 and Figure 5 The method steps of any embodiment shown in the figure are used to generate a pre-prompt word. Figure 3 and Figure 5 The preceding prompt word generation step shown is integrated into the large language model. In this case, the processing process of the prompt word generation model is consistent with the steps and effects in the aforementioned embodiment, and the details can be referred to the aforementioned embodiment, which will not be repeated here.

[0107] In addition, the prompt word generation module can also be trained based on historical session information and historical pre-prompt words of the historical session information. In this case, the prompt word generation module can be understood as a mapping model between session information and pre-prompt words. In this case, the prompt word generation module parses multiple different types of input session information, and outputs pre-prompt words matching the multiple session information according to the mapping logic.

[0108] In the embodiment of the present application, multiple different types of conversation information are input into the prompt word generation module in the large language model, and the pre-prompt word is output through the prompt word generation module, which improves the generation speed of the pre-prompt word and also enriches the generation method of the pre-prompt word.

[0109] The above embodiment describes the method of generating a conversation response result when the conversation knowledge base of a large language model includes target conversation knowledge. Next, the implementation method of how to obtain a conversation response result when the conversation knowledge base of a large language model includes target conversation knowledge is described.

[0110] In an exemplary embodiment, Figure 6 As shown, the pre-trained large language model is used to process the conversation prompt words and the front prompt words to obtain the conversation response results, including:

[0111] S601: If the target conversation knowledge is in the conversation knowledge base of the large language model, the preceding prompt word and the conversation request prompt word are input into the large language model to obtain a candidate conversation response result.

[0112] The large language model is a language processing model trained according to a preset standard information database. The input of the large language model in the embodiment of the present application is the conversation prompt words and the pre-prompt words, and the output is the conversation response result.

[0113] It should be noted that, as a content generation model, the output of the large language model is extremely diverse in expression based on the consistency of the core content. In the embodiment of the present application, the large language model can generate multiple candidate conversation response results with different expressions based on the pre-prompt words and the conversation request prompt words, while the substantive content of the conversation response result remains unchanged, and output a candidate conversation response result.

[0114] Specifically, the large language model can first parse the conversation prompt words according to the model's inherent conversation generation logic to obtain an initial conversation response result, and then fine-tune the initial conversation response result according to the preceding prompt words to obtain a candidate conversation response result.

[0115] S602: Perform authenticity check on the candidate session response result.

[0116] For the candidate conversation response results output by the large language model, the logical facts of the candidate conversation response results are obtained, and the logical facts of the candidate conversation response results are verified according to standard logic or prior knowledge to obtain the authenticity verification result of the candidate conversation response results.

[0117] See also Figure 7 , Figure 7The specific process of verifying the authenticity of the candidate session response result is shown, including:

[0118] S701, matching the candidate conversation response result with the content in a preset standard information database to obtain the matching degree of the candidate conversation response result.

[0119] The standard information database can be a training data set for training the initial large language model, or a database obtained by summarizing known facts and truths. In the embodiment of the present application, the content in the standard information database is used as a standard basis for verifying the authenticity of the candidate conversation response results.

[0120] The standard information database includes multiple groups of different types of standard bases. Based on this, the similarity between the candidate conversation response result and each standard base in the standard information database is calculated, and the standard base corresponding to the highest similarity is used as the text closest to the candidate conversation response result, and the highest similarity is used as the matching degree of the candidate conversation response result.

[0121] S702: If the matching degree is greater than or equal to a preset matching degree threshold, determine that the inspection result of the candidate session response result is inspection passed.

[0122] The matching degree indicates the degree to which the candidate conversation response result conforms to the logical fact. The higher the matching degree, the more the candidate conversation response result conforms to the logical fact. Moreover, the matching degree threshold is a preset value, such as 99%, 100%, etc.

[0123] Taking the matching degree threshold of 99% as an example, if the matching degree is 100%, which is greater than or equal to 99%, it indicates that the candidate conversation response result completely complies with the logical facts, and it is determined that the candidate conversation response result has passed the inspection.

[0124] S703: If the matching degree is less than the matching degree threshold, determine that the inspection result of the candidate session response result is inspection failure.

[0125] Continuing with the example of a matching degree threshold of 99%, if the matching degree is 80%, which is less than 99%, it indicates that the candidate session response result does not conform to the logical facts. In this case, it is determined that the candidate session response result inspection has failed.

[0126] In the embodiment of the present application, the candidate conversation response result is matched with the content in the preset standard information database to obtain the matching degree of the candidate conversation response result, and then the matching degree is compared with the matching degree to obtain a more objective verification result. The entire verification process is open and objective, which avoids the large language model from generating content that is inconsistent with known facts, and improves the reliability and effectiveness of the output results of the large language model.

[0127] S603: Determine a session response result according to the verification result of the candidate session response result.

[0128] Specifically, if the verification result is passed, the candidate conversation response result is determined as the conversation response result; if the verification result is failed, the large language model is re-called to generate a new candidate conversation response result, and the authenticity verification is performed on the new candidate conversation response result, and the execution is repeated until a conversation response result that passes the authenticity verification is generated.

[0129] If the candidate session response result passes the verification, it means that the candidate session response result is consistent with the logical facts, and the candidate session response result can be directly determined as the session response result; if the candidate session response result fails the verification, it means that the candidate session response result is contrary to the logical facts. At this time, the candidate session response result will be discarded, and the large language model will be instructed to regenerate a new candidate session response result, and steps S601 to S603 will be executed repeatedly until the latest candidate session response result generated passes the verification, that is, it is consistent with the logical facts, and the session response result is obtained, so as to ensure that the session response result is always consistent with the known factual basis, thereby improving the reliability of the session response result.

[0130] In the embodiment of the present application, based on the candidate conversation response results output by the large language model according to the preceding prompt words and the conversation request prompt words, the authenticity of the candidate conversation response results output by the large language model is checked. The former ensures that the candidate conversation response results meet the needs of the target users, and the latter avoids the large language model from outputting conversation response results that are contrary to logical facts when dealing with complex or specialized problems. The conversation response results determined in this way are logically coherent and consistent with known facts, thereby improving the accuracy and reliability of the conversation response results.

[0131] It should be noted that, considering the domain uncertainty of the conversation prompt words in the conversation request of the target user, the large language model usually deploys model parameters of multiple different conversation knowledge to improve the response speed of the large language model to the conversation request of the target user.

[0132] In an embodiment of the present application, when the conversation knowledge base in the large language model includes the target conversation knowledge, it is determined that there is no need to adjust the large language model again, and the candidate conversation response results corresponding to the preceding prompt words and the conversation request prompt words are quickly and accurately generated through the large language model.

[0133] In an exemplary embodiment, Figure 8 As shown, a method for generating session content is provided, comprising the following steps:

[0134] S801, in response to a session request of a target user, displaying a plurality of session questions.

[0135] S802: Receive the conversation results input by the target user for each conversation question.

[0136] S803: For any conversation question, generate a supplementary prompt word based on the conversation question and the conversation result.

[0137] S804, according to the language of the conversation result, the cultural background conversation habits corresponding to the language are obtained, and according to the cultural background conversation habits, the supplementary prompt words of each conversation question are added to the preset system prompt words to obtain the pre-prompt words.

[0138] S805: Acquire target conversation knowledge in the conversation prompt words in the conversation request.

[0139] S806: Determine whether the target conversation knowledge is in the conversation knowledge base of the large language model.

[0140] S807: If yes, the preceding prompt word and the conversation request prompt word are processed by the large language model to obtain a conversation response result.

[0141] S808: If not, update the conversation knowledge parameters in the large language model according to the application program interface of the target conversation knowledge, process the pre-prompt word and the conversation request prompt word according to the large language model after the parameter update, and obtain a candidate conversation response result.

[0142] Specifically, an application program interface of target conversation knowledge is obtained, the application program interface is connected to a large language model, conversation knowledge parameters in the large language model are updated, and the pre-prompt word and conversation request prompt word are processed according to the large language model after parameter update to obtain a candidate conversation response result.

[0143] S809: Match the candidate conversation response result with the content in the preset standard information database to obtain the matching degree of the candidate conversation response result.

[0144] S810: If the matching degree is greater than or equal to a preset matching degree threshold, determine that the verification result of the candidate session response result is a passed verification, and determine the candidate session response result as a session response result.

[0145] S811, if the matching degree is less than the matching degree threshold, it is determined that the test result of the candidate conversation response result is a failure to pass the test, and the process returns to step S808, re-calling the large language model to generate a new candidate conversation response result, until a conversation response result that passes the authenticity test is generated.

[0146] Specifically, the large language model is re-called to generate new candidate conversation response results, and the authenticity check is performed on the new candidate conversation response results, and the process is executed in a loop until a conversation response result that passes the authenticity check is generated.

[0147] In the embodiment of the present application, in response to the conversation request of the target user, the conversation prompt words in the conversation request are obtained to confirm the actual conversation needs of the target user. In addition, multiple different types of conversation information are preset, and multiple conversations are conducted with the target user to obtain the pre-prompt words. The pre-prompt words are dynamically adjusted to adapt to the immediate context of the conversation to effectively cope with the changing conversation scenes, so that the large language model can more accurately understand and respond to the conversation request of the target user, and improve the relevance and personalization of the conversation. Further, by integrating cross-domain knowledge and combining the logical fact verification mechanism, not only the accuracy of the conversation response results is improved, but also the logical coherence of the conversation response results is ensured, which is particularly beneficial for processing complex queries that require extensive knowledge background and accurate fact verification. Furthermore, it supports multiple languages ​​and pays special attention to the conversation habits under different cultural backgrounds, which enhances the adaptability and effectiveness of the model in global applications, which enables the large language model to participate in cross-cultural dialogues more accurately and sensitively, and improves its practical value in international communication.

[0148] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0149] Based on the same inventive concept, the embodiment of the present application also provides a conversation content generation device for implementing the conversation content generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more conversation content generation device embodiments provided below can refer to the limitations of the conversation content generation method above, and will not be repeated here.

[0150] In an exemplary embodiment, Fig. 9 As shown, a conversation content generating device is provided, comprising:

[0151] The request response module 901 is used to respond to the conversation request of the target user and obtain the conversation prompt word of the conversation request and the pre-prompt word of the target user; the pre-prompt word is obtained according to a plurality of different types of conversation information preset for the target user; the conversation prompt word includes the target conversation knowledge;

[0152] A knowledge updating module 902, for generating an updated knowledge base according to the application program interface of the target conversation knowledge and the conversation knowledge base, when the target conversation knowledge is not in the conversation knowledge base of the large language model;

[0153] The result generation module 903 is used to process the preceding prompt word and the conversation request prompt word based on the updated knowledge base to obtain a conversation response result.

[0154] In an exemplary embodiment, the request response module 901 includes:

[0155] A question display unit, used to display multiple conversation questions;

[0156] A result receiving unit, used to receive the conversation results input by the target user for each conversation question;

[0157] The prompt word determination unit is used to generate a pre-prompt word according to each conversation question and the conversation result of each conversation question.

[0158] In an exemplary embodiment, the prompt word determination unit is specifically configured to:

[0159] For any conversation question, generate supplementary prompt words based on the conversation question and the conversation result;

[0160] Determine the pre-prompt words based on the supplementary prompt words for each conversation question and the language of the conversation results.

[0161] In an exemplary embodiment, the prompt word determination unit is specifically configured to:

[0162] According to the language of the conversation result, obtain the cultural background conversation habits corresponding to the language;

[0163] According to the cultural background conversation habits, the supplementary prompt words of each conversation question are added to the preset system prompt words to obtain the pre-prompt words.

[0164] In an exemplary embodiment, the request response module 901 further includes:

[0165] The model calling unit is used to input multiple different types of conversation information into the prompt word generation module in the large language model, and output the pre-prompt word through the prompt word generation module.

[0166] In an exemplary embodiment, the conversation content generating device further includes:

[0167] A model input module, used for inputting the pre-prompt word and the conversation request prompt word into the large language model to obtain a candidate conversation response result when the target conversation knowledge is in the conversation knowledge base of the large language model;

[0168] A result verification module, used to verify the authenticity of candidate session response results;

[0169] The result determination module is used to determine the session response result according to the verification result of the candidate session response result.

[0170] In an exemplary embodiment, the result verification module includes:

[0171] A content matching unit, used to match the candidate conversation response result with the content in a preset standard information database to obtain the matching degree of the candidate conversation response result;

[0172] A first verification unit, configured to determine that a verification result of the candidate session response result is a passed verification if the matching degree is greater than or equal to a preset matching degree threshold;

[0173] The second verification unit is configured to determine that the verification result of the candidate session response result is a failure to pass the verification if the matching degree is less than a matching degree threshold.

[0174] In an exemplary embodiment, the result determination unit includes:

[0175] A first determining unit, configured to determine the candidate session response result as the session response result when the verification result is that the verification is passed;

[0176] The second determining unit is used to, when the verification result is that the verification fails, re-call the large language model to generate a new candidate conversation response result, and perform an authenticity verification on the new candidate conversation response result, and execute the operation in a loop until a conversation response result that passes the authenticity verification is generated.

[0177] Each module in the above-mentioned conversation content generation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0178] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0179] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0180] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0181] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0182] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0183] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for generating conversation content, characterized in that: The method comprises: In response to a conversation request of a target user, acquiring a conversation prompt word of the conversation request and a pre-prompt word of the target user; the pre-prompt word is obtained according to a plurality of different types of conversation information preset for the target user; the conversation prompt word includes target conversation knowledge; In the case where the target conversation knowledge is not in the conversation knowledge base of the large language model, generating an updated knowledge base according to the application program interface of the target conversation knowledge and the conversation knowledge base; The preceding prompt word and the conversation request prompt word are processed based on the updated knowledge base to obtain a conversation response result.

2. The method according to claim 1, characterized in that The session information includes the session question and the session result, and obtaining the pre-prompt word of the target user includes: Display multiple session questions; receiving a conversation result input by the target user for each of the conversation questions; The preceding prompt words are generated according to each of the conversation questions and the conversation results of each of the conversation questions.

3. The method according to claim 2, characterized in that The generating of the pre-prompt words according to the conversation questions and the conversation results of the conversation questions includes: For any conversation question, generating a supplementary prompt word based on the conversation question and the conversation result; The preceding prompt word is determined according to the supplementary prompt word of each of the conversation questions and the language of the conversation result.

4. The method according to claim 3, characterized in that The determining of the pre-prompt word according to the supplementary prompt word of each of the conversation questions and the language of the conversation result includes: According to the language of the conversation result, obtaining the cultural background conversation habits corresponding to the language; According to the cultural background conversation habits, the supplementary prompt words of each of the conversation questions are added to the preset system prompt words to obtain the pre-prompt words.

5. The method according to claim 1, characterized in that The large language model includes a prompt word generation module; The step of obtaining the preceding prompt word of the target user includes: The plurality of different types of conversation information are input into a prompt word generation module in the large language model, and the pre-prompt word is output through the prompt word generation module.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: If the target conversation knowledge is in the conversation knowledge base of the large language model, inputting the preceding prompt word and the conversation request prompt word into the large language model to obtain a candidate conversation response result; Performing authenticity check on the candidate session response result; The session response result is determined according to the verification result of the candidate session response result.

7. The method according to claim 6, characterized in that The authenticity check of the candidate session response result includes: Matching the candidate conversation response result with the content in a preset standard information database to obtain the matching degree of the candidate conversation response result; If the matching degree is greater than or equal to a preset matching degree threshold, determining that the inspection result of the candidate session response result is inspection passed; If the matching degree is less than the matching degree threshold, it is determined that the inspection result of the candidate session response result is inspection failure.

8. The method according to claim 6, characterized in that The determining the session response result according to the verification result of the candidate session response result includes: If the verification result is that the verification is passed, determining the candidate session response result as the session response result; If the verification result is failure, the large language model is called again to generate a new candidate conversation response result, and the authenticity verification is performed on the new candidate conversation response result, and the process is executed in a loop until a conversation response result that passes the authenticity verification is generated.

9. A conversation content generating device, characterized in that: The device comprises: A request response module, configured to respond to a conversation request of a target user, obtain a conversation prompt word of the conversation request and a pre-prompt word of the target user; the pre-prompt word is obtained according to a plurality of different types of conversation information preset for the target user; the conversation prompt word includes target conversation knowledge; a knowledge updating module, configured to generate an updated knowledge base according to an application program interface of the target conversation knowledge and the conversation knowledge base, if the target conversation knowledge is not in the conversation knowledge base of the large language model; The result generating module is used to process the preceding prompt word and the conversation request prompt word based on the updated knowledge base to obtain a conversation response result.

10. The device according to claim 9, characterized in that The request response module includes: A question display unit, used to display multiple conversation questions; A result receiving unit, configured to receive a conversation result input by the target user for each of the conversation questions; The prompt word determination unit is used to generate the pre-prompt word according to each of the conversation questions and the conversation results of each of the conversation questions.

11. The device according to claim 10, characterized in that The prompt word determination unit is specifically used for: For any conversation question, generating a supplementary prompt word based on the conversation question and the conversation result; The preceding prompt word is determined according to the supplementary prompt word of each of the conversation questions and the language of the conversation result.

12. The device according to claim 11, characterized in that The prompt word determination unit is specifically used for: According to the language of the conversation result, obtaining the cultural background conversation habits corresponding to the language; According to the cultural background conversation habits, the supplementary prompt words of each of the conversation questions are added to the preset system prompt words to obtain the pre-prompt words.

13. The device according to claim 9, characterized in that The request response module further includes: The model calling unit is used to input the plurality of different types of conversation information into the prompt word generation module in the large language model, and output the pre-prompt word through the prompt word generation module.

14. The device according to any one of claims 9 to 13, characterized in that: The device also includes: A model input module, configured to input the preceding prompt word and the conversation request prompt word into the large language model to obtain a candidate conversation response result when the target conversation knowledge is in the conversation knowledge base of the large language model; A result verification module, used to verify the authenticity of the candidate session response result; The result determination module is used to determine the session response result according to the verification result of the candidate session response result.

15. The device according to claim 14, characterized in that The result inspection module comprises: A content matching unit, used to match the candidate conversation response result with the content in a preset standard information database to obtain a matching degree of the candidate conversation response result; A first verification unit, configured to determine that a verification result of the candidate session response result is a passed verification if the matching degree is greater than or equal to a preset matching degree threshold; The second verification unit is configured to determine that the verification result of the candidate session response result is a verification failure if the matching degree is less than the matching degree threshold.

16. The device according to claim 14, characterized in that The result determination module comprises: A first determining unit, configured to determine the candidate session response result as the session response result if the verification result is a passed verification; The second determining unit is used to, when the verification result is a failure, re-call the large language model to generate a new candidate conversation response result, and perform an authenticity verification on the new candidate conversation response result, and execute the operation in a loop until a conversation response result that passes the authenticity verification is generated.

17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Optimization method and system for knowledge base of man-machine interactive system

    CN106202288A

  • Generation method, model training method, equipment and storage medium

    CN116821308A

  • Processing method for intelligent customer service dialogue and related product

    CN117312521A

  • Task type dialogue response method and device

    CN117609449A

  • Text generation method and device, equipment and storage medium

    CN118227752A