Consultation result generation method and apparatus, and electronic device
By acquiring multi-turn dialogue data through short-term memory and long-term memory networks, and combining retrieval enhancement generation technology and generation models, the problem of low accuracy and efficiency of consultation results in TCM AI systems has been solved. This has enabled efficient and accurate generation of TCM consultation results, improving user trust and usability.
Patent Information
- Application Number
- CN202511166708.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-08-20
AI Technical Summary
Existing TCM AI systems suffer from poor accuracy and low efficiency in TCM consultations. In particular, rule-based systems require frequent access to large external knowledge bases, leading to response delays and failing to meet the efficiency requirements of real-time interactive consultations.
We use short-term memory networks and long-term memory networks to acquire multi-turn dialogue consultation data. Combined with retrieval enhancement generation technology and generative model, we efficiently retrieve the first consultation result through retrieval enhancement generation technology and use the generative model to generate the second consultation result, including TCM syndrome differentiation conclusions, treatment methods and precautions.
It improves the efficiency, accuracy, and personalization of consultation results generation, reduces user waiting time, enhances the personalization and satisfaction of the consultation experience, ensures the consistency and completeness of consultation content, and reduces the risk of errors or omissions.
Smart Images

Figure CN120670582B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a consultation result generation method and device and electronic equipment. BACKGROUND
[0002] In recent years, artificial intelligence technology has been introduced into the field of traditional Chinese medicine to assist in diagnosis, but existing traditional Chinese medicine AI (Artificial Intelligence) systems mostly use simple logical judgment based on rule engines. Such rigid architecture is difficult to completely cover the complex logic of traditional Chinese medicine syndrome differentiation, resulting in poor accuracy of consultation results. To compensate for the limitations of rule engines, the system needs to frequently access a large external traditional Chinese medicine knowledge base (such as a classic prescription library, a medicinal material database, etc.), and each time of judgment needs to repeatedly traverse lengthy data, causing significant response delay and failing to meet the efficiency requirements of real-time interactive consultation.
[0003] Therefore, how to improve the accuracy of consultation results in the context of traditional Chinese medicine consultation while improving the efficiency of consultation is a problem that needs to be solved at present. SUMMARY
[0004] The present application provides a consultation result generation method, device and electronic equipment to solve the problem of poor accuracy of consultation results and consultation efficiency in the existing traditional Chinese medicine consultation process.
[0005] The present application provides a consultation result generation method, comprising:
[0006] receiving current consultation information input by a user;
[0007] According to the current consultation information, the multi-round dialogue consultation data of the user is obtained through a short-term memory network and / or a long-term memory network; wherein the multi-round dialogue consultation data includes at least one of short-term consultation information in the current dialogue and long-term consultation results in the historical dialogue;
[0008] According to the current consultation information and the multi-round dialogue consultation data, a first consultation result is retrieved through retrieval enhancement generation technology;
[0009] According to the current consultation information, the multi-round dialogue consultation data and the first consultation result, a second consultation result is generated through a generation model.
[0010] According to the consultation result generation method provided by the present application, the multi-round dialogue consultation data of the user is obtained through a short-term memory network and / or a long-term memory network according to the current consultation information, comprising:
[0011] extracting a first keyword in the current consultation information;
[0012] map the first keyword to a second keyword, the second keyword being a traditional Chinese medicine syndrome feature;
[0013] obtain short-term inquiry information in a current dialogue of the user according to the second keyword through the short-term memory network;
[0014] generate an inquiry summary text according to the short-term inquiry information and the current inquiry information;
[0015] obtain long-term inquiry results in a historical dialogue of the user according to the second keyword and the inquiry summary text through the long-term memory network; wherein the long-term inquiry results include at least one of historical consultation results and historical feedback information.
[0016] According to the consultation result generation method provided by the application, the inquiry summary text is generated according to the short-term inquiry information and the current inquiry information, which includes:
[0017] detect whether there is a semantic contradiction between the current inquiry information and the short-term inquiry information, and obtain a detection result;
[0018] fuse the current inquiry information and the short-term inquiry information according to the detection result, and obtain fused inquiry information;
[0019] generate an inquiry summary text according to the fused inquiry information.
[0020] According to the consultation result generation method provided by the application, the second consultation result is generated according to the current inquiry information, the multi-round dialogue inquiry data and the first consultation result through the generation model, which includes:
[0021] generate a second consultation result according to the second keyword, the inquiry summary text, the long-term inquiry results and the first consultation result through the generation model; wherein the second consultation result includes at least one of traditional Chinese medicine syndrome conclusion, treatment method, prescription formula and matters needing attention.
[0022] According to the consultation result generation method provided by the application, the first consultation result is obtained by searching according to the current inquiry information and the multi-round dialogue inquiry data through the search-enhanced generation technology, which includes:
[0023] generate a symptom feature vector according to the current inquiry information, and generate a medical history feature vector according to the multi-round dialogue inquiry data;
[0024] retrieve an initial search result from a pre-set traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector; wherein the initial search result includes at least one of syndrome rules, historical cases and recommended prescriptions.
[0025] fuse the initial retrieval result and the multi-round dialogue inquiry data to obtain enhanced prompt information;
[0026] generate a first consultation result according to the enhanced prompt information.
[0027] According to the consultation result generation method provided by the application, the preset traditional Chinese medicine knowledge base includes a plurality of professional levels of traditional Chinese medicine knowledge bases, and the initial retrieval result is retrieved from the preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector, including:
[0028] According to the symptom feature vector and the medical history feature vector, a first retrieval result and a first retrieval similarity are retrieved from a first-level traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base;
[0029] When the first retrieval similarity is greater than a preset similarity threshold, the first retrieval result is determined as the initial retrieval result;
[0030] When the first retrieval similarity is less than or equal to the preset similarity threshold, a second retrieval result and a second retrieval similarity are retrieved from a second-level traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector, wherein the professional level of the second-level traditional Chinese medicine knowledge base is lower than that of the first-level traditional Chinese medicine knowledge base;
[0031] When the second retrieval similarity is greater than the preset similarity threshold, the second retrieval result is determined as the initial retrieval result;
[0032] When the second retrieval similarity is less than or equal to the preset similarity threshold, the next level of traditional Chinese medicine knowledge base is continuously retrieved, and the same is repeated until the retrieval similarity of the retrieved result is greater than the preset similarity threshold, and the corresponding retrieval result is determined as the initial retrieval result.
[0033] According to the consultation result generation method provided by the application, the consultation result generation method further includes:
[0034] Periodically acquiring traditional Chinese medicine data to be updated from a preset data source;
[0035] Determine the similarity between the traditional Chinese medicine data to be updated and the existing traditional Chinese medicine data in the preset traditional Chinese medicine knowledge base through a contrast learning model;
[0036] According to the similarity, a target updating mode is determined;
[0037] According to the target updating mode, the preset traditional Chinese medicine knowledge base is updated.
[0038] According to the consultation result generation method provided by the application, before the preset traditional Chinese medicine knowledge base is updated according to the target updating mode, the method further comprises the following steps of:
[0039] detecting conflicts between the to-be-updated traditional Chinese medicine data and the stored traditional Chinese medicine data to obtain a conflict detection result;
[0040] when no conflict is detected, updating the preset traditional Chinese medicine knowledge base according to the target updating mode.
[0041] The application further provides a consultation result generation device, which comprises the following components.
[0042] a receiving module configured to receive current inquiry information input by a user;
[0043] an obtaining module configured to obtain multi-round dialogue inquiry data of the user by using a short-term memory network and / or a long-term memory network according to the current inquiry information, wherein the multi-round dialogue inquiry data comprises at least one of short-term inquiry information in a current dialogue and long-term inquiry results in a historical dialogue;
[0044] a searching module configured to search for a first consultation result according to the current inquiry information and the multi-round dialogue inquiry data by using a search enhancement generation technology;
[0045] a generating module configured to generate a second consultation result according to the current inquiry information, the multi-round dialogue inquiry data and the first consultation result by using a generation model.
[0046] The application further provides an electronic device comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the consultation result generation method according to any one of the above-mentioned methods when executing the computer program.
[0047] The application provides a consultation result generation method, device and electronic equipment. The method comprises the following steps: receiving current inquiry information input by a user; obtaining multi-round dialogue inquiry data of the user according to the current inquiry information, wherein the multi-round dialogue inquiry data comprises short-term inquiry information in a current dialogue and / or long-term inquiry results in a historical dialogue; obtaining a first consultation result by using a retrieval enhanced generation technology; and outputting a second consultation result by using a generation model. The application has significant beneficial effects in the process of traditional Chinese medicine inquiry and consultation. Specifically, the application realizes rapid access of multi-round dialogue data by using a short-term memory network and a long-term memory network, reduces data processing delay, efficiently retrieves the first consultation result by using the retrieval enhanced generation technology, avoids redundant calculation of the generation model, improves the overall response speed, makes the generation of the second consultation result more efficient, and reduces the waiting time of the user. Meanwhile, the application ensures the coherence and integrity of the consultation content by using the context of the multi-round dialogue data, provides reliable first consultation results as factual basis by using the retrieval enhanced generation technology, further optimizes the generation model, effectively reduces the risk of errors or omissions, and improves the accuracy and reliability of the consultation results. In addition, the generation model combines multi-dimensional input data to generate highly targeted second consultation results, realizes deep adaptation to the user demand, and improves the individualization and satisfaction of the consultation experience. Overall, these effects work together to significantly improve the generation efficiency, accuracy and individualization level of the consultation results, and enhance the user trust and practicality. BRIEF DESCRIPTION OF DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0049] Figure 1 is a system architecture diagram of the consultation result generation system provided by the application;
[0050] Figure 2 is one of the flowcharts of the consultation result generation method provided by the application;
[0051] Figure 3 is the second flowchart of the consultation result generation method provided by the application;
[0052] Figure 4 is the third flowchart of the consultation result generation method provided by the application;
[0053] Figure 5 is the fourth flowchart of the consultation result generation method provided by the application;
[0054] Figure 6 This is a schematic diagram of the consultation result generation device provided by the present invention;
[0055] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0057] This invention proposes a method, apparatus, and electronic device for generating consultation results, which are described below in conjunction with... Figures 1-7 Describe it.
[0058] Figure 1 This is a system architecture diagram of the consultation result generation system provided by the present invention, such as... Figure 1 As shown, the consultation result generation system may include terminal devices 101, 102, and 103 and server 104. Terminal devices 101, 102, and 103 and server 104 can be connected via a network, such as a wired or wireless communication link or fiber optic cable.
[0059] Users can interact with server 104 using terminal devices 101, 102, and 103 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. They can be implemented as multiple software programs or software modules (e.g., multiple software programs or software modules used to provide distributed services) or as a single software program or software module. No specific limitations are made here.
[0060] Server 104 can be a server that provides various services, such as a backend server that provides support for terminal devices 101, 102, and 103.
[0061] It should be noted that the consultation result generation method provided in this application embodiment can be executed by server 104 or terminal devices 101, 102, 103. Correspondingly, the consultation result generation device can be set in server 104 or terminal devices 101, 102, 103.
[0062] Figure 2 is one of the flowcharts of the consultation result generation method provided by the present application, as shown in the figure, the consultation result generation method comprises the following steps. Figure 2
[0063] Step S110, receiving the current inquiry information input by the user.
[0064] In this embodiment, the consultation result generation method is applied to an electronic device. The electronic device can be a server, or a terminal device such as a smartphone, a tablet computer, a portable computer, a desktop computer, etc.
[0065] The consultation result generation method is applicable to the scenarios of traditional Chinese medicine health consultation, dietary suggestion, and constitution conditioning, etc.
[0066] The user inputs the symptom description through the interactive interface of the electronic device, and the current acquired symptom description is recorded as the current inquiry information. The input methods include but are not limited to: 1) text input, 2) voice input.
[0067] If the voice input, the electronic device can convert the user's voice into text through the built-in voice recognition module.
[0068] The current inquiry information contains elements such as chief complaint, symptom characteristics, and duration.
[0069] Step S120, according to the current inquiry information, acquiring the multi-round dialogue inquiry data of the user through the short-term memory network and / or the long-term memory network.
[0070] Among them, the multi-round dialogue inquiry data includes at least one of the short-term inquiry information in the current dialogue and the long-term inquiry result in the historical dialogue.
[0071] The multi-round dialogue includes the current dialogue (i.e. this dialogue) and the historical dialogue. Among them, the current dialogue refers to the dialogue initiated by the user currently, and the historical dialogue refers to some dialogues initiated by the user before the current dialogue. For example, the user clicks the consultation button, which initiates a new dialogue (i.e. the current dialogue), and when the user ends the consultation after one or more rounds of consultation, the current dialogue ends and becomes a historical dialogue.
[0072] Short-term inquiry information, the last round of inquiry information in the current dialogue or the inquiry information of the previous rounds. Its acquisition methods can include but are not limited to: 1) directly acquiring the last round or the previous rounds of inquiry information through a short-term memory network; 2) extracting a first keyword in the current inquiry information, acquiring the user's short-term inquiry information related to the first keyword through a short-term memory network; 3) extracting a first keyword in the current inquiry information, mapping the first keyword to a second keyword, the second keyword being a TCM syndrome differentiation feature, and acquiring the user's short-term inquiry information related to the second keyword through a short-term memory network; 4) extracting a first keyword in the current inquiry information, mapping the first keyword to a second keyword, the second keyword being a TCM syndrome differentiation feature, directly acquiring the last round of inquiry information through a short-term memory network, and acquiring the user's short-term inquiry information related to the second keyword.
[0073] Long-term inquiry results are the inquiry results in the user's historical dialogue, which can include historical feedback information (i.e., the user's effectiveness feedback information) in addition to historical consultation results. Its acquisition methods can include but are not limited to: 1) acquiring the user's long-term inquiry results related to the current inquiry information through a long-term memory network; 2) extracting a first keyword in the current inquiry information, acquiring the user's long-term inquiry results related to the first keyword through a long-term memory network; 3) extracting a first keyword in the current inquiry information, mapping the first keyword to a second keyword, the second keyword being a TCM syndrome differentiation feature, and acquiring the user's long-term inquiry results related to the second keyword through a long-term memory network; 4) extracting a first keyword in the current inquiry information, mapping the first keyword to a second keyword, the second keyword being a TCM syndrome differentiation feature, generating an inquiry summary text according to the short-term inquiry information and the current inquiry information; then, acquiring the user's long-term inquiry results according to the second keyword and the inquiry summary text through a long-term memory network.
[0074] Step S130, through retrieval enhancement generation technology, the first consultation result is retrieved according to the current inquiry information and the multi-round dialogue inquiry data.
[0075] Retrieval-Augmented Generation (RAG) technology combines information retrieval with the text generation capability of large language models, which can improve the accuracy, relevance and factuality of the generated content. Retrieval-Augmented Generation technology obtains the first consultation result through directional retrieval, providing accurate input for the subsequent generation model, avoiding the burden of computing from scratch for the generation model, thereby shortening the response speed of inquiry consultation and reducing the consumption of computing resources.
[0076] As an implementation manner, a symptom feature vector is generated according to the current inquiry information, and a medical history feature vector is generated according to the multi-round dialogue inquiry data; an initial retrieval result is retrieved from a preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector; the initial retrieval result includes at least one of a syndrome differentiation rule, a historical case and a recommended prescription; the initial retrieval result and the multi-round dialogue inquiry data are fused to obtain enhanced prompt information; and a first consultation result is generated according to the enhanced prompt information.
[0077] As another implementation manner, a first keyword in the current inquiry information is extracted, the first keyword is mapped to a second keyword, the second keyword is a traditional Chinese medicine syndrome differentiation feature, a symptom feature vector is generated according to the second keyword, and a medical history feature vector is generated according to the historical inquiry data; an initial retrieval result is retrieved from a preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector; the initial retrieval result includes at least one of a syndrome differentiation rule, a historical case and a recommended prescription; the initial retrieval result and the multi-round dialogue inquiry data are fused to obtain enhanced prompt information; and a first consultation result is generated according to the enhanced prompt information. The specific execution process can refer to the following embodiments, which will not be described here.
[0078] Through the retrieval enhancement generation technology, the preset traditional Chinese medicine knowledge base is retrieved, the first consultation result based on the empirical evidence is provided as support for the second consultation result, the subjective speculation that may be generated by the generation model depending on the pure generation logic is reduced, and thus the accuracy of the second consultation result can be improved.
[0079] In step S140, a second consultation result is generated by a generation model according to the current inquiry information, the multi-round dialogue inquiry data and the first consultation result.
[0080] The generation model can include but is not limited to an image generation model, an audio generation model and a text generation model. The specific model type is determined according to the type of output data. For example, if the current inquiry information, the multi-round dialogue inquiry data and the first consultation result are all texts, a text generation model such as LLM (Large Language Model) can be used. For another example, if the type of output data includes images and texts, an image generation model and a text generation model need to be combined.
[0081] As an implementation manner, after the second consultation result is obtained, the second consultation result, the current inquiry information and the multi-round dialogue inquiry data can be input to the generation model to integrate multi-dimensional information through the generation model, and generate user-oriented and easy-to-understand inquiry feedback according to the traditional Chinese medicine diagnosis and treatment logic (for example, first syndrome differentiation, then treatment method, and finally prescription and drug analysis).
[0082] As another implementation, after obtaining the second consultation result, the second consultation result, the second keyword extracted and mapped according to the current interrogation information, the interrogation text summary generated according to the interrogation information and the current interrogation information, and the long-term interrogation result can be input into the generation model to integrate multi-dimensional information according to the Chinese medicine diagnosis and treatment logic (for example, first differentiation, then treatment method, and finally prescription and drug analysis) through the generation model to generate user-oriented and easy-to-understand interrogation feedback.
[0083] Compared with the former implementation, the latter implementation reduces the filtering cost of the generation model for the original redundant data and improves the information integration efficiency by pre-extracting the second keyword adapted to Chinese medicine and generating the interrogation text summary of concentrated core information. The keyword provides the "diagnosis anchor point" of Chinese medicine terminology, and the summary combs the "symptom-history-pathogenesis" logical chain, which strengthens the adaptability to the Chinese medicine "differentiation-treatment method-prescription" diagnosis and treatment logic and reduces the risk of syndrome type misjudgment. At the same time, the structured keyword and summary can help the model output feedback content with clear levels and highlights, avoid logical jumps, make it easier for users to understand the differentiation basis, treatment plan and drug analysis, and further improve the accuracy of personalized services by focusing on the user's individual characteristics (such as previous medication contraindications and physical characteristics), and comprehensively optimize the professionalism, easy-to-understand nature and efficiency of Chinese medicine interrogation feedback.
[0084] Specifically, the interrogation feedback clearly states the Chinese medicine differentiation conclusion (such as "Your current differentiation is wind-heat invading the lung"), recommends the treatment method (such as "adopting the method of clearing heat and relieving the lung to stop coughing"), and provides the specific prescription formula (such as "the formula is selected as Sangju Yin with modifications, and the drugs include mulberry leaves, chrysanthemum, apricot kernels, etc."), and supplements the medication precautions (such as "avoid eating spicy and greasy food during medication"), so that the user can clearly understand the diagnosis and treatment ideas and plans.
[0085] Further, a feedback text effect optimization mechanism can be introduced to analyze the user's acceptance of different expressions according to historical interaction data, for example, whether the user prefers detailed analysis of differentiation basis or concise conclusion, and then dynamically adjust the output style according to the analysis results to improve the user's understanding and acceptance.
[0086] Further, after obtaining the second consultation result, the second consultation result can be directly output, and the output mode can be text output, voice output or sign language output, etc.
[0087] The consultation result generation method provided by the embodiment of the present application first receives current inquiry information input by a user, acquires multi-round dialogue inquiry data of the user according to the current inquiry information, and the multi-round dialogue inquiry data includes short-term inquiry information in the current dialogue and / or long-term inquiry results in the historical dialogue. Then, a first consultation result is acquired through retrieval enhanced generation technology, and a second consultation result is output by using a generation model. The embodiment of the present application produces significant beneficial effects in the process of traditional Chinese medicine inquiry consultation. Specifically, the embodiment of the present application realizes rapid access of multi-round dialogue data through a short-term memory network and a long-term memory network, reduces data processing delay, efficiently retrieves the first consultation result through retrieval enhanced generation technology, avoids redundant calculation of the generation model, thereby improving the overall response speed, making the generation of the second consultation result more efficient, and reducing the waiting time of the user. At the same time, the embodiment of the present application ensures the coherence and integrity of the consultation content by using the context integration of the multi-round dialogue data, and provides reliable first consultation results as factual basis through retrieval enhanced generation technology, and the generation model is further optimized on this basis, effectively reducing the risk of errors or omissions, thereby improving the accuracy and reliability of the consultation results. In addition, the generation model combines multi-dimensional input data to generate highly targeted second consultation results, realizes deep adaptation to user needs, and improves the personalization and satisfaction of the consultation experience. Overall, these effects work together, not only significantly improve the generation efficiency, accuracy and personalization level of the consultation results, but also enhance the user trust and practicality.
[0088] Based on any of the above embodiments, Figure 3 is a flowchart of the consultation result generation method provided by the present application, as Figure 3 shown, step S120 includes step S121, step S122, step S123, step S124 and step S125.
[0089] Step S121, extracting a first keyword in the current inquiry information.
[0090] The NLP (Natural Language Processing) technology is adopted to perform word segmentation and semantic analysis on the current inquiry information, extract the symptom entity and attribute word in the current inquiry information, obtain the keyword, and record it as the first keyword.
[0091] Exemplarily, the current inquiry information is “cough for three days, sputum yellow and sticky”, and the first keyword obtained by extraction is “cough, sputum yellow, and sticky”.
[0092] Step S122, mapping the first keyword to a second keyword, and the second keyword is a traditional Chinese medicine syndrome differentiation feature.
[0093] The first keyword is mapped to a TCM syndrome feature space to obtain a second keyword. The second keyword is a TCM syndrome feature.
[0094] As an implementation manner, a mapping relationship table between keywords and TCM syndrome features can be established in advance, and the second keyword corresponding to the first keyword is determined according to the mapping relationship table.
[0095] As another implementation manner, a TCM knowledge graph can be constructed in advance, and the second keyword corresponding to the first keyword is determined according to the TCM knowledge graph.
[0096] Through the above mapping, a basis semantic association can be constructed for subsequent syndrome differentiation and treatment, and symptom description can be adapted to the TCM knowledge system, so that the problem can be analyzed according to the TCM logic, and the accuracy of the consultation result can be improved.
[0097] For example, the first keyword is "cough, yellow sputum, and sticky", and the second keyword "heat syndrome, lung failing to spread and descend" can be obtained through mapping.
[0098] In step S123, the short-term memory network is used to obtain short-term inquiry information of the user in the current conversation according to the second keyword.
[0099] The short-term memory (STM) network is used for real-time and short-term information storage and processing, and has a very limited capacity and a short retention time. In the application scenario, the short-term memory network is used to save the inquiry information and keywords of the previous round or several rounds of conversation in the current conversation.
[0100] The second keyword is input into the short-term memory network to obtain short-term inquiry information of the user output by the short-term memory network. The short-term inquiry information at least includes the previous round of conversation, and can also include other previous rounds of conversation related to the second keyword. By obtaining the short-term inquiry information, the context association of multiple rounds of consultation in the current conversation can be realized, the user's previous symptom description can be avoided to be omitted, and the cross-round association analysis of TCM inquiry can be realized, and the accuracy of the consultation result can be improved.
[0101] Further, after each round of conversation, the extracted keywords and inquiry information can be stored in the short-term memory network for subsequent calling.
[0102] In step S124, an inquiry summary text is generated according to the short-term inquiry information and the current inquiry information.
[0103] After obtaining the short-term inquiry information, an inquiry summary text is generated according to the short-term inquiry information and the current inquiry information.
[0104] As an implementation manner, the short-term consultation information can be directly combined with the current consultation information, and the LLM is used to generate the consultation summary text according to the combined consultation information.
[0105] As another implementation manner, it is detected whether there is semantic contradiction between the current consultation information and the short-term consultation information, and a detection result is obtained; the current consultation information and the short-term consultation information are fused according to the detection result, and fused consultation information is obtained; and the consultation summary text is generated according to the fused consultation information. The specific execution process can refer to the following embodiments, which will not be described here.
[0106] It should be noted that by generating the consultation summary text, subsequent quick review and associated information can be facilitated, a concise input can be provided for the long-term memory network call, and the response efficiency can be improved by quickly positioning the key content during real-time interaction.
[0107] In step S125, the long-term memory network is used to obtain the long-term consultation result in the user's historical conversation according to the second keyword and the consultation summary text. The long-term consultation result includes at least one of the historical consultation result and the historical feedback information.
[0108] The long-term memory (LTM) network is used to store relatively persistent information, has a huge capacity, and has a relatively slow forgetting. In the application scenario, the long-term memory network is used to save the historical consultation archives in the user's historical conversation, including historical consultation information, historical consultation summary, historical consultation keyword, historical consultation result, and historical feedback information.
[0109] The second keyword and the consultation summary text are input into the long-term memory network, and the long-term consultation result output by the long-term memory network is obtained. The long-term consultation result includes at least one of the historical consultation result and the historical feedback information.
[0110] In this embodiment, the long-term consultation result is obtained according to the second keyword and the consultation summary text, which can obtain the long-term consultation result from multiple dimensions compared with obtaining the long-term consultation result only according to the second keyword, and is beneficial to improve the accuracy of the consultation result.
[0111] Further, the historical consultation archives of the user can be obtained through the long-term memory network periodically for in-depth analysis and extraction. Specifically, the constitution data changes of the user are combed according to the constitution identification standards (such as qi deficiency constitution, phlegm-damp constitution, etc.), and a constitution trend report is generated, such as "the qi deficiency constitution score increases from 45 to 62, indicating that the healthy qi is gradually deficient", to update the historical feedback information, so as to provide a reference for the long-term health management and syndrome differentiation and treatment of the user in the consultation.
[0112] The consultation result generation method provided by the embodiment of the present application first receives current inquiry information input by a user, extracts a first keyword in the current inquiry information, and then maps the first keyword to a TCM syndrome differentiation feature (i.e., a second keyword). Through this mapping process, the symptom description in the current inquiry information can be adapted to the TCM knowledge system, laying a foundation for subsequent matching of multi-round dialogue inquiry data and accurate analysis based on TCM logic. Then, short-term inquiry information of the user is obtained through a short-term memory network; meanwhile, inquiry summary text is generated according to the short-term inquiry information and the current inquiry information. Further, the second keyword and the inquiry summary text are taken as retrieval clues of a long-term memory network, and long-term inquiry results of the user are obtained from historical inquiry archives. Through the above-mentioned method, the information dimension can be enriched, the current symptoms are focused on, and long-term factors such as medical history are also taken into account, so that the syndrome differentiation and treatment are more comprehensive, which is conducive to improving the accuracy of the consultation results.
[0113] According to any one of the above embodiments, step S124 includes step S1241, step S1242 and step S1243.
[0114] In step S1241, whether there is a semantic contradiction between the current inquiry information and the short-term inquiry information is detected, and a detection result is obtained.
[0115] In this embodiment, considering that there may be semantic contradictions between the information before and after the multi-round dialogue, for example, "aversion to cold" is said in the last round of dialogue and "heavy fever" is said in the current dialogue. Therefore, before generating inquiry summary text according to the short-term inquiry information and the current inquiry information, it is necessary to detect whether there is a semantic contradiction between the short-term inquiry information and the current inquiry information.
[0116] In step S1242, the current inquiry information and the short-term inquiry information are fused according to the detection result, and fused inquiry information is obtained.
[0117] If it is detected that there is a semantic contradiction between the short-term inquiry information and the current inquiry information, the latest and / or more detailed description is given priority, and the current inquiry information and the short-term inquiry information are fused according to the above-mentioned rule, and fused inquiry information is obtained.
[0118] If it is detected that there is no semantic contradiction between the short-term inquiry information and the current inquiry information, the current inquiry information and the short-term inquiry information are directly combined, and fused inquiry information is obtained.
[0119] In step S1243, inquiry summary text is generated according to the fused inquiry information.
[0120] According to the fused interrogation information, an interrogation summary text is generated. Specifically, the fused interrogation information can be input into an LLM model to obtain an interrogation summary text output by the LLM model. The LLM model can include, but is not limited to, GPT-4 (Generative Pre-trained Transformer 4), Claude 3, and LLaMA (Large Language Model Meta AI).
[0121] The consultation result generation method provided by the embodiments of the present application can improve the accuracy of the interrogation text summary by detecting semantic contradictions between the current interrogation information and the short-term interrogation information, fusing the two interrogation information according to the detection result, and generating an interrogation text summary according to the fused interrogation information. This is conducive to improving the accuracy of long-term interrogation results and the accuracy of consultation results.
[0122] Based on any of the above embodiments, step S140 includes:
[0123] The second consultation result is generated by the generation model according to the second keyword, the interrogation summary text, the long-term interrogation result, and the first consultation result. The second consultation result includes at least one of a TCM syndrome differentiation conclusion, a treatment method, a prescription formula, and precautions.
[0124] After the first consultation result is obtained through preliminary retrieval, the second keyword, the interrogation summary text, the long-term interrogation result, and the first consultation result are input into the generation model to obtain a consultation result output by the generation model, which is recorded as the second consultation result. The second consultation result includes at least one of a TCM syndrome differentiation conclusion, a treatment method, a prescription formula, and precautions.
[0125] The consultation result generation method provided by the embodiments of the present application can not only reduce the filtering cost of the original redundant data of the generation model and improve the information integration efficiency by pre-extracting the second keyword adapted to TCM and generating the interrogation text summary of the condensed core information, but also strengthen the adaptability to the TCM "syndrome differentiation-treatment method-prescription" diagnosis and treatment logic by providing the TCM term "diagnosis anchor point" through the keyword and combing the "symptom-history-disease mechanism" logical chain in the summary, thereby reducing the risk of misjudgment of syndrome type. At the same time, the structured keyword and summary can help the model to output feedback content with clear levels and highlights, avoid logical jumps, make it easier for users to understand the syndrome differentiation basis, treatment plan, and medication analysis, and further improve the accuracy of personalized services by focusing on the user's individual characteristics (such as previous medication contraindications and physical characteristics), thereby comprehensively optimizing the professionalism, ease of understanding, and efficiency of TCM interrogation feedback.
[0126] Based on any of the above embodiments, Figure 4 is a third flowchart of the consultation result generation method provided by the present application, as shown in the figure, step S130 includes: step S131, step S132, step S133 and step S134. Figure 4
[0127] In step S131, a symptom feature vector is generated according to the current inquiry information, and a medical history feature vector is generated according to the multi-round dialogue inquiry data.
[0128] The generation process of the symptom feature vector is: extracting a first keyword in the current inquiry information; mapping the first keyword to a second keyword, the second keyword being a traditional Chinese medicine syndrome differentiation feature; inputting the second keyword into a pre-trained traditional Chinese medicine semantic encoder to obtain a feature vector output by the pre-trained traditional Chinese medicine semantic encoder, denoted as a symptom feature vector. Wherein, the pre-trained traditional Chinese medicine semantic encoder can use RoBERTa (Robustly optimized BERT approach) or BERT (Bidirectional Encoder Representations from Transformers) as a basic framework, and realize symptom feature extraction after fine-tuning in the traditional Chinese medicine field.
[0129] The generation process of the medical history feature vector is: structurally analyzing the multi-round dialogue inquiry data to obtain medical history information, which includes but is not limited to: past symptoms, traditional Chinese medicine syndrome differentiation conclusion, treatment method, prescription formula, historical feedback information. Then, after screening the key features and key fields by using the gating attention mechanism, the medical history feature vector is generated through the fully connected neural network.
[0130] In step S132, according to the symptom feature vector and the medical history feature vector, an initial retrieval result is retrieved from a pre-set traditional Chinese medicine knowledge base. Wherein, the initial retrieval result includes at least one of syndrome differentiation rules, historical cases and recommended prescriptions.
[0131] As an implementation manner, the retrieval can be performed according to the symptom feature vector and the medical history feature vector respectively. That is, according to the symptom feature vector, a retrieval result is retrieved from the pre-set traditional Chinese medicine knowledge base, and at the same time, according to the medical history feature vector, another retrieval result is retrieved from the pre-set traditional Chinese medicine knowledge base. The two retrieval results are combined to obtain the initial retrieval result.
[0132] As another implementation manner, the symptom feature vector and the medical history feature vector can be combined, and according to the combined feature vector, an initial retrieval result is retrieved from the pre-set traditional Chinese medicine knowledge base.
[0133] Further, during the retrieval, a priority retrieval strategy can be adopted. Specifically, according to the symptom feature vector and the medical history feature vector, a first retrieval result and a first retrieval similarity are retrieved from a first preset traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base; when the first retrieval similarity is greater than a preset similarity threshold, the first retrieval result is determined as the initial retrieval result; when the first retrieval similarity is less than or equal to the preset similarity threshold, a second retrieval result and a second retrieval similarity are retrieved from a second preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector; the professional level of the second preset traditional Chinese medicine knowledge base is lower than that of the first preset traditional Chinese medicine knowledge base; when the second retrieval similarity is greater than the preset similarity threshold, the second retrieval result is determined as the initial retrieval result; when the second retrieval similarity is less than or equal to the preset similarity threshold, a traditional Chinese medicine knowledge base of a next level is continuously retrieved, and the process is repeated until the retrieval similarity of the retrieved result is greater than the preset similarity threshold, and the retrieved result corresponding to the retrieval similarity is determined as the initial retrieval result. The specific execution process can be referred to in the following embodiments, and will not be described here.
[0134] In step S133, the initial retrieval result and the multi-round dialogue inquiry data are fused to obtain enhanced prompt information.
[0135] During the fusion, key information can be extracted from the initial retrieval result and the multi-round dialogue inquiry data according to a preset template, and then the key information is filled into the preset template to obtain the enhanced prompt information. Through the above-mentioned manner, the length of the prompt information can be effectively reduced, and then the subsequent problem of large model cognitive overload can be solved.
[0136] For example, the preset template can be:
[0137] According to the patient's symptoms, the following information is retrieved:
[0138] 1) Dialectical rule: {rule content} (source: XXX);
[0139] 2) Similar cases: {case summary} (result: XXX);
[0140] 3) Recommended prescription: {prescription name} (composition: XXX, efficacy: XXX);
[0141] At the same time, some medical history, allergy and other information of the user is obtained: {multi-round dialogue inquiry data};
[0142] Please give a dialectical analysis and treatment suggestion according to the above information.
[0143] For example, the preset template can be:
[0144] The medical history of the patient information includes: {multi-round dialogue inquiry data}.
[0145] The search results include:
[0146] 1) Syndrome differentiation rules: {rule content} (source: XXX);
[0147] 2) Similar cases: {case summary} (result: XXX);
[0148] 3) Recommended prescriptions: {prescription name} (composition: XXX, efficacy: XXX);
[0149] Please complete the following tasks based on the patient information and search results above:
[0150] 1) Output the diagnosis and confidence level;
[0151] 2) Recommend classic prescriptions and explain the compatibility basis;
[0152] 3) Provide addition and subtraction suggestions and contraindications.
[0153] Step S134, generating a first consultation result according to the enhanced prompt information.
[0154] Input the enhanced prompt information into the LLM model to obtain the first consultation result output by the LLM model.
[0155] The first consultation result is generated by the LLM model, which can adjust the initial search result based on multi-round dialogue inquiry data. The adjustment includes but is not limited to: 1) adjustment of treatment methods in the consultation result, including priority ranking and whether to display; 2) adjustment of prescription formulas in the consultation result, including priority ranking and whether to display; 3) dose adjustment of prescription formulas.
[0156] For example, the initial search result includes two treatment methods A and B, and in the long-term inquiry result, if the historical feedback information shows that the A treatment method has general efficacy, then the B treatment method can be prioritized to generate the first consultation result.
[0157] For example, the initial search result includes two prescription formulas D and E, and in the long-term inquiry result, if the historical consultation result also includes formula F, and the historical feedback information shows that there are uncomfortable, nausea, and other reactions after using the D prescription formula, then the formula D is deleted and the F prescription formula is added to generate the first consultation result.
[0158] For example, the initial search result includes two prescription formulas D and E, and in the long-term inquiry result, if the historical feedback information shows that the E prescription formula has been significantly improved after use, then the drug dosage of formula E or the total dosage can be adjusted to generate the first consultation result.
[0159] Exemplarily, the initial retrieval result includes two prescriptions D and E, the prescription E contains ephedra, and the user is sensitive to ephedra in the short-term inquiry information, and then the prescription E is deleted to generate the first consultation result.
[0160] The consultation result generation method provided by the embodiment of the application can significantly improve the accuracy of differentiation by fusing the current inquiry information and the multi-round dialogue inquiry data into personalized retrieval conditions, and filter out the preliminary retrieval result more suitable for the individual user. On this basis, the multi-source knowledge fusion is performed on the initial retrieval result and the multi-round dialogue inquiry data to obtain structured enhanced prompt information. This process can effectively reduce the length of the prompt information while retaining the key decision information. The first consultation result is generated based on the enhanced prompt information, which can effectively improve the generation efficiency and meet the real-time requirement of consultation.
[0161] Based on any of the above embodiments, the preset traditional Chinese medicine knowledge base includes a plurality of professional levels of traditional Chinese medicine knowledge bases, and step S132 includes steps S1321, S1322, S1323, S1324 and S1325.
[0162] In step S1321, the first retrieval result and the first retrieval similarity are retrieved from a first-level traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector.
[0163] In this embodiment, the preset traditional Chinese medicine knowledge base can be divided into a plurality of professional levels of traditional Chinese medicine knowledge bases according to the professional degree. For example, the preset traditional Chinese medicine knowledge base can include a first-level traditional Chinese medicine knowledge base, a second-level traditional Chinese medicine knowledge base and a third-level traditional Chinese medicine knowledge base, and the professional levels decrease in turn.
[0164] Exemplarily, the state-standard prescription text can be classified into a first-level traditional Chinese medicine knowledge base, which can include classic classical prescription texts such as Treatise on Febrile Diseases, to ensure that the prescription basis is reliable; the clinical guideline text in the past five years can be classified into a second-level traditional Chinese medicine knowledge base, which can include Chinese medicine books integrating modern clinical consensus such as the Guide to Diagnosis and Treatment of Chronic Cough in Traditional Chinese Medicine; and the famous doctor's case text database can be classified into a third-level traditional Chinese medicine knowledge base, which can include some records of experience prescriptions of national medical masters.
[0165] First, the retrieval result (denoted as the first retrieval result) and the retrieval similarity (denoted as the first retrieval similarity) are retrieved from a first-level traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector.
[0166] In step S1322, when the first retrieval similarity is greater than a preset similarity threshold, the first retrieval result is determined as the initial retrieval result.
[0167] Then, it is detected whether the first search similarity is greater than a preset similarity threshold. If the first search similarity is greater than the preset similarity threshold, it is determined that the current first search result is accurate, and the first search result is determined as the initial search result.
[0168] In step S1323, when the first search similarity is less than or equal to the preset similarity threshold, a second search result and a second search similarity are searched from a second TCM knowledge base in the preset TCM knowledge base according to the symptom feature vector and the medical history feature vector, where the professional level of the second TCM knowledge base is lower than that of the first TCM knowledge base.
[0169] When the first search similarity is less than or equal to the preset similarity threshold, it is determined that the current first search result has a poor matching degree, and the next professional level of the TCM knowledge base is searched, specifically, a search result (denoted as a second search result) and a search similarity (denoted as a second search similarity) are searched from a second TCM knowledge base in the preset TCM knowledge base according to the symptom feature vector and the medical history feature vector.
[0170] In step S1324, when the second search similarity is greater than the preset similarity threshold, the second search result is determined as the initial search result.
[0171] Then, it is detected whether the second search similarity is greater than the preset similarity threshold. If the second search similarity is greater than the preset similarity threshold, it is determined that the current second search result is accurate, and the second search result is determined as the initial search result.
[0172] In step S1325, when the second search similarity is less than or equal to the preset similarity threshold, the next professional level of the TCM knowledge base is searched, and the process is repeated until the search similarity of the searched result is greater than the preset similarity threshold, and the searched result corresponding to the search similarity is determined as the initial search result.
[0173] When the second search similarity is less than or equal to the preset similarity threshold, it is determined that the current second search result has a poor matching degree, and the next professional level of the TCM knowledge base is searched, and the process is repeated until the search similarity of the searched result is greater than the preset similarity threshold, and the searched result corresponding to the search similarity is determined as the initial search result.
[0174] It should be noted that if all levels of Chinese medicine knowledge bases are retrieved, and all retrieval similarities are less than or equal to the preset similarity threshold, any of the following operations can be performed: 1) the retrieval result corresponding to the maximum retrieval similarity is taken as the preliminary retrieval result; 2) the current inquiry information, the multi-round dialogue inquiry data, the retrieval result and the retrieval similarity are sent to the expert end for analysis by the expert, and the retrieval result fed back by the expert end is taken as the preliminary retrieval result.
[0175] The consultation result generation method provided by the embodiment of the application has the following advantages: when searching, the highest professional level Chinese medicine knowledge base is searched first, and when the search similarity is poor, the next level Chinese medicine knowledge base is further searched until the search result with the search similarity is searched. Through the above priority search strategy, the search efficiency can be improved as much as possible under the premise of ensuring the authority and relevance of the search result.
[0176] Based on any of the above embodiments, Figure 5 is a fourth flowchart of the consultation result generation method provided by the application, as Figure 5 shown, the consultation result generation method can further include steps S150, S160, S170 and S180.
[0177] Step S150, periodically acquiring the to-be-updated Chinese medicine data from the preset data source.
[0178] The preset data source is a pre-set data acquisition source, for example, CNKI academic literature library, Chinese medicine clinical guideline library.
[0179] The preset data source can be periodically crawled to obtain the to-be-updated Chinese medicine data. The crawling frequency can be pre-set according to the update speed and content importance of the data source. For example, it can be set to once a week, once a day, etc.
[0180] Step S160, determining the similarity between the to-be-updated Chinese medicine data and the existing Chinese medicine data in the preset Chinese medicine knowledge base through the contrast learning model.
[0181] After obtaining the to-be-updated Chinese medicine data, the similarity between the to-be-updated Chinese medicine data and the existing Chinese medicine data in the preset Chinese medicine knowledge base can be determined to judge the degree of association between the new data and the existing Chinese medicine data.
[0182] Specifically, the similarity can be determined by a contrast learning model. The contrast learning model is trained based on positive samples and negative samples. Similar TCM knowledge can be selected as the positive samples. For example, different treatment plans for the same disease, descriptions of the efficacy of the same traditional Chinese medicine in different literatures, etc. These samples have high semantic similarity and can help the model learn the common features of similar knowledge. Select TCM knowledge with large differences as negative samples. For example, treatment methods for different diseases, efficacy descriptions of different traditional Chinese medicines, etc. These samples have obvious differences in semantics and can help the model distinguish different types of knowledge. Based on the positive samples and the negative samples, a contrast learning model is trained using a deep learning framework, wherein the deep learning framework can use PyTorch, TensorFlow. By minimizing the distance of the positive samples and maximizing the distance of the negative samples, the model can learn the similarity and difference features between texts. In the training process, appropriate loss functions (such as contrast loss functions) and optimizers (such as Adam (Adam Adaptive Moment Estimation, adaptive moment estimation)) can be used, and hyperparameter tuning can be performed to improve the performance of the model.
[0183] The similarity can be represented by cosine similarity or Euclidean distance.
[0184] Further, before determining the similarity, the TCM data to be updated can be preprocessed. The preprocessing methods include data cleaning, word segmentation and part-of-speech tagging, and entity recognition. The data cleaning includes removal of noise information, such as irrelevant advertising content, format error characters, duplicate records, etc. The data cleaning also includes spelling correction, punctuation unification, etc. to ensure the accuracy and consistency of the data. Word segmentation and part-of-speech tagging can use Chinese word segmentation tools, such as jieba (Jieba Chinese Word Segmentation), HanLP (Han Language Processing). Entity recognition can be performed using rule-based methods (such as matching using TCM terminology dictionaries) or machine learning-based methods to ensure accurate extraction of related entities. Through preprocessing, the data quality can be improved.
[0185] In step S170, the target update method is determined according to the similarity.
[0186] The target update method is determined according to the similarity.
[0187] Specifically, if the similarity between the to-be-updated traditional Chinese medicine data and the existing traditional Chinese medicine data is greater than the preset similarity threshold, it is determined that the to-be-updated traditional Chinese medicine data and the existing traditional Chinese medicine data are similar or related knowledge. At this time, it is determined that the target updating mode is fusion updating. If the similarity between the to-be-updated traditional Chinese medicine data and the existing traditional Chinese medicine data is less than or equal to the preset similarity threshold, it is determined that the to-be-updated traditional Chinese medicine data is new knowledge. At this time, it is determined that the target updating mode is new addition updating.
[0188] In step S180, the preset traditional Chinese medicine knowledge base is updated according to the target updating mode.
[0189] If the target updating mode is fusion updating, the to-be-updated traditional Chinese medicine data and the existing traditional Chinese medicine data with high similarity corresponding thereto are fused. The to-be-updated traditional Chinese medicine data is fused into the corresponding existing traditional Chinese medicine data to avoid repeated storage.
[0190] Exemplarily, for the treatment scheme of the same disease, if the to-be-updated traditional Chinese medicine data mentions a new drug dosage or a matter needing attention, it can be integrated into the existing traditional Chinese medicine data.
[0191] If the target updating mode is new addition updating, the to-be-updated traditional Chinese medicine data is directly added to the preset traditional Chinese medicine knowledge base. It should be noted that in the process of new addition, the structured storage of the to-be-updated traditional Chinese medicine data is ensured, and the input is performed according to the format requirements of the preset traditional Chinese medicine knowledge base.
[0192] The consultation result generation method provided by the embodiment of the application can ensure that the traditional Chinese medicine knowledge system keeps pace with the times, make the consultation result inherit the classics and fit the modern clinical progress, and further improve the accuracy of the consultation result.
[0193] Based on any of the above embodiments, before step S180, the consultation result generation method can further include step S190.
[0194] In step S190, conflict detection is performed on the to-be-updated traditional Chinese medicine data and the existing traditional Chinese medicine data to obtain a conflict detection result.
[0195] In the traditional Chinese medicine knowledge base, conflicts can be mainly divided into the following three categories: 1) treatment scheme conflict: different knowledge contents propose different treatment methods, drug prescriptions, dosage requirements, etc. for the same disease. 2) disease diagnosis conflict: different knowledge gives different disease diagnosis results for the same symptom. 3) traditional Chinese medicine attribute conflict: there are differences in the attribute description of the same traditional Chinese medicine, such as nature, taste, meridian, and efficacy.
[0196] Before updating the preset traditional Chinese medicine knowledge base, it is necessary to detect whether there is a conflict between the to-be-updated traditional Chinese medicine data and the stored traditional Chinese medicine data.
[0197] Specifically, the corresponding conflict detection rule can be preset in advance, and then the conflict detection rule is used to detect the conflict between the to-be-updated traditional Chinese medicine data and the stored traditional Chinese medicine data, and a conflict detection result is obtained. The preset conflict detection rule can include but is not limited to: 1) entity association rule: an association relationship library between entities such as diseases, treatment schemes, and traditional Chinese medicines is established. When the association between a disease and a treatment scheme in the to-be-updated traditional Chinese medicine data is inconsistent with the association in the library, it is determined that there may be a conflict. 2) Attribute matching rule: attribute standard range is set for each entity such as traditional Chinese medicine and disease. When the attribute of the entity in the to-be-updated traditional Chinese medicine data exceeds or does not match the standard range, the conflict is marked. 3) Logic reasoning rule: logical relationship in the field of traditional Chinese medicine is used for reasoning detection. For example, according to the theory of traditional Chinese medicine, a certain type of disease is prohibited to use a certain type of traditional Chinese medicine. If the to-be-updated traditional Chinese medicine data appears the use of this type of traditional Chinese medicine for the disease, it is determined that there is a logical conflict.
[0198] When it is detected that there is no conflict, step S180 is performed: the preset traditional Chinese medicine knowledge base is updated according to the target update mode.
[0199] When it is detected that there is no conflict, the preset traditional Chinese medicine knowledge base is updated according to the target update mode.
[0200] Further, when it is detected that there is a conflict, no update is performed, or the update mode is evaluated according to the credibility of the data. The credibility can be evaluated according to factors such as the source journal impact factor of the literature, the authority of the author, and the sample size of the research. For new knowledge with high credibility, the existing knowledge can be corrected; for new knowledge with low credibility, it can be marked as controversial knowledge for subsequent research reference.
[0201] The consultation result generation method provided by the embodiment of the application first detects whether there is a conflict between the to-be-updated traditional Chinese medicine data and the stored traditional Chinese medicine data in the preset traditional Chinese medicine knowledge base before updating the preset traditional Chinese medicine knowledge base. When there is no conflict, the update can be performed. Through conflict detection, the accuracy and reliability of the knowledge base can be ensured.
[0202] The application scenario of the consultation result generation method provided by the application is exemplified as follows.
[0203] Application scenario 1: Traditional Chinese medicine auxiliary diagnosis.
[0204] The patient inputs "cough for 2 weeks, yellow and sticky sputum, morning aggravation, red tongue and yellow fur" through text, and the TCM syndrome characteristics obtained through extraction and mapping are obtained. The short-term inquiry information "has a history of smoking" is obtained from the short-term memory network, and the preset TCM knowledge base is retrieved to obtain the following consultation results: recommend "Qingfei Huatan Decoction" and prompt "avoid spicy and greasy, cooperate with lung acupoint massage".
[0205] Application scenario 2: chronic disease management.
[0206] For "hypertension combined with phlegm-dampness constitution" patients, analyze the symptom changes in the past six months of conversation records through the long-term memory network, generate an annual paste formula conditioning scheme, and dynamically adjust the dosage of Fuling, Zexie and other drugs.
[0207] The consultation result generation device provided by the application is described below. The consultation result generation device described below can be referred to in conjunction with the consultation result generation method described above.
[0208] Figure 6 The structure diagram of the consultation result generation device provided by the application is shown in Figure 6 The device includes a receiving module 610, an acquisition module 620, a retrieval module 630 and a generation module 640; wherein:
[0209] The receiving module 610 is configured to receive the current inquiry information input by the user;
[0210] The acquisition module 620 is configured to acquire the multi-round conversation inquiry data of the user through the short-term memory network and / or the long-term memory network according to the current inquiry information; wherein the multi-round conversation inquiry data includes at least one of the short-term inquiry information in the current conversation and the long-term inquiry result in the historical conversation;
[0211] The retrieval module 630 is configured to retrieve the first consultation result according to the current inquiry information and the multi-round conversation inquiry data through retrieval enhancement generation technology;
[0212] The generation module 640 is configured to generate the second consultation result according to the current inquiry information, the multi-round conversation inquiry data and the first consultation result through the generation model.
[0213] The consultation result generation device provided by the embodiment of the present application first receives current inquiry information input by a user, acquires multi-round dialogue inquiry data of the user according to the current inquiry information, and the multi-round dialogue inquiry data includes short-term inquiry information in the current dialogue and / or long-term inquiry results in historical dialogues. Then, a first consultation result is acquired through retrieval enhanced generation technology, and a second consultation result is output by using a generation model. The embodiment of the present application produces significant beneficial effects in the process of traditional Chinese medicine inquiry consultation. Specifically, the embodiment of the present application realizes rapid access of multi-round dialogue data through a short-term memory network and a long-term memory network, reduces data processing delay, efficiently retrieves a first consultation result through retrieval enhanced generation technology, avoids redundant calculation of a generation model, thereby improving overall response speed, making the generation of a second consultation result more efficient, and reducing user waiting time. Meanwhile, the embodiment of the present application ensures the coherence and integrity of consultation content by using context integration of multi-round dialogue data, and provides reliable first consultation results as factual basis through retrieval enhanced generation technology, and the generation model is further optimized on this basis, effectively reducing the risk of errors or omissions, thereby improving the accuracy and reliability of the consultation result. In addition, the generation model combines multi-dimensional input data to generate highly targeted second consultation results, realizes deep adaptation to user needs, and improves the personalization and satisfaction of the consultation experience. Overall, these effects work together, not only significantly improve the generation efficiency, accuracy and personalization level of the consultation result, but also enhance user trust and practicality.
[0214] According to the consultation result generation device provided by the present application, the acquisition module 620 comprises:
[0215] The extraction unit is configured to extract a first keyword in the current inquiry information.
[0216] The mapping unit is configured to map the first keyword to a second keyword, and the second keyword is a traditional Chinese medicine syndrome differentiation feature.
[0217] The first acquisition unit is configured to acquire short-term inquiry information in the current dialogue of the user according to the second keyword through the short-term memory network.
[0218] The abstract generation unit is configured to generate an inquiry abstract text according to the short-term inquiry information and the current inquiry information.
[0219] The second acquisition unit is configured to acquire a long-term inquiry result in the historical dialogue of the user according to the second keyword and the inquiry abstract text through the long-term memory network, and the long-term inquiry result includes at least one of historical consultation results and historical feedback information.
[0220] According to the consultation result generation device provided by the application, the abstract generation unit is specifically used for:
[0221] Detecting whether the current inquiry information and the short-term inquiry information exist semantic contradiction, obtaining a detection result;
[0222] Fusing the current inquiry information and the short-term inquiry information according to the detection result, obtaining fused inquiry information;
[0223] Generating inquiry abstract text according to the fused inquiry information.
[0224] According to the consultation result generation device provided by the application, the generation module 640 is specifically used for:
[0225] Generating a second consultation result through the generation model according to the second keyword, the inquiry abstract text, the long-term inquiry result and the first consultation result; wherein the second consultation result comprises at least one of a Chinese medicine syndrome differentiation conclusion, a treatment method, a prescription formula and a matter needing attention.
[0226] According to the consultation result generation device provided by the application, the retrieval module 630 comprises:
[0227] A vector generation unit is configured to generate a symptom feature vector according to the current inquiry information and a medical history feature vector according to the multi-round dialogue inquiry data;
[0228] A retrieval unit is configured to retrieve an initial retrieval result from a preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector; wherein the initial retrieval result comprises at least one of a syndrome differentiation rule, a historical case and a recommended prescription;
[0229] A fusion unit is configured to fuse the initial retrieval result and the multi-round dialogue inquiry data to obtain enhanced prompt information;
[0230] A result generation unit is configured to generate a first consultation result according to the enhanced prompt information.
[0231] According to the consultation result generation device provided by the application, the preset traditional Chinese medicine knowledge base comprises a plurality of professional-level traditional Chinese medicine knowledge bases, and the retrieval unit is specifically used for:
[0232] Retrieving a first retrieval result and a first retrieval similarity from a first-level traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector;
[0233] When the first retrieval similarity is greater than a preset similarity threshold, the first retrieval result is determined as the initial retrieval result;
[0234] When the first retrieval similarity is less than or equal to the preset similarity threshold, then according to the symptom feature vector and the medical history feature vector, a second retrieval result and a second retrieval similarity are retrieved from a secondary traditional Chinese medicine knowledge base in the preset traditional Chinese medicine knowledge base; wherein the professional level of the secondary traditional Chinese medicine knowledge base is lower than that of the primary traditional Chinese medicine knowledge base;
[0235] When the second retrieval similarity is greater than the preset similarity threshold, then the second retrieval result is determined as the initial retrieval result;
[0236] When the second retrieval similarity is less than or equal to the preset similarity threshold, then a traditional Chinese medicine knowledge base of a next level is continuously retrieved, and the same is repeated until the retrieved retrieval similarity is greater than the preset similarity threshold, and the retrieved retrieval result corresponding thereto is determined as the preliminary retrieval result.
[0237] According to the consultation result generation device provided by the present application, the updating module is further used for:
[0238] Periodically acquiring traditional Chinese medicine data to be updated from a preset data source;
[0239] Determining the similarity between the traditional Chinese medicine data to be updated and the stored traditional Chinese medicine data in the preset traditional Chinese medicine knowledge base through a contrast learning model;
[0240] According to the similarity, a target updating mode is determined;
[0241] According to the target updating mode, the preset traditional Chinese medicine knowledge base is updated.
[0242] According to the consultation result generation device provided by the present application, the updating module is further used for:
[0243] Conflict detection is performed on the traditional Chinese medicine data to be updated and the stored traditional Chinese medicine data, and a conflict detection result is obtained;
[0244] When no conflict is detected, the updating of the preset traditional Chinese medicine knowledge base according to the target updating mode is performed.
[0245] It should be noted that the above consultation result generation device provided by the present application embodiment can realize all the method steps realized by the above consultation result generation method embodiment, and can achieve the same technical effects, and the same parts and beneficial effects in the method embodiment will not be described in detail.
[0246] Figure 7 An example of an entity structure schematic diagram of an electronic device is shown in FIG. 1. Figure 7As shown, the electronic device can include a processor 710, a communications interface 720, a memory 730, and a communications bus 740, wherein the processor 710, the communications interface 720, and the memory 730 complete mutual communication through the communications bus 740. The processor 710 can invoke a logical instruction in the memory 730 to execute the consultation result generation method, which includes receiving current consultation information input by a user; acquiring multi-round dialogue consultation data of the user according to the current consultation information through a short-term memory network and / or a long-term memory network; wherein the multi-round dialogue consultation data includes at least one of short-term consultation information in a current dialogue and long-term consultation results in a historical dialogue; retrieving a first consultation result according to the current consultation information and the multi-round dialogue consultation data through a retrieval enhancement generation technology; and generating a second consultation result according to the current consultation information, the multi-round dialogue consultation data, and the first consultation result through a generation model.
[0247] In addition, the logical instructions in the memory 730 described above can be implemented in the form of a software functional unit and sold or used as an independent product, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.
[0248] The device embodiments described above are only schematic, wherein the units shown as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place, or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment according to actual needs. Those skilled in the art can understand and implement it without creative labor.
[0249] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0250] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of generating a consultation result, characterized by, The method comprises the following steps: receiving current consultation information input by a user; extracting a first keyword in the current consultation information, and mapping the first keyword to a second keyword, which is a traditional Chinese medicine syndrome differentiation feature; obtaining short-term consultation information in a current dialogue of the user through a short-term memory network according to the second keyword; generating a consultation summary text according to the short-term consultation information and the current consultation information; obtaining long-term consultation results in a historical dialogue of the user through a long-term memory network according to the second keyword and the consultation summary text; wherein the long-term consultation results include at least one of historical consultation results and historical feedback information, and multi-round dialogue consultation data include short-term consultation information in the current dialogue and long-term consultation results in the historical dialogue; retrieving a first consultation result according to the current consultation information and the multi-round dialogue consultation data through a retrieval and enhancement generation technology; generating a second consultation result according to the current consultation information, the multi-round dialogue consultation data and the first consultation result through a generation model.
2. The consultation result generation method according to claim 1, characterized by, The method further comprises the following steps: detecting whether there is a semantic contradiction between the current consultation information and the short-term consultation information to obtain a detection result; fusing the current consultation information and the short-term consultation information according to the detection result to obtain fused consultation information; generating a consultation summary text according to the fused consultation information.
3. The consultation result generation method according to claim 1, characterized by, The method further comprises the following steps: generating a second consultation result according to the second keyword, the consultation summary text, the long-term consultation results and the first consultation result through the generation model; wherein the second consultation result includes at least one of a traditional Chinese medicine syndrome differentiation conclusion, a treatment method, a prescription formula and precautions.
4. The consultation result generation method according to any one of claims 1 to 3, characterized by, The method further comprises the following steps: generating a symptom feature vector according to the current consultation information, and generating a medical history feature vector according to the multi-round dialogue consultation data; retrieving an initial retrieval result from a preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector; wherein the initial retrieval result includes at least one of a syndrome differentiation rule, a historical case and a recommended prescription; fusing the initial retrieval result and the multi-round dialogue consultation data to obtain enhanced prompt information; generating a first consultation result according to the enhanced prompt information.
5. The consultation result generation method according to claim 4, characterized by, The preset traditional Chinese medicine knowledge base includes multiple professional-level traditional Chinese medicine knowledge bases, and the method further comprises the following steps: retrieving a first retrieval result and a first retrieval similarity from a first-level traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector. When the first retrieval similarity is greater than a preset similarity threshold, the first retrieval result is determined as the initial retrieval result; When the first retrieval similarity is less than or equal to the preset similarity threshold, a second retrieval result and a second retrieval similarity are retrieved from a secondary traditional Chinese medicine knowledge base in a preset traditional Chinese medicine knowledge base according to the symptom feature vector and the medical history feature vector, where the professional level of the secondary traditional Chinese medicine knowledge base is lower than that of the primary traditional Chinese medicine knowledge base; When the second retrieval similarity is greater than the preset similarity threshold, the second retrieval result is determined as the initial retrieval result; When the second retrieval similarity is less than or equal to the preset similarity threshold, a traditional Chinese medicine knowledge base of a next level is continuously retrieved, and the same is repeated until the retrieval similarity of a corresponding retrieval result is greater than the preset similarity threshold, and the retrieval result corresponding to the retrieval similarity is determined as the preliminary retrieval result.
6. The consultation result generation method according to claim 4, characterized by, The consultation result generation method further includes: periodically acquiring to-be-updated traditional Chinese medicine data from a preset data source; determining the similarity between the to-be-updated traditional Chinese medicine data and the stored traditional Chinese medicine data in the preset traditional Chinese medicine knowledge base through a contrast learning model; determining a target updating mode according to the similarity; updating the preset traditional Chinese medicine knowledge base according to the target updating mode.
7. The consultation result generation method according to claim 6, characterized by, Before the updating of the preset traditional Chinese medicine knowledge base according to the target updating mode, the method further includes: performing conflict detection on the to-be-updated traditional Chinese medicine data and the stored traditional Chinese medicine data to obtain a conflict detection result; when no conflict is detected, performing the updating of the preset traditional Chinese medicine knowledge base according to the target updating mode.
8. A consultation result generation apparatus characterized by comprising: The method includes: a receiving module configured to receive current inquiry information input by a user; an acquiring module configured to acquire multi-round dialogue inquiry data of the user through a short-term memory network and a long-term memory network according to the current inquiry information, where the multi-round dialogue inquiry data includes short-term inquiry information in a current dialogue and long-term inquiry results in historical dialogues; a retrieval module configured to retrieve a first consultation result according to the current inquiry information and the multi-round dialogue inquiry data through retrieval enhancement generation technology; a generating module configured to generate a second consultation result according to the current inquiry information, the multi-round dialogue inquiry data and the first consultation result through a generation model; the acquiring module is specifically configured to: extract a first keyword in the current inquiry information; map the first keyword to a second keyword, where the second keyword is a traditional Chinese medicine syndrome differentiation feature; acquire short-term inquiry information in a current dialogue of the user according to the second keyword through the short-term memory network; generate an inquiry abstract text according to the short-term inquiry information and the current inquiry information; acquire long-term inquiry results in historical dialogues of the user according to the second keyword and the inquiry abstract text through the long-term memory network, where the long-term inquiry results include at least one of historical consultation results and historical feedback information.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, The processor executes the computer program to implement the consultation result generation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Knowledge retrieval enhancement-based large language model question and answer method and device
CN118113836A
Pre-inquiry method based on long-term and short-term memory management large model
CN120388713A