CN117093679A - Large language model intelligent inquiry dialogue method, system, equipment and medium - Google Patents
Large language model intelligent inquiry dialogue method, system, equipment and medium Download PDFInfo
- Publication number
- CN117093679A CN117093679A CN202310728502.5A CN202310728502A CN117093679A CN 117093679 A CN117093679 A CN 117093679A CN 202310728502 A CN202310728502 A CN 202310728502A CN 117093679 A CN117093679 A CN 117093679A
- Authority
- CN
- China
- Prior art keywords
- knowledge
- dialogue
- user
- consultation
- information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 230000008569 process Effects 0.000 claims description 17
- 208000024891 symptom Diseases 0.000 claims description 10
- 238000012216 screening Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004458 analytical method Methods 0.000 claims description 6
- 206010020751 Hypersensitivity Diseases 0.000 claims description 5
- 208000026935 allergic disease Diseases 0.000 claims description 5
- 230000007815 allergy Effects 0.000 claims description 5
- 229940079593 drug Drugs 0.000 claims description 4
- 239000003814 drug Substances 0.000 claims description 4
- 238000005516 engineering process Methods 0.000 claims description 4
- 238000004422 calculation algorithm Methods 0.000 claims description 3
- 238000009223 counseling Methods 0.000 claims description 3
- 238000012545 processing Methods 0.000 claims description 3
- 230000004044 response Effects 0.000 abstract description 7
- 238000004364 calculation method Methods 0.000 abstract description 5
- 208000004998 Abdominal Pain Diseases 0.000 description 20
- 238000010586 diagram Methods 0.000 description 4
- 208000005577 Gastroenteritis Diseases 0.000 description 3
- 230000009471 action Effects 0.000 description 3
- 210000002826 placenta Anatomy 0.000 description 3
- 206010000242 Abortion threatened Diseases 0.000 description 2
- 208000005985 Threatened Abortion Diseases 0.000 description 2
- 210000001015 abdomen Anatomy 0.000 description 2
- 235000013305 food Nutrition 0.000 description 2
- 230000002496 gastric effect Effects 0.000 description 2
- 210000004877 mucosa Anatomy 0.000 description 2
- 230000035935 pregnancy Effects 0.000 description 2
- 230000002028 premature Effects 0.000 description 2
- 238000002360 preparation method Methods 0.000 description 2
- 238000012549 training Methods 0.000 description 2
- 208000031404 Chromosome Aberrations Diseases 0.000 description 1
- 241000219109 Citrullus Species 0.000 description 1
- 235000012828 Citrullus lanatus var citroides Nutrition 0.000 description 1
- 206010067477 Cytogenetic abnormality Diseases 0.000 description 1
- 206010020772 Hypertension Diseases 0.000 description 1
- 208000036029 Uterine contractions during pregnancy Diseases 0.000 description 1
- 206010046788 Uterine haemorrhage Diseases 0.000 description 1
- 206010046910 Vaginal haemorrhage Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000003750 conditioning effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000037213 diet Effects 0.000 description 1
- 235000005911 diet Nutrition 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 210000001161 mammalian embryo Anatomy 0.000 description 1
- 238000005065 mining Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000001575 pathological effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/31—Indexing; Data structures therefor; Storage structures
- G06F16/316—Indexing structures
- G06F16/319—Inverted lists
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/042—Knowledge-based neural networks; Logical representations of neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/01—Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/02—Knowledge representation; Symbolic representation
- G06N5/022—Knowledge engineering; Knowledge acquisition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
-
- G—PHYSICS
- G16—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
- G16H—HEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
- G16H40/00—ICT specially adapted for the management or administration of healthcare resources or facilities; ICT specially adapted for the management or operation of medical equipment or devices
- G16H40/60—ICT specially adapted for the management or administration of healthcare resources or facilities; ICT specially adapted for the management or operation of medical equipment or devices for the operation of medical equipment or devices
- G16H40/67—ICT specially adapted for the management or administration of healthcare resources or facilities; ICT specially adapted for the management or operation of medical equipment or devices for the operation of medical equipment or devices for remote operation
-
- G—PHYSICS
- G16—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
- G16H—HEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
- G16H80/00—ICT specially adapted for facilitating communication between medical practitioners or patients, e.g. for collaborative diagnosis, therapy or health monitoring
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Epidemiology (AREA)
- Primary Health Care (AREA)
- Public Health (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- General Business, Economics & Management (AREA)
- Business, Economics & Management (AREA)
- Pathology (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a large language model intelligent inquiry dialogue method, a system, equipment and a medium, comprising the following steps: acquiring user information before inquiry; according to the user information before inquiry, carrying out user intention prediction and related knowledge search to obtain a first knowledge search result, and taking the first knowledge search result as an initial dynamic knowledge set; acquiring user input content, and taking a dynamic knowledge set as background information; fusing user input content and background information and constructing a target promt; inputting the target prompt into a large language model to obtain inquiry reasoning; carrying out user intention prediction and related knowledge search asynchronously according to the existing dialogue history information and the user information while carrying out inquiry reasoning to obtain a second knowledge search result and updating the second knowledge search result into a dynamic knowledge set; and taking the updated dynamic knowledge set as background information of a follow-up consultation dialogue. The invention reduces the fact-type errors and ensures the real-time performance of dialogue response through the pre-calculation and asynchronously updated dynamic knowledge set.
Description
Technical Field
The invention relates to the technical field of intelligent medical treatment, in particular to a large language model intelligent inquiry dialogue method, a large language model intelligent inquiry dialogue system, large language model intelligent inquiry dialogue equipment and medium.
Background
Conventional dialogue systems include Natural Language Understanding (NLU), dialogue management, natural Language Generation (NLG), etc. in order for the system to better understand input information and output desired results, many tasks such as feature mining, rule writing, template design, etc. are often required to be manually engaged. The novel dialogue model such as ChatGPT based on the large language model (Large Language Model, LLM) has strong natural language understanding and generating capability, can automatically learn and infer the intention and the semanteme of a user, and generate natural and smooth answers, thereby bringing new paradigms and prospects for realization and application of a dialogue system.
The medical consultation dialogue is a very serious application scene, and has very high requirements on the authenticity and accuracy of the reply content. LLM, while capable of generating natural fluent replies, is difficult to avoid factual errors. To reduce such errors, it is generally considered to combine with a search engine, such as the New Bing chat function, to search for relevant content prior to replying, and then to reply by LLM inferentially based on user input and search content. However, this LLM combined with search method is difficult to meet the requirements of dialogue systems with high real-time requirements, such as online voice or video interrogation. While LLM reasoning can guarantee response instantaneity through streaming response, failure of the search process to do streaming response creates a bottleneck for response time of such dialog systems.
Disclosure of Invention
In order to solve the problems, the technical scheme provided by the invention is as follows:
an intelligent inquiry dialogue method for a large language model, comprising the following steps:
acquiring user information before inquiry;
according to the user information before inquiry, carrying out user intention prediction and related knowledge search for a subsequent inquiry dialogue to obtain a first knowledge search result, and taking the first knowledge search result as an initial dynamic knowledge set;
acquiring user input content, and taking the dynamic knowledge set as background information; fusing the user input content and the background information and constructing a target campt; inputting the target prompt into a large language model to obtain inquiry reasoning for answering the input content;
asynchronous user intention prediction and related knowledge search are carried out according to the existing dialogue history information and the pre-consultation user information, a second knowledge search result is obtained, and the second knowledge search result is updated to the dynamic knowledge set; and taking the updated dynamic knowledge set as background information of a follow-up consultation dialogue.
The present invention is further arranged such that the user intention prediction comprises: and constructing user intention prediction campt according to the pre-consultation user information or dialogue history information, and calling a large language model to predict and obtain a plurality of problems possibly consulted by the user in the subsequent dialogue.
The invention is further arranged that the knowledge search comprises: according to the predicted user problem, carrying out knowledge search on an external knowledge base to obtain the first knowledge search result or the second knowledge search result;
if the external knowledge base is structured data, analyzing the predicted user problem by using an entity recognition, relationship recognition or intention understanding algorithm, and converting the predicted user problem into a query condition of the external knowledge base for query to obtain a knowledge search result;
if the external knowledge base is unstructured data, using a text search technology, carrying out entity recognition, intention understanding or query rewrite processing on the predicted user problem through a query analysis model, screening a candidate set related to query from query data through inverted index recall or semantic vector recall, and carrying out fine screening by using a sorting model or a sorting strategy on the basis of recall to obtain a candidate set to obtain a final knowledge search result.
The invention further provides that the first knowledge search result or the obtained second knowledge search result is temporarily stored in a memory or a cache as background information of a subsequent consultation session.
The invention is further arranged that the target template comprises an instruction part, a background information part and an input content part; the instruction part is a task to be executed by the large language model, the background information part is a knowledge search result obtained by searching, and the input content part is the user input content.
The invention is further arranged to record session ID, pre-consultation user information, user and system session history and dynamic knowledge sets during said consultation session.
The invention is further configured such that the pre-consultation user information includes at least one of a user's age, gender, past medical history, surgical history, allergy history, medication history, complaint symptoms, and counseling appeal.
The large language model intelligent inquiry dialogue system adopts the large language model intelligent inquiry dialogue method, which comprises the following steps:
the information collection module is used for collecting user information before inquiry;
the knowledge storage module comprises a user intention prediction sub-module, a knowledge search sub-module, a knowledge storage sub-module and an information updating sub-module; the user intention prediction submodule predicts the problem that the user possibly consults in the follow-up consultation dialogue according to the user information before the consultation or dialogue history information; the knowledge searching submodule performs knowledge searching according to the predicted user problem to acquire knowledge content required by a subsequent dialogue; the knowledge storage sub-module temporarily stores the searched knowledge content in a memory or a cache for subsequent consultation dialogue; the information updating sub-module updates information required by predicting user intention according to the dialogue process, and uses the updated information for predicting the user intention, so as to update a dynamic knowledge set associated with the current inquiry dialogue;
the inquiry dialogue module comprises a dialogue management module and a large language reasoning module; the dialogue management module is responsible for maintaining and updating the state of the consultation dialogue, and records dialogue ID, user information before the consultation, dialogue history and dynamic knowledge set of the user and the system in the process of the consultation dialogue; and the large language reasoning module is used for reasoning and replying the consultation of the user through the large language model according to the input content and the dynamic knowledge set of the user.
An apparatus comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the large language model intelligent inquiry dialogue method described above.
A storage medium having stored thereon computer program instructions which, when executed by a processor, implement the large language model intelligent inquiry dialogue method described above.
Compared with the prior art, the technical scheme provided by the invention has the following beneficial effects:
according to the technical scheme, the possible intention of the user in the subsequent dialogue is predicted according to the user information collected before the inquiry and the history information in the dialogue process, and the knowledge search is carried out to obtain a dynamic knowledge set, so that background knowledge is provided for the subsequent dialogue. The coverage rate of knowledge is guaranteed by predicting the follow-up intention of the user based on the current information, and the real-time performance of the response of the dialogue process is guaranteed by asynchronous calculation of knowledge updating.
Drawings
FIG. 1 is a flow chart of a large language model intelligent inquiry dialogue method according to an embodiment of the invention.
FIG. 2 is a schematic diagram of a large language model intelligent inquiry dialogue system according to an embodiment of the present invention.
FIG. 3 is a flow chart illustrating the operation of the knowledge storage module according to an embodiment of the present invention.
Fig. 4 is a flowchart illustrating the operation of the inquiry dialogue module according to an embodiment of the present invention.
Fig. 5 is a schematic diagram of user intention prediction by using GPT3.5 according to an embodiment of the present invention.
Fig. 6 is a schematic diagram of query reasoning reply using GPT3.5 according to an embodiment of the present invention.
Fig. 7 is a schematic diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
With reference to fig. 1, the technical scheme of the invention is a large language model intelligent inquiry dialogue method, which comprises the following steps:
s100, acquiring user information before inquiry;
s200, according to the user information before the inquiry, carrying out user intention prediction and related knowledge search for a follow-up inquiry dialogue to obtain a first knowledge search result, and taking the first knowledge search result as an initial dynamic knowledge set;
s300, acquiring user input content, and taking the dynamic knowledge set as background information; fusing the user input content and the background information and constructing a target campt; inputting the target prompt into a large language model to obtain inquiry reasoning for answering the input content;
s400, carrying out asynchronous user intention prediction and related knowledge search according to the existing dialogue history information and the pre-consultation user information to obtain a second knowledge search result, and updating the second knowledge search result into the dynamic knowledge set; and taking the updated dynamic knowledge set as background information of a follow-up consultation dialogue.
In the above embodiment, the first knowledge search result is background knowledge stored in the dynamic knowledge set before the inquiry, and the second knowledge search result is background knowledge updated in the dynamic knowledge set during the inquiry.
In the above embodiment, in a general on-line consultation scenario, the user is required to pre-fill in information related to consultation, so that the doctor can know the condition of the patient, and then perform a consultation session. The specific collection mode can be in the form of dialogue or filling form, and the collected results are stored in the form of JSON, for example: "{" ID ":" user A_0001"," age ": 30", "sex": "female", "crowd label": "pregnant woman", "past medical history": "none", "allergy history": "none", "medication history": "none", "main complaint": abdominal pain "}".
In this embodiment, the user intention prediction includes: and constructing user intention prediction campt according to the pre-consultation user information or conversation history information, and calling a large language model to predict and obtain a plurality of problems most likely to be consulted by the user in the subsequent conversation.
In the above embodiment, the predicted problems to be consulted by the user in the subsequent dialogue are different according to the large language model, and are not uncertain to the scope of claims, and specifically, may be the first 3-5 problems with the highest consultation probability.
In the above embodiment, the problem that the user may consult in subsequent conversations is obtained by constructing the user intent prediction template and invoking the large language model. Taking the above information of the user a_0001 as an example, the user intention prediction template is constructed as follows: "this is an on-line inquiry scenario, consulting user information as follows: age 30, sex female, crowd label pregnant, past medical history, allergy history, medical history, complaint symptoms, abdominal pain. The 3 question types most likely to be asked by the user in the subsequent dialog, each of which gives one of the most likely questions (as complete as possible), are returned as [ { "type": "xxx", "question": "xxx" } ], without explanation. "as shown in fig. 5, the user intention prediction is performed at GPT3.5, and the problem that the user may consult is" what is i's abdominal pain caused by? "," what is my way to safely treat abdominal pain is my pregnancy? "do nothing to notice during pregnancy prevent abdominal pain? ".
In this embodiment, the knowledge search includes: according to the predicted user problem, carrying out knowledge search on an external knowledge base to obtain the first knowledge search result or the second knowledge search result;
if the external knowledge base is structured data, analyzing the predicted user problem by using an entity recognition, relationship recognition or intention understanding algorithm, and converting the predicted user problem into a query condition of the external knowledge base for query to obtain a knowledge search result;
if the external knowledge base is unstructured data, using a text search technology, carrying out entity recognition, intention understanding or query rewrite processing on the predicted user problem through a query analysis model, screening a candidate set related to query from query data through inverted index recall or semantic vector recall, and carrying out fine screening by using a sorting model or a sorting strategy on the basis of recall to obtain a candidate set to obtain a final knowledge search result.
In the above embodiment, also taking the information of the user a_0001 as an example, knowledge searching is performed based on the problem that the user may consult, which is predicted by the user intention, to obtain the knowledge content required by the subsequent dialog.
In the above embodiment, if the external knowledge base is structured data, for the predicted user problem "what is i's abdominal pain caused by? ", into knowledge base query conditions, in the form: "select_cause FROM table_knowledgewhere_type= 'symptom' and_name= 'abdominal pain'; "wherein table_knowledges represents a table of a knowledge base, _name represents a query object name, _type represents a query object type, _cause represents a" cause "attribute of the query object.
In the above embodiment, if the external knowledge base is unstructured data, the text search technology used includes two parts of offline preparation and online calculation, and the offline preparation work includes query analysis model training, index construction, ordering model training and the like; the on-line calculation flow comprises several main links of query analysis, recall and sorting, wherein the query analysis stage mainly comprises the processes of entity identification, intention understanding, query rewriting and the like, the recall stage mainly comprises the steps of quickly screening candidate sets related to the query from a large amount of data, the main modes of recall comprise inverted index recall, semantic vector recall and the like, and the sorting model or strategy is used for further screening on the basis of recall to obtain the candidate sets, so that the final knowledge search result is obtained.
In this embodiment, the first knowledge search result or the obtained second knowledge search result is temporarily stored in a memory or a cache, and is used as background information of a subsequent consultation session.
In the above embodiment, each knowledge point may use a key-value form to represent and store knowledge, where a key represents a name of the knowledge point, and a value represents content of the knowledge point, and generally, more than one knowledge point is required for one query dialog, and multiple knowledge points form a knowledge set. Taking the above information of user a_0001 as an example, it is assumed that "what is the cause of abdominal pain? What are the "and" methods of self-relief of pregnant woman abdominal pain? The two knowledge points are subjected to knowledge searching to obtain the following knowledge contents:
"{" A_0001_dynamic knowledge set "{" what are the common causes of pregnant woman abdominal pain? The causes of abdominal pain in pregnant women can be roughly divided into two types, one of which is physiological and the other of which is pathological, "? "the pregnant woman has symptoms of abdominal pain, and specific reasons for the abdominal pain need to be checked first, so that the pregnant woman can purposefully make a conditioning and then help relieve the symptoms.." }). The knowledge set may be stored with the inquiry session ID in the Redis for use in subsequent inquiry sessions.
In this embodiment, the target sample includes an instruction portion, a background information portion, and an input content portion; the instruction part is a task to be executed by the large language model, the background information part is a knowledge search result obtained by searching, and the input content part is the user input content.
In the above embodiment, taking the user a_0001 consultation as an example, the target campt may be constructed as follows: "this is an on-line inquiry task, which starts a dialogue with the user, with reference to background knowledge and dialogue history. Background knowledge: common causes of abdominal pain in pregnant women: abdominal pain of pregnant women may be caused by gastroenteritis, premature placenta peeling, threatened abortion, etc. If the pregnant woman eats dirty food, gastroenteritis may be caused, and gastrointestinal mucosa is easily stimulated, so that abdominal pain of the pregnant woman is caused. If the pregnant woman suffers from hypertension or the abdomen is wounded, premature placenta peeling may occur, and abdominal pain may occur due to placenta peeling. Threatened abortion may be caused by embryo chromosome abnormality and environmental factors, so that uterine contraction may be caused, and symptoms of abdominal pain and vaginal bleeding may appear in pregnant women. User information: pregnant women, with 30 years old, abdominal pain. The following is the dialog history: the user: how do i just eat a piece of watermelon, how do the bellies get painful? Predicting the next doctor's reply: "as shown in fig. 6, the target template is used as the input of the large language model, and the large language model is called for reasoning, so as to obtain the following reply: "the pregnant woman may have gastroenteritis caused by dirty food, and the gastrointestinal mucosa is easy to be stimulated, thereby causing abdominal pain of the pregnant woman. Advice you to pay attention to diet hygiene, drink more water and rest more. If symptoms are aggravated or accompanied by other symptoms, a prompt medical visit is advised. "
In the above embodiment, the initial dynamic knowledge set of the inquiry session is obtained through user intention prediction and related knowledge search based on the user information and the appeal collected before the inquiry; as the interrogation session progresses, user information and appeal may change, so too will the knowledge points required in the session. The knowledge update and the dialogue process are asynchronous, and dialogue reply reasoning does not need to wait for the knowledge update. In the conversation process, based on the current conversation history information and the user information, the user intention prediction and the related knowledge search are carried out, and then the dynamic knowledge set is updated.
In this embodiment, during the interview session, session ID, pre-interview user information, user and system session history and dynamic knowledge sets are recorded.
In this embodiment, the pre-consultation user information includes at least one of a user's age, gender, past medical history, surgical history, allergy history, medication history, complaint symptoms, and counseling appeal.
In this embodiment, the large language model in the above example is exemplified by GPT3.5, and other large language models may be used instead.
According to the technical scheme, the possible intention of the user in the subsequent dialogue is predicted according to the user information collected before the inquiry and the history information in the dialogue process, and the knowledge search is carried out to obtain a dynamic knowledge set, so that background knowledge is provided for the subsequent dialogue. The coverage rate of knowledge is guaranteed by predicting the follow-up intention of the user based on the current information, and the real-time performance of the response of the dialogue process is guaranteed by asynchronous calculation of knowledge updating.
Example 2
Referring to fig. 2 to fig. 4, the technical scheme of the invention is a large language model intelligent inquiry dialogue system, and the large language model intelligent inquiry dialogue method described in embodiment 1 is adopted, comprising:
the information collection module is used for collecting user information before inquiry;
the knowledge storage module comprises a user intention prediction sub-module, a knowledge search sub-module, a knowledge storage sub-module and an information updating sub-module; the user intention prediction submodule predicts the problem that the user possibly consults in the follow-up consultation dialogue according to the user information before the consultation or dialogue history information; the knowledge searching submodule performs knowledge searching according to the predicted user problem to acquire knowledge content required by a subsequent dialogue; the knowledge storage sub-module temporarily stores the searched knowledge content in a memory or a cache for subsequent consultation dialogue; the information updating sub-module updates information required by predicting user intention according to the dialogue process, and uses the updated information for predicting the user intention, so as to update a dynamic knowledge set associated with the current inquiry dialogue;
the inquiry dialogue module comprises a dialogue management module and a large language reasoning module; the dialogue management module is responsible for maintaining and updating the state of the consultation dialogue, and records dialogue ID, user information before the consultation, dialogue history and dynamic knowledge set of the user and the system in the process of the consultation dialogue; and the large language reasoning module is used for reasoning and replying the consultation of the user through the large language model according to the input content and the dynamic knowledge set of the user.
Example 3
Referring to fig. 7, the technical solution of the present invention is an apparatus, where the apparatus includes a memory 200 and a processor 100, where the memory 200 stores a computer program, and the computer program when executed by the processor 100 causes the processor 100 to execute the large language model intelligent inquiry dialogue method described in embodiment 1.
Example 4
The technical scheme of the invention is that the storage medium is stored with computer program instructions which when executed by a processor realize the large language model intelligent inquiry dialogue method described in the embodiment 1.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. An intelligent inquiry dialogue method for a large language model, which is characterized by comprising the following steps:
acquiring user information before inquiry;
according to the user information before inquiry, carrying out user intention prediction and related knowledge search for a subsequent inquiry dialogue to obtain a first knowledge search result, and taking the first knowledge search result as an initial dynamic knowledge set;
acquiring user input content, and taking the dynamic knowledge set as background information; fusing the user input content and the background information and constructing a target campt; inputting the target prompt into a large language model to obtain inquiry reasoning for answering the input content;
asynchronous user intention prediction and related knowledge search are carried out according to the existing dialogue history information and the pre-consultation user information, a second knowledge search result is obtained, and the second knowledge search result is updated to the dynamic knowledge set; and taking the updated dynamic knowledge set as background information of a follow-up consultation dialogue.
2. The large language model intelligent inquiry dialogue method as claimed in claim 1, wherein said user intention prediction comprises:
and constructing user intention prediction campt according to the pre-consultation user information or dialogue history information, and calling a large language model to predict and obtain a plurality of problems possibly consulted by the user in the subsequent dialogue.
3. The large language model intelligent inquiry dialogue method according to claim 2, wherein the knowledge search comprises:
according to the predicted user problem, carrying out knowledge search on an external knowledge base to obtain the first knowledge search result or the second knowledge search result;
if the external knowledge base is structured data, analyzing the predicted user problem by using an entity recognition, relationship recognition or intention understanding algorithm, and converting the predicted user problem into a query condition of the external knowledge base for query to obtain a knowledge search result;
if the external knowledge base is unstructured data, using a text search technology, carrying out entity recognition, intention understanding or query rewrite processing on the predicted user problem through a query analysis model, screening a candidate set related to query from query data through inverted index recall or semantic vector recall, and carrying out fine screening by using a sorting model or a sorting strategy on the basis of recall to obtain a candidate set to obtain a final knowledge search result.
4. The method of claim 3, wherein the first knowledge search result or the obtained second knowledge search result is temporarily stored in a memory or a cache as background information of a subsequent consultation session.
5. The large language model intelligent consultation dialogue method according to claim 4, wherein the target prompt comprises an instruction part, a background information part and an input content part; the instruction part is a task to be executed by the large language model, the background information part is a knowledge search result obtained by searching, and the input content part is the user input content.
6. A large language model intelligent consultation dialogue method according to any of claims 1 to 5 characterised in that dialogue ID, pre-consultation user information, user and system dialogue history and dynamic knowledge sets are recorded during the consultation dialogue.
7. A large language model intelligent consultation dialogue method according to any of claims 1 to 5 characterised in that the pre-consultation user information includes at least one of user age, sex, past medical history, surgical history, allergy history, medication history, complaint symptoms and counseling appeal.
8. A large language model intelligent inquiry dialogue system, characterized in that the large language model intelligent inquiry dialogue method as claimed in any one of claims 1 to 7 is adopted, comprising:
the information collection module is used for collecting user information before inquiry;
the knowledge storage module comprises a user intention prediction sub-module, a knowledge search sub-module, a knowledge storage sub-module and an information updating sub-module; the user intention prediction submodule predicts the problem that the user possibly consults in the follow-up consultation dialogue according to the user information before the consultation or dialogue history information; the knowledge searching submodule performs knowledge searching according to the predicted user problem to acquire knowledge content required by a subsequent dialogue; the knowledge storage sub-module temporarily stores the searched knowledge content in a memory or a cache for subsequent consultation dialogue; the information updating sub-module updates information required by predicting user intention according to the dialogue process, and uses the updated information for predicting the user intention, so as to update a dynamic knowledge set associated with the current inquiry dialogue;
the inquiry dialogue module comprises a dialogue management module and a large language reasoning module; the dialogue management module is responsible for maintaining and updating the state of the consultation dialogue, and records dialogue ID, user information before the consultation, dialogue history and dynamic knowledge set of the user and the system in the process of the consultation dialogue; and the large language reasoning module is used for reasoning and replying the consultation of the user through the large language model according to the input content and the dynamic knowledge set of the user.
9. An apparatus comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the large language model intelligent inquiry dialogue method of any one of claims 1 to 7.
10. A storage medium having stored thereon computer program instructions which, when executed by a processor, implement the large language model intelligent inquiry dialogue method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310728502.5A CN117093679B (en) | 2023-06-19 | 2023-06-19 | Large language model intelligent inquiry dialogue method, system, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310728502.5A CN117093679B (en) | 2023-06-19 | 2023-06-19 | Large language model intelligent inquiry dialogue method, system, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117093679A true CN117093679A (en) | 2023-11-21 |
CN117093679B CN117093679B (en) | 2024-04-02 |
Family
ID=88780657
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310728502.5A Active CN117093679B (en) | 2023-06-19 | 2023-06-19 | Large language model intelligent inquiry dialogue method, system, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117093679B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117648424A (en) * | 2023-12-13 | 2024-03-05 | 西湖大学 | System for acquiring domain knowledge of natural medicinal materials |
CN117932041A (en) * | 2024-03-21 | 2024-04-26 | 南京信息工程大学 | Emotion support dialogue generation method, system and device based on thinking chain reasoning |
CN117972075A (en) * | 2024-03-28 | 2024-05-03 | 华南理工大学 | Mental and language agent cooperative emotion dialogue generation method |
CN118039138A (en) * | 2024-04-12 | 2024-05-14 | 北京惠每云科技有限公司 | Controllable path pre-consultation method and device based on large model |
CN118245589A (en) * | 2024-05-28 | 2024-06-25 | 浙江口碑网络技术有限公司 | Task type dialogue method, storage medium and computer device |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106844506A (en) * | 2016-12-27 | 2017-06-13 | 竹间智能科技(上海)有限公司 | The knowledge retrieval method and the automatic improving method of knowledge base of a kind of artificial intelligence dialogue |
CN111221947A (en) * | 2019-12-26 | 2020-06-02 | 北京邮电大学 | Multi-round conversation realization method and device of ophthalmologic pre-inquiry device |
CN111651609A (en) * | 2020-04-24 | 2020-09-11 | 中国电力科学研究院有限公司 | Multi-turn dialogue method and system integrating knowledge graph and emotion supervision |
CN114780694A (en) * | 2022-03-28 | 2022-07-22 | 北京智谱华章科技有限公司 | Zero-fine-tuning anthropomorphic session generation method and equipment based on pre-training language model |
CN114781402A (en) * | 2022-05-12 | 2022-07-22 | 平安科技(深圳)有限公司 | Method and device for identifying inquiry intention, electronic equipment and readable storage medium |
CN115599899A (en) * | 2022-11-08 | 2023-01-13 | 中国空气动力研究与发展中心计算空气动力研究所(Cn) | Intelligent question-answering method, system, equipment and medium based on aircraft knowledge graph |
WO2023038654A1 (en) * | 2021-09-07 | 2023-03-16 | Google Llc | Using large language model(s) in generating automated assistant response(s) |
CN115827838A (en) * | 2022-11-23 | 2023-03-21 | 北京智谱华章科技有限公司 | Dialog generation method and system based on story continuous writing and dynamic knowledge base |
CN115952272A (en) * | 2023-03-10 | 2023-04-11 | 杭州心识宇宙科技有限公司 | Method, device and equipment for generating dialogue information and readable storage medium |
CN116136870A (en) * | 2023-02-21 | 2023-05-19 | 深圳市网联安瑞网络科技有限公司 | Intelligent social conversation method and conversation system based on enhanced entity representation |
CN116187442A (en) * | 2022-12-28 | 2023-05-30 | 国家电网有限公司信息通信分公司 | Dynamically updated intelligent customer service knowledge base system |
-
2023
- 2023-06-19 CN CN202310728502.5A patent/CN117093679B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106844506A (en) * | 2016-12-27 | 2017-06-13 | 竹间智能科技(上海)有限公司 | The knowledge retrieval method and the automatic improving method of knowledge base of a kind of artificial intelligence dialogue |
CN111221947A (en) * | 2019-12-26 | 2020-06-02 | 北京邮电大学 | Multi-round conversation realization method and device of ophthalmologic pre-inquiry device |
CN111651609A (en) * | 2020-04-24 | 2020-09-11 | 中国电力科学研究院有限公司 | Multi-turn dialogue method and system integrating knowledge graph and emotion supervision |
WO2023038654A1 (en) * | 2021-09-07 | 2023-03-16 | Google Llc | Using large language model(s) in generating automated assistant response(s) |
CN114780694A (en) * | 2022-03-28 | 2022-07-22 | 北京智谱华章科技有限公司 | Zero-fine-tuning anthropomorphic session generation method and equipment based on pre-training language model |
CN114781402A (en) * | 2022-05-12 | 2022-07-22 | 平安科技(深圳)有限公司 | Method and device for identifying inquiry intention, electronic equipment and readable storage medium |
CN115599899A (en) * | 2022-11-08 | 2023-01-13 | 中国空气动力研究与发展中心计算空气动力研究所(Cn) | Intelligent question-answering method, system, equipment and medium based on aircraft knowledge graph |
CN115827838A (en) * | 2022-11-23 | 2023-03-21 | 北京智谱华章科技有限公司 | Dialog generation method and system based on story continuous writing and dynamic knowledge base |
CN116187442A (en) * | 2022-12-28 | 2023-05-30 | 国家电网有限公司信息通信分公司 | Dynamically updated intelligent customer service knowledge base system |
CN116136870A (en) * | 2023-02-21 | 2023-05-19 | 深圳市网联安瑞网络科技有限公司 | Intelligent social conversation method and conversation system based on enhanced entity representation |
CN115952272A (en) * | 2023-03-10 | 2023-04-11 | 杭州心识宇宙科技有限公司 | Method, device and equipment for generating dialogue information and readable storage medium |
Non-Patent Citations (4)
Title |
---|
MENGJUAN LIU: ""Improving knowledge- based dialogue generation through two-stage knowledge selection and knowledge seletion-guided pointer network"", 《JOURNAL OF INTELLIGENT INFORMATION SYSTEMS 》, vol. 59, 22 June 2022 (2022-06-22), pages 591 - 611 * |
ZHANG,WEI-NAN,ZHU QINGFU,WANG,YIFA 等: ""Neural personalized response generation as domain adaption"", 《WORLD WIDE WEB》, vol. 22, 31 December 2019 (2019-12-31), pages 1427 - 1446 * |
俞思伟;范昊;王菲;徐雷;: "基于知识图谱的智能医疗研究", 医疗卫生装备, no. 03, 15 March 2017 (2017-03-15), pages 116 - 118 * |
张定会, 邵惠鹤: "实时故障诊断专家***的人机对话方式", 计算机应用研究, no. 04, 30 July 1998 (1998-07-30), pages 69 - 71 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117648424A (en) * | 2023-12-13 | 2024-03-05 | 西湖大学 | System for acquiring domain knowledge of natural medicinal materials |
CN117932041A (en) * | 2024-03-21 | 2024-04-26 | 南京信息工程大学 | Emotion support dialogue generation method, system and device based on thinking chain reasoning |
CN117932041B (en) * | 2024-03-21 | 2024-06-11 | 南京信息工程大学 | Emotion support dialogue generation method, system and device based on thinking chain reasoning |
CN117972075A (en) * | 2024-03-28 | 2024-05-03 | 华南理工大学 | Mental and language agent cooperative emotion dialogue generation method |
CN118039138A (en) * | 2024-04-12 | 2024-05-14 | 北京惠每云科技有限公司 | Controllable path pre-consultation method and device based on large model |
CN118245589A (en) * | 2024-05-28 | 2024-06-25 | 浙江口碑网络技术有限公司 | Task type dialogue method, storage medium and computer device |
Also Published As
Publication number | Publication date |
---|---|
CN117093679B (en) | 2024-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN117093679B (en) | Large language model intelligent inquiry dialogue method, system, equipment and medium | |
CN109065172B (en) | Disease information acquisition method and device, computer equipment and storage medium | |
EP3895178A1 (en) | System and method for providing health information | |
JP2000501869A (en) | How to select medical and biochemical diagnostic tests using neural network related applications | |
CN110993093A (en) | Deep learning-based ophthalmic pre-interrogation method and device | |
WO2021151356A1 (en) | Triage data processing method and apparatus, and computer device and storage medium | |
CN112349435A (en) | Online inquiry method, device, server, medium and system | |
CN112837772A (en) | Pre-inquiry case history generation method and device | |
CN111696661A (en) | Patient clustering model construction method, patient clustering method and related equipment | |
CN112201359A (en) | Artificial intelligence-based critical illness inquiry data identification method and device | |
Sheng et al. | Cost-sensitive test strategies | |
CN114999676A (en) | Method, system, apparatus and medium for automatically replying to medical consultation | |
CN112037904B (en) | Online diagnosis and treatment data processing method and device, computer equipment and storage medium | |
CN112349367B (en) | Method, device, electronic equipment and storage medium for generating simulated medical record | |
CN113722504A (en) | Pre-inquiry information generation method and device | |
Ranjini et al. | Machine learning techniques for assisted reproductive technology: A review | |
CN111933285A (en) | Organ age prediction system, method and device and storage medium | |
CN111783473A (en) | Method and device for identifying best answer in medical question and answer and computer equipment | |
CN114328864A (en) | Ophthalmic question-answering system based on artificial intelligence and knowledge graph | |
CN114520053A (en) | Medical information processing method, system, terminal and storage medium | |
CN114300127A (en) | Method, device, equipment and storage medium for inquiry processing | |
CN117238527B (en) | Medical information management method and system based on big data | |
Vairavel et al. | Data Analytics on Unpredictable Pregnancy Data Records Using Ensemble Neuro-Fuzzy Techniques. | |
US20230335299A1 (en) | Translation of medical evidence into computational evidence and applications thereof | |
CN116561286B (en) | Dialogue method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |