Medical question answering method, electronic device, and storage medium

By building a local medical knowledge base and combining it with online retrieval, and integrating knowledge retrieval tools from multiple channels, medical response content with clear reference information is generated. This solves the problem of insufficient credibility and accuracy of large language models in medical question-and-answer systems, and improves the credibility and accuracy of the response content.

CN122173609APending Publication Date: 2026-06-09WINNING HEALTH TECHNOLOGY GROUP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WINNING HEALTH TECHNOLOGY GROUP CO LTD
Filing Date
2026-03-10
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing medical question-and-answer systems, the medical responses generated by large language models fail to fully integrate reliable reference sources, resulting in low credibility and accuracy.

Method used

A local medical knowledge base is constructed and combined with online network search. The search information is extracted by a question-reshaping agent, and the response content is generated by a content filtering and generation agent. The response content with clear reference information is generated by integrating local search results, web search results and literature search results.

Benefits of technology

It improves the credibility and accuracy of medical responses, ensures transparency and traceability, significantly reduces the risk of hallucinations, and enhances the strength of evidence and overall persuasiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173609A_ABST
    Figure CN122173609A_ABST
Patent Text Reader

Abstract

The application provides a medical question and answer method, an electronic device and a storage medium. The method comprises the following steps: obtaining a target medical question input by a user; obtaining local search information, webpage search information and literature search information respectively according to the target medical question; performing local search in a local medical knowledge base according to the local search information to obtain a local search result; performing online webpage search according to the webpage search information to obtain a webpage search result; performing online literature search according to the literature search information to obtain a literature search result; and generating reply content corresponding to the target medical question and reference information of the reply content according to the local search result, the webpage search result and the literature search result, wherein the reference information is used for association to an information source corresponding to the reply content. Through integration of the local medical knowledge base and online networking search, content output with clear reference information is generated, content transparency and traceability are ensured, and credibility and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a medical question-and-answer method, electronic device, and storage medium. Background Technology

[0002] With the rapid development of artificial intelligence technology, large language models have made significant progress in the logical rigor and fluency of generated content.

[0003] In related technologies, large language models can assist doctors in generating medical records, searching literature, providing patients with popular science information, and guiding them to offline medical treatment in medical question-and-answer scenarios. Some systems also support the interpretation of examination reports.

[0004] However, due to the fact that the medical responses provided by the large language model do not fully integrate reliable reference sources, there are still some deficiencies in terms of evidence support, resulting in lower credibility and accuracy. Summary of the Invention

[0005] In view of this, embodiments of this application provide a medical question-and-answer method, electronic device, and storage medium to address the problem that existing medical responses fail to adequately integrate reliable reference sources, have certain deficiencies in evidence support, and exhibit low credibility and accuracy.

[0006] In a first aspect, embodiments of this application provide a medical question-and-answer method, including: Obtain the user's input regarding the target medical question; Based on the target medical question, local search information, web search information, and literature search information are obtained respectively. Based on the local search information, a local search is performed in the local medical knowledge base to obtain local search results; Based on the webpage retrieval information, an online webpage retrieval is performed to obtain the webpage retrieval results; Based on the literature retrieval information, an online literature retrieval was performed to obtain the literature retrieval results; Based on the local search results, the web search results, and the literature search results, a response content corresponding to the target medical question and reference information for the response content are generated. The reference information is used to associate the response content with the information source corresponding to the information source.

[0007] In an optional implementation, the step of obtaining local search information, web search information, and literature search information according to the target medical problem includes: The problem-reshaping agent extracts entities and entity relationships from the target medical problem based on the first problem prompt word, and generates a triple query vector as the local retrieval information based on the entities, entity relationships and the target medical problem. The intelligent agent is reshaped using the aforementioned problem, and webpage search keywords are extracted from the target medical problem as webpage search information based on the second problem prompt words; The intelligent agent is reshaped using the aforementioned problem, and based on the third problem prompt, literature retrieval keywords are extracted from the target medical problem as the literature retrieval information.

[0008] In an optional implementation, generating response content corresponding to the target medical question and reference information for the response content based on the local search results, the webpage search results, and the literature search results includes: A content filtering agent is used to filter the local search results, the web page search results, and the document search results based on content filtering prompts, so as to obtain filtered search results. A content-generating intelligent agent is used to generate prompts based on the content, assemble the filtered search results in a formatted manner, and generate the response content and reference information for the response content.

[0009] In an optional implementation, the local search results include: local knowledge slices, slice titles, and knowledge links; the webpage search results include: webpage content, webpage titles, and webpage links; and the document search results include: document abstract content, document titles, and document links. The content-generating agent generates prompts based on the content, assembles the filtered search results in a formatted manner, and generates the response content and reference information for the response content, including: The intelligent agent is generated using the content, and format prompts are generated based on the content. The content of each search result in the filtered search results is formatted and assembled to generate the response content. Reference information for the response content is generated based on the title and link of each search result.

[0010] In an optional implementation, the step of performing a local search in a local medical knowledge base based on the local search information to obtain local search results includes: Based on the triple query vector, a local search is performed in the local medical knowledge base to obtain candidate medical documents. The local medical knowledge base includes entities, entity relationships, and summaries of each medical document. Each medical document is divided into multiple semantic slices. Based on the triple query vector, a list of candidate slices is determined from the set of semantic slices of the candidate medical documents; The local search results are generated based on the candidate slice list.

[0011] In an optional implementation, generating the local search results based on the candidate slice list includes: Semantic relevance analysis is performed on the semantic slices in the candidate slice list to obtain a relevance score, which is used to indicate the degree of relevance between the semantic slices in the candidate slice list and the triple query vector; Based on the relevance score, the candidate slice list is reordered to obtain a sorted slice list; Determine adjacent semantic slices of the semantic slice in the sorted slice list from the candidate medical documents; Based on the adjacent semantic slices, the semantic slices in the sorted slice list are extended in context to obtain local knowledge slices; The local search results are generated based on the local knowledge slices, the slice titles of the local knowledge slices, and the knowledge links of the candidate medical documents.

[0012] In an optional implementation, the step of performing an online webpage search based on the webpage search information to obtain webpage search results includes: Based on the webpage search keywords, perform an online webpage search to obtain webpage links; Based on the webpage link, obtain the webpage content; If the relevance score between the webpage content and the webpage search keywords exceeds a preset threshold, then the webpage search results are generated based on the webpage content, the webpage link, and the corresponding webpage title. If the relevance score between the webpage content and the webpage search keywords does not exceed the preset threshold, then the webpage search results are generated based on the webpage snapshot of the webpage content, the webpage link, and the webpage title.

[0013] In an optional implementation, the step of performing an online literature search based on the literature search information to obtain the literature search results includes: Based on the aforementioned document search keywords, an online document search is conducted to obtain a list of document identifiers; Based on the document content corresponding to the document identifier list, the document abstract and document title are parsed out. The document search results are generated based on the document abstract, the document title, and the document links within the document content.

[0014] Secondly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method described in any of the first aspects.

[0015] Thirdly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method described in any of the first aspects.

[0016] This application provides a medical question-answering method, electronic device, and storage medium. The method includes: acquiring a target medical question input by a user; acquiring local search information, webpage search information, and literature search information based on the target medical question; performing a local search in a local medical knowledge base based on the local search information to obtain local search results; performing an online webpage search based on the webpage search information to obtain webpage search results; performing an online literature search based on the literature search information to obtain literature search results; and generating a response content corresponding to the target medical question and reference information for the response content based on the local search results, webpage search results, and literature search results. The reference information is used to link to the information source corresponding to the response content. By integrating a local medical knowledge base and online network search, content output with clear reference information is generated, ensuring content transparency and traceability, and improving credibility and accuracy. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 1 ; Figure 2 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 2 ; Figure 3 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 3 ; Figure 4 A schematic diagram of the architecture for intelligent agent collaboration provided in an embodiment of this application; Figure 5Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 4 ; Figure 6 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 5 ; Figure 7 A schematic diagram of the local retrieval architecture provided for embodiments of this application; Figure 8 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 6 ; Figure 9 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 7 ; Figure 10 A schematic diagram illustrating the architecture of online webpage retrieval and online document retrieval provided in the embodiments of this application; Figure 11 This is a schematic diagram of the structure of the medical question-and-answer device provided in the embodiments of this application; Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0020] The medical responses generated by large language models often fail to fully integrate reliable reference sources, resulting in insufficient evidence support and low credibility and accuracy. Furthermore, the medical responses may contain fabricated or inaccurate information, affecting the reliability of the generated content. This application addresses these issues by constructing a local medical knowledge base, integrating it with online searches, and generating content output with clear reference information. This ensures transparency and traceability of information, thereby improving credibility and accuracy.

[0021] Figure 1 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 1In this embodiment, the executing entity can be an electronic device, which is equipped with a medical question-and-answer system.

[0022] like Figure 1 As shown, the method may include: S101. Obtain the target medical question input by the user.

[0023] Users can log in to the medical Q&A system and enter their target medical questions in text or language. Target medical questions can be, for example, "What are the treatment options for hypertension?" or "What is the diagnostic process for diabetes?"

[0024] S102. Based on the target medical question, obtain local search information, web search information, and literature search information respectively.

[0025] Local search information, web search information, and literature search information are extracted from the target medical question. Local search information refers to search expressions adapted to the local medical knowledge base, web search information refers to search expressions adapted to web searches, and literature search information refers to search expressions adapted to medical literature searches.

[0026] Local retrieval information can include triple query vectors, represented as [entity, relation, question] triples. Entities can include four categories: disease, test / examination, treatment, and prevention. Relationships refer to the associations between entities, which can include four types of associations: disease-disease, disease-test / examination, disease-treatment, and disease-prevention. Questions refer to the target medical question.

[0027] Among them, disease-disease refers to the latter disease being the cause, similar disease, complication, etc. of the former disease; disease-testing refers to the tests required to diagnose a disease; disease-treatment refers to the treatment plan for a disease; and disease-prevention refers to the methods to prevent a disease.

[0028] Web search information can include web search keywords, while document search information can include document search keywords and year restrictions.

[0029] S103. Based on the local search information, perform a local search in the local medical knowledge base to obtain the local search results.

[0030] The local medical knowledge base includes entities, entity relationships, and summaries of each medical document from multiple medical documents. Each medical document is divided into multiple semantic slices.

[0031] Based on local retrieval information, a local search is performed in the local medical knowledge base. The similarity between the entities, entity relations, and summaries of each medical document and the entities, relations, and questions in the triple query vector is calculated. Entity similarity, relation similarity, and question similarity are obtained. Based on the semantic slices of target medical documents whose entity similarity, relation similarity, and question similarity are all higher than preset thresholds, local retrieval results are generated. The local retrieval results include: local knowledge slices (semantic slices of the target medical document), slice titles of the semantic slices of the target medical document, and knowledge links of the target medical document.

[0032] Among them, local knowledge slices refer to the response content for the target medical question obtained through local retrieval, and knowledge links are clickable links to the target medical document. In other words, clicking the knowledge link can jump to view the target medical document.

[0033] S104. Based on the webpage search information, conduct an online webpage search to obtain the webpage search results.

[0034] Based on the webpage search information, an online webpage search is performed to obtain webpage search results, which include: webpage content, webpage title, and webpage link.

[0035] Webpage content refers to the response content obtained through webpage retrieval for the target medical question. Webpage title refers to the title of the webpage content, a brief textual description of the core and main body of the webpage content. Webpage link refers to the clickable link to the corresponding webpage, which can be accessed by clicking the webpage link.

[0036] S105. Based on the literature retrieval information, conduct an online literature retrieval to obtain the literature retrieval results.

[0037] Based on the literature retrieval information, an online literature search is conducted to obtain the literature search results, which include: literature abstract content, literature title, and literature link.

[0038] The abstract content refers to the summary of medical literature on the target medical problem obtained through literature retrieval; the title of the document refers to the title of the medical literature on the target medical problem; and the link to the document refers to the clickable link to access the content of the medical literature.

[0039] S106. Based on the local search results, web search results, and literature search results, generate the response content corresponding to the target medical question and the reference information for the response content.

[0040] The response content will include local knowledge slices from local search results, web page content from web page search results, and document abstracts from document search results. The response content will also include slice titles and knowledge links from local search results, web page titles and links from web page search results, and document titles and links from document search results as reference information.

[0041] The reference information is used to link to the information source corresponding to the response content. The information source corresponding to the response content includes the target medical document, webpage, and medical literature corresponding to the local knowledge slice. In other words, the reference information can jump to the document page, webpage, and literature page to display the target medical document on the document page, the webpage content on the webpage, and the medical literature on the literature page.

[0042] In this embodiment, targeting the high-risk and high-requirement medical field, the accuracy, credibility, and traceability of medical responses directly affect the quality of clinical decision-making and patient safety. To significantly reduce the risk of hallucinations, enhance the evidentiary support of responses, and improve overall persuasiveness, a multi-channel knowledge retrieval tool combining local knowledge and external networks is designed and implemented by constructing a local medical knowledge base and enabling knowledge retrieval. This tool integrates medical knowledge retrieval from online web pages and online literature, thereby consolidating authoritative web page information and medical literature knowledge to construct a medical question-and-answer system with traceable response sources. This provides clear and traceable evidentiary support, thereby significantly improving the credibility and accuracy of medical responses.

[0043] Figure 2 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 2 ,like Figure 2 As shown, in an optional implementation, step S102 above, which involves acquiring local search information, web search information, and literature search information according to the target medical question, may include: S201. Employ a problem-based intelligent agent to extract entities and entity relationships from the target medical problem based on the first problem prompt word, and generate a triple query vector as local retrieval information based on the entities, entity relationships, and the target medical problem.

[0044] Among them, the problem reshaping agent is used to extract corresponding search information for different search strategies through prompt word engineering. The first problem prompt word is a problem prompt word extracted for the search information of the local medical knowledge base.

[0045] The problem-reshaping agent extracts entities and entity relations from the target medical problem based on the first problem prompt words, and generates a triple query vector of entities, entity relations and the target medical problem, represented as [entity, relation, problem]. This triple query vector is used as local retrieval information, thereby refining the target medical problem into a standardized written expression.

[0046] S202. Employ a problem-based intelligent agent to extract webpage search keywords from the target medical question based on the second question prompt, and use these keywords as webpage search information.

[0047] The second set of question prompts consists of question prompts extracted from the search information of the webpage.

[0048] The intelligent agent is reshaped by a question. Based on the second question prompt, web search keywords for web page retrieval are extracted from the target medical question. These web search keywords are used as web page retrieval information, thereby refining the target medical question into a web search expression that is compatible with search engines.

[0049] S203. Employ a problem-based intelligent agent to extract literature retrieval keywords from the target medical problem as literature retrieval information based on the third problem prompt.

[0050] The third set of prompts consists of prompts extracted from search information related to medical literature.

[0051] The intelligent agent is reshaped by a question. Based on the third question prompt, the document retrieval keywords are extracted from the target medical question for document retrieval. These document retrieval keywords are used as document retrieval information, thereby extracting the core retrieval information suitable for document retrieval from the target medical question.

[0052] In this embodiment, a question reshaping agent is used to extract retrieval information for different retrieval strategies, which helps to perform retrieval under different retrieval strategies and improves retrieval accuracy.

[0053] Figure 3 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 3 ,like Figure 3 As shown, in an optional implementation, step S106 above, which generates response content and reference information for the target medical question based on local search results, web search results, and literature search results, may include: S301. A content filtering agent is used to filter local search results, web search results, and document search results based on content filtering prompts, and the filtered search results are obtained.

[0054] Among them, the content filtering agent is used to filter out the parts of the search results that are irrelevant or invalid to the target medical question through prompt word engineering.

[0055] Based on the target medical question, content filtering suggestions are generated, and a content filtering agent is used to filter local search results, web search results, and literature search results based on the content filtering suggestions. This filters out content that is irrelevant to the target medical question from the local search results, web search results, and literature search results. Irrelevant content may include advertisements, navigation bars, copyright notices, and content that is not related to the disease mentioned in the target medical question.

[0056] For example, if the target medical question is "What is the diagnostic process for diabetes?", but the search results contain a large amount of content related to hypertension, this part of the content is irrelevant to the target medical question. This allows us to filter out the search results that are truly helpful in answering the target medical question.

[0057] S302. Employ a content-generating intelligent agent to generate prompts based on the content, assemble the filtered search results in a formatted manner, and generate response content and reference information for the response content.

[0058] The content generation agent is used to generate response content through prompt word engineering and to mark the referenced information in the output.

[0059] A content-generating agent is employed to generate prompts based on the content. It then formats and assembles the content, titles, and links from the filtered search results to generate response content and its reference information. The content in the filtered search results includes local knowledge slices, webpage content, and document abstracts. The titles in the filtered search results include knowledge titles, webpage titles, and document titles. The links in the filtered search results include knowledge links, webpage links, and document links. The response content can include both the content and the title, and the reference information in the response content can include both the title and the link.

[0060] In an optional implementation, local search results include: local knowledge slices, slice titles, and knowledge links; web page search results include: web page content, web page titles, and web page links; and document search results include: document abstract content, document titles, and document links. In step S302 above, a content-generating agent is used to generate prompts based on the content, assemble the filtered search results in a formatted manner, and generate response content and reference information for the response content, which may include: A content-generating intelligent agent is used to assemble the content of each search result in the filtered search results according to the content-generating format prompts, generate the response content, and generate reference information for the response content based on the title and link of each search result.

[0061] After filtering the local search results, web search results, and document search results, the filtered local search results, filtered web search results, and filtered document search results are obtained. The filtered search results include three items: the filtered local search results, the filtered web search results, and the filtered document search results.

[0062] Each search result can contain any of the following: local knowledge slices, webpage content, or document abstracts. Each search result title can be any of the following: knowledge title, webpage title, or document title. Each search result link can be any of the following: knowledge link, webpage link, or document link.

[0063] The content of each search result is formatted and assembled to generate a response. The response can include content and title. Reference information for the response is generated based on the title and link of each search result. The reference information includes the title and link.

[0064] The content can be assembled in the following format: [[citation:x]] + title + content (where x is a number). That is, the content is marked and referenced in the corresponding position using the citation number format [citation:x]. In addition, after the content is generated, the reference information is organized in the format "[[citation:x]] + title + link" and placed at the end of the generated content. Finally, the generated content and the reference information are organically combined to obtain the final answer.

[0065] For example, [[citation:1]]+knowledge title+local knowledge slice, [[citation:1]]+knowledge title+knowledge link, [[citation:2]]+web page title+web page content, [[citation:2]]+web page title+web page link, [[citation:2]]+document title+document abstract content, [[citation:2]]+document title+document link.

[0066] Figure 4 This is a schematic diagram of the intelligent agent collaboration architecture provided in the embodiments of this application, such as... Figure 4As shown, the input is the "question," which is the target medical question. A question reshaping agent extracts search information applicable to the local medical knowledge base, web pages, and medical literature. It then uses search tools from these sources to retrieve relevant "search content," or search results. A content filtering agent evaluates each piece of "search content," selecting those truly helpful in answering the "question." Finally, a content generation agent combines the "search content" to generate an answer to the "question."

[0067] In this embodiment, a multi-agent collaborative architecture consisting of a question reshaping agent, a content filtering agent, and a content generation agent is adopted to complete the answer to the target medical question. Through the collaboration of multiple agents, the local knowledge base, real-time web page information, and medical literature retrieval capabilities are integrated to finally output a complete answer with traceable source information.

[0068] Figure 5 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 4 ,like Figure 5 As shown, in an optional implementation, step S103 above, which involves performing a local search in the local medical knowledge base based on local search information to obtain local search results, may include: S401. Based on the triple query vector, perform a local search in the local medical knowledge base to obtain candidate medical documents.

[0069] The local medical knowledge base includes entities, entity relationships, and summaries of each medical document from multiple medical documents. Each medical document is divided into multiple semantic slices.

[0070] The following explains the construction of a local medical knowledge base: Medical treatment guidelines, consensus statements, and related normative documents were collected from medical websites as medical documents. Document parsing tools were used to extract the text from these medical documents, obtaining the plain text content. The plain text content was then preprocessed, including removing redundant whitespace characters, consecutive line breaks, and format control characters, filtering headers and footers, references, acknowledgments, author information, copyright statements, and other non-core content, and standardizing the encoding format, in order to perform document parsing and text preprocessing.

[0071] Then, the preprocessed document is post-processed in the following manner: Entity Relationship Recognition: Utilizing a large language model and based on prompt word engineering, relevant entities and their relationships in the medical field are generated from preprocessed documents. The core entities mainly include four categories: disease, laboratory tests, treatment, and prevention. Entity relationships primarily cover four types: disease-disease, disease-laboratory tests, disease-treatment, and disease-prevention. Then, based on the generated entities and relationships, a knowledge graph is constructed, establishing a mapping relationship between documents, entities, and entity relationships.

[0072] Abstract extraction: This involves generating document summaries using a large language model. In other words, it's the process of compressing the original document into a shorter version. The summary should cover the key content of the original text while maintaining fluent language and clear logic. In addition, the length of the summary can be flexibly adjusted according to needs, such as single-sentence summaries, paragraph summaries, or lists of key points.

[0073] Semantic slicing: Dividing a document into chunks with appropriate granularity according to semantic integrity, with the chunk size controlled to be 1024 tokens.

[0074] Next, the post-processed document is vectorized and stored as a vector: Entities, entity relations, document summaries, and semantic slices are encoded using an embedding model (BAAI / bge-m3). The encoded vectors are then stored in the milvus vector dataset, forming four independent but related corpus sets: entity, entity relation, document summary, and slice vector sets.

[0075] Finally, data storage is performed: By linking local documents using HTML documents and storing document information (link, title, summary, content, slice list, entity list, entity relationship list, upload time) in a relational database, the construction of a local medical knowledge base is complete. Here, link, title, summary, and content refer to the knowledge link in the medical document, the title of the slice in the document, the document summary, and the document content, respectively, while upload time indicates the time the medical document was uploaded to the medical website.

[0076] For the target medical question input by the user, a question reshaping agent is used to generate a triple of [entity, relation, question], and a triple query vector is generated using an embedding model consistent with the database (BAAI / bge-m3) to realize the vectorization of retrieval triples.

[0077] The triple query vectors correspond to necklace sets of entities, entity relations, and document summaries, respectively. Based on the built-in HNSW index in Milvus, cosine similarity is used as the metric. Efficient local retrieval of Approximate Nearest Neighbor (ANN) is performed on each medical document in the local medical knowledge base. Medical documents with entity similarity, relation similarity, and question similarity all in the Top K are selected as candidate medical documents. K can be, for example, 5 or 3. This embodiment does not have a specific limitation on this.

[0078] In some embodiments, if there are multiple medical documents whose entity similarity, relation similarity, and question similarity are all in the Top K, then the multiple medical documents can be merged to generate candidate medical documents. That is, candidate medical documents are formed by associating with medical documents that have high similarity to the triple query vector and merging them.

[0079] S402. Based on the triple query vector, determine the candidate slice list from the semantic slice set of candidate medical documents.

[0080] If there is only one candidate medical document, the semantic slice set includes multiple semantic slices generated from dividing the candidate medical document. If there are multiple candidate medical documents, the semantic slice set includes multiple semantic slices generated from dividing all candidate medical documents.

[0081] Based on the triple query vector, the built-in HNSW index of Milvus is used, and cosine similarity is used as the metric to perform efficient approximate nearest neighbor retrieval on the semantic slice set of candidate medical documents, thereby obtaining a candidate slice list of candidate medical documents. Among them, the similarity between each semantic slice in the candidate slice list and the triple query vector exceeds a preset threshold, or the similarity between each semantic slice in the candidate slice list and the triple query vector is in the top N, N can be 5 or 3, for example, and this embodiment does not particularly limit this.

[0082] S403. Generate local search results based on the candidate slice list.

[0083] Each semantic slice in the candidate slice list is used as a local knowledge slice, and the slice title and knowledge link of the candidate medical document (target medical document) are obtained from the local medical knowledge base. The local search results include: local knowledge slice, slice title and knowledge link.

[0084] Figure 6 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 5 ,like Figure 6As shown, in an optional implementation, step S404 above, generating local search results based on the candidate slice list, may include: S501. Perform semantic relevance analysis on the semantic slices in the candidate slice list to obtain a relevance score.

[0085] S502. Based on the relevance score, reorder the candidate slice list to obtain the sorted slice list.

[0086] The relevance score is used to indicate the degree of relevance between the semantic slices in the candidate slice list and the triple query vector.

[0087] Based on the triple query vector, a pre-defined re-ranking model (such as bge-reranker-v2-m3) is used to perform semantic relevance analysis on the recalled candidate slice list to obtain a relevance score. Based on the relevance score, the semantic slices in the candidate slice list are re-ranked to obtain a ranked slice list. The first semantic slice in the ranked slice list has the highest relevance score to the triple query vector, the last semantic slice has the lowest relevance score to the triple query vector, and so on.

[0088] It should be noted that the purpose of re-ranking is to: after quickly recalling the candidate slice list in the first stage, use a more refined model to re-score and rank the semantic slices in the candidate slice list, thereby placing the most relevant results first, improving the quality of the final output, ensuring that the information passed to the content generation agent is highly relevant, and thus significantly improving the quality and credibility of the final question answer.

[0089] S503. Determine the adjacent semantic slices of the semantic slices in the sorted slice list from the candidate medical documents.

[0090] Adjacent semantic slices include the preceding and following semantic slices of the semantic slice in the sorted slice list in the candidate medical document.

[0091] S504. Based on adjacent semantic slices, perform context expansion on the semantic slices in the sorted slice list to obtain local knowledge slices.

[0092] Calculate the relevance score between adjacent semantic slices and semantic slices in the sorted slice list. If the relevance score exceeds a preset relevance score threshold, then use the adjacent semantic slices as contextual extensions of the semantic slices in the sorted slice list to generate local knowledge slices. Local knowledge slices include: adjacent semantic slices and semantic slices in the sorted slice list.

[0093] In some embodiments, a preset reordering model or cosine similarity may be used to calculate the relevance score between adjacent semantic slices and semantic slices in the sorted slice list.

[0094] S505. Generate local search results based on local knowledge slices, slice titles of local knowledge slices, and knowledge links of candidate medical documents.

[0095] Retrieves the titles of local knowledge slices and knowledge links of candidate medical documents from the local medical knowledge base. The local search results include: local knowledge slices, titles of local knowledge slices, and knowledge links of candidate medical documents.

[0096] For example, a slice may only describe a certain symptom, while the preceding slice may mention the patient's past medical history, and the subsequent slice may give the doctor's diagnosis. Only by merging these three slices to generate a local knowledge slice can a complete diagnosis and treatment logic be formed.

[0097] In some embodiments, local search results are represented as [knowledge link, slice title, slice content].

[0098] In this embodiment, document-level retrieval is first performed using document summaries to filter out relevant documents. Then, slice-level retrieval is performed on these documents. Subsequently, through reordering and context relevance expansion, slices with optimized ranking and complete context are finally returned. This enables local knowledge retrieval to achieve accurate recall of relevant content through multi-level strategies combining document entities, relationships, summaries, and slices. In addition, for the reordered slice list, context slices with high correlation between the preceding and following slices are dynamically added to improve the coherence, completeness, and readability of local knowledge slices and avoid erroneous inferences caused by information fragmentation.

[0099] Figure 7 A schematic diagram of the local retrieval architecture provided in the embodiments of this application, such as Figure 7 As shown, entities, relations, summaries, and slices are extracted through document collection, text parsing, and preprocessing, and stored in a relational database. Then, entities, relations, summaries, and slices are vectorized and stored in a Milvus vector dataset.

[0100] Tool 1 (knowledge retrieval tool) is used to generate retrieval triples (triple query vectors), and document retrieval is performed based on entity, relation, and summary vectors. Then, slice retrieval is performed based on slice vectors. Relevant slices are obtained through reordering and context expansion. Finally, information stored in the relational database is combined to generate retrieval content (local retrieval results).

[0101] Figure 8 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 6,like Figure 7 As shown, in an optional implementation, step S104 above, which involves performing an online webpage search based on the webpage search information to obtain the webpage search results, may include: S601. Based on web search keywords, conduct online web search and obtain web link.

[0102] Based on webpage search keywords, online webpages are retrieved through search engines to obtain webpage information, such as [link, title, snapshot, publication time], which respectively represent the webpage link, webpage title (e.g., how to treat hypertension), webpage snapshot, and the publication time of the webpage content.

[0103] Among them, a webpage snapshot refers to a backup of the webpage content that a search engine crawls and saves at a certain point in the past. In other words, it is a static photo that the search engine takes for each indexed webpage.

[0104] S602. Obtain the webpage content based on the webpage link.

[0105] By accessing webpage links, we attempt to crawl webpage content and collect webpage information such as [link, title, snapshot, content, and publication time]. In addition, we can set an access timeout. If the access times out, the webpage content and publication time will be empty.

[0106] S603. If the relevance score between the webpage content and the webpage search keywords exceeds a preset threshold, then webpage search results are generated based on the webpage content, webpage links, and corresponding webpage titles.

[0107] S604. If the relevance score between the webpage content and the webpage search keywords does not exceed the preset threshold, then generate webpage search results based on the webpage snapshot, webpage links, and webpage title.

[0108] An embedding model (BAAI / bge-m3) is used to vectorize and encode the webpage content and webpage search keywords respectively, and the cosine similarity between the two is calculated. If the similarity score is less than a preset similarity threshold (e.g., 0.2), the relevance score between the webpage content and the query is considered insufficient. In this case, a webpage snapshot is used as the webpage content for preprocessing. Based on the webpage snapshot, webpage link, and webpage title, webpage search results are generated. The webpage search results include the webpage snapshot, webpage link, and webpage title.

[0109] If the similarity score is greater than or equal to the preset similarity threshold (e.g., 0.2), then the webpage content, webpage link, and webpage title are used to generate webpage search results. The webpage search results include the webpage content, webpage link, and webpage title.

[0110] In some embodiments, webpage search results include multiple search results, with each search result corresponding to a webpage. In such cases, a preset re-ranking model (such as bge-reranker-v2-m3) can be used to calculate the relevance scores of webpage search keywords, webpage content, and webpage title. The webpages are then sorted in descending order according to their relevance scores, and the final output is a list of sorted webpage information, including [link, title, snapshot, content, publication time, and score], which respectively represent the webpage link, webpage title, webpage snapshot, webpage content, publication time of the webpage content, and the corresponding relevance score of the webpage.

[0111] In this embodiment, an online network retrieval method is used in conjunction with a search engine to obtain web page content, thereby achieving more comprehensive acquisition of external knowledge.

[0112] Figure 9 Flowchart of the medical question-and-answer method provided in the embodiments of this application Figure 7 ,like Figure 9 As shown, in an optional embodiment, step S105 above, which involves performing an online literature search based on the literature search information to obtain the literature search results, may include: S701. Based on the literature search keywords, conduct an online literature search to obtain a list of literature identifiers.

[0113] Based on the literature search keywords, online literature searches are conducted in online medical literature knowledge bases (such as the PubMed database) to obtain a list of literature identifiers. The list of literature identifiers includes multiple medical literature identifiers related to the literature search keywords, such as the PubMed Unique Identifier (PMID) of medical papers.

[0114] S702. Based on the document content corresponding to the document identifier list, parse out the document abstract and document title.

[0115] Based on the medical document identifiers in the document identifier list, the corresponding document content is retrieved from a document database (such as the NCBI database) using a preset data acquisition interface. This document content can be in XML format. The document content is then parsed for post-processing to obtain the document abstract and title.

[0116] S703. Generate literature search results based on the literature abstract, literature title, and literature links in the literature content.

[0117] The local search results include: document abstracts, document titles, and links to the documents.

[0118] In some embodiments, local search results are represented as [link, title, abstract, publication time], which represent the document link, document title, document abstract content, and document publication time, respectively.

[0119] Figure 10 This is a schematic diagram of the architecture for online webpage retrieval and online document retrieval provided in the embodiments of this application, as shown below. Figure 10 As shown, it includes two tools, 2 and 3, which are a web information retrieval tool and a medical literature retrieval tool, respectively.

[0120] Tool 2 is used to retrieve relevant web pages based on web search keywords, crawl the web page content, preprocess the web page content, reorder the web page content, and then return the content (web page search results).

[0121] Tool 2 was used to obtain the PMID of the paper based on the literature search keywords, and the paper content was obtained. After content post-processing, the content (literature search results) was returned.

[0122] In this embodiment, an online literature retrieval method is adopted to achieve a more comprehensive acquisition of external knowledge.

[0123] Figure 11 This is a schematic diagram of the structure of a medical question-and-answer device provided in an embodiment of this application. This device can be integrated into an electronic device.

[0124] like Figure 11 As shown, the device may include: Module 801 is used to acquire the target medical question input by the user; The acquisition module 801 is also used to acquire local search information, web search information and literature search information respectively according to the target medical question; The retrieval module 802 is used to perform local retrieval in the local medical knowledge base based on local retrieval information and obtain local retrieval results; The retrieval module 802 is also used to perform online web page retrieval based on web page retrieval information and obtain web page retrieval results; The retrieval module 802 is also used to perform online literature retrieval based on the literature retrieval information and obtain the literature retrieval results; The generation module 803 is used to generate response content and reference information for the target medical question based on local search results, web search results, and literature search results. The reference information is used to link to the information source corresponding to the response content.

[0125] In an optional implementation, the acquisition module 801 is specifically used for: The problem-based intelligent agent is reshaped. Based on the first problem prompt, entities and entity relationships are extracted from the target medical problem. Based on the entities, entity relationships and the target medical problem, a triple query vector is generated as local retrieval information. The problem-based intelligent agent is reshaped and extracts web search keywords from the target medical problem as web search information based on the second problem prompt. The intelligent agent is reshaped by a question, and based on the third question prompt, it extracts literature retrieval keywords from the target medical question as literature retrieval information.

[0126] In an optional implementation, the generation module 803 is specifically used for: A content filtering agent is used to filter local search results, web search results, and document search results based on content filtering prompts, resulting in filtered search results. A content-generating intelligent agent is used to generate prompts based on the content, assemble the filtered search results in a formatted manner, and generate response content and reference information for the response content.

[0127] In an optional implementation, local search results include: local knowledge slices, slice titles, and knowledge links; web page search results include: web page content, web page titles, and web page links; and document search results include: document abstract content, document titles, and document links. The generation module 803 is specifically used to employ a content generation agent to assemble the content of each search result in the filtered search results according to the content generation format prompts, generate response content, and generate reference information for the response content based on the title and link of each search result.

[0128] In an optional implementation, the retrieval module 802 is specifically used for: Based on the triple query vector, a local search is performed in the local medical knowledge base to obtain candidate medical documents. The local medical knowledge base includes entities, entity relationships, and summaries of each medical document. Each medical document is divided into multiple semantic slices. Based on the triple query vector, determine the candidate slice list from the set of semantic slices of candidate medical documents; Generate local search results based on the candidate slice list.

[0129] In an optional implementation, the retrieval module 802 is specifically used for: Semantic relevance analysis is performed on the semantic slices in the candidate slice list to obtain a relevance score. The relevance score is used to indicate the degree of relevance between the semantic slices in the candidate slice list and the triple query vector. Based on the relevance score, the candidate slice list is reordered to obtain the sorted slice list; Identify adjacent semantic slices of a semantic slice in a sorted slice list from candidate medical documents; Based on adjacent semantic slices, context expansion is performed on the semantic slices in the sorted slice list to obtain local knowledge slices; Local search results are generated based on local knowledge slices, slice titles, and knowledge links to candidate medical documents.

[0130] In an optional implementation, the retrieval module 802 is specifically used for: Based on web search keywords, conduct online web page searches and obtain web page links; Retrieve webpage content based on webpage link; If the relevance score between the webpage content and the webpage search keywords exceeds a preset threshold, then webpage search results will be generated based on the webpage content, webpage links, and corresponding webpage titles. If the relevance score between the webpage content and the webpage search keywords does not exceed the preset threshold, then webpage search results are generated based on the webpage snapshot, webpage links, and webpage title.

[0131] In an optional implementation, the retrieval module 802 is specifically used for: Based on the literature search keywords, conduct online literature searches and obtain a list of literature identifiers; Based on the document content corresponding to the document identifier list, the document abstract and document title are obtained by parsing. Based on the abstract, title, and links within the document, the document search results are generated.

[0132] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0133] Figure 12 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 12 As shown, the device may include a processor 901, a memory 902, and a bus 903. The memory 902 stores machine-readable instructions that can be executed by the processor 901. When the electronic device is running, the processor 901 communicates with the memory 902 through the bus 903, and the processor 901 executes the machine-readable instructions to perform the above-described method.

[0134] This application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to perform the above-described method.

[0135] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.

[0136] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0137] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0138] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0139] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0140] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0141] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A medical question-and-answer method, characterized in that, include: Obtain the user's input regarding the target medical question; Based on the target medical question, local search information, web search information, and literature search information are obtained respectively. Based on the local search information, a local search is performed in the local medical knowledge base to obtain local search results; Based on the webpage retrieval information, an online webpage retrieval is performed to obtain the webpage retrieval results; Based on the literature retrieval information, an online literature retrieval was performed to obtain the literature retrieval results; Based on the local search results, the web search results, and the literature search results, a response content corresponding to the target medical question and reference information for the response content are generated. The reference information is used to associate the response content with the information source corresponding to the information source.

2. The method according to claim 1, characterized in that, The step of obtaining local search information, web search information, and literature search information based on the target medical problem includes: The problem-reshaping agent extracts entities and entity relationships from the target medical problem based on the first problem prompt word, and generates a triple query vector as the local retrieval information based on the entities, entity relationships and the target medical problem. The intelligent agent is reshaped using the aforementioned problem, and webpage search keywords are extracted from the target medical problem as webpage search information based on the second problem prompt words; The intelligent agent is reshaped using the aforementioned problem, and based on the third problem prompt, literature retrieval keywords are extracted from the target medical problem as the literature retrieval information.

3. The method according to claim 1, characterized in that, The step of generating response content corresponding to the target medical question and reference information for the response content based on the local search results, the web search results, and the literature search results includes: A content filtering agent is used to filter the local search results, the web page search results, and the document search results based on content filtering prompts, so as to obtain filtered search results. A content-generating intelligent agent is used to generate prompts based on the content, assemble the filtered search results in a formatted manner, and generate the response content and reference information for the response content.

4. The method according to claim 3, characterized in that, The local search results include: local knowledge slices, slice titles, and knowledge links; the webpage search results include: webpage content, webpage titles, and webpage links; and the document search results include: document abstract content, document titles, and document links. The content-generating agent generates prompts based on the content, assembles the filtered search results in a formatted manner, and generates the response content and reference information for the response content, including: The intelligent agent is generated using the content, and format prompts are generated based on the content. The content of each search result in the filtered search results is formatted and assembled to generate the response content. Reference information for the response content is generated based on the title and link of each search result.

5. The method according to claim 2, characterized in that, The step of performing a local search in the local medical knowledge base based on the local search information to obtain local search results includes: Based on the triple query vector, a local search is performed in the local medical knowledge base to obtain candidate medical documents. The local medical knowledge base includes entities, entity relationships, and summaries of each medical document. Each medical document is divided into multiple semantic slices. Based on the triple query vector, a list of candidate slices is determined from the set of semantic slices of the candidate medical documents; The local search results are generated based on the candidate slice list.

6. The method according to claim 5, characterized in that, The step of generating the local search results based on the candidate slice list includes: Semantic relevance analysis is performed on the semantic slices in the candidate slice list to obtain a relevance score, which is used to indicate the degree of relevance between the semantic slices in the candidate slice list and the triple query vector; Based on the relevance score, the candidate slice list is reordered to obtain a sorted slice list; Determine adjacent semantic slices of the semantic slice in the sorted slice list from the candidate medical documents; Based on the adjacent semantic slices, the semantic slices in the sorted slice list are extended in context to obtain local knowledge slices; The local search results are generated based on the local knowledge slices, the slice titles of the local knowledge slices, and the knowledge links of the candidate medical documents.

7. The method according to claim 2, characterized in that, The step of performing an online webpage search based on the webpage search information to obtain webpage search results includes: Based on the webpage search keywords, perform an online webpage search to obtain webpage links; Based on the webpage link, obtain the webpage content; If the relevance score between the webpage content and the webpage search keywords exceeds a preset threshold, then the webpage search results are generated based on the webpage content, the webpage link, and the corresponding webpage title. If the relevance score between the webpage content and the webpage search keywords does not exceed the preset threshold, then the webpage search results are generated based on the webpage snapshot of the webpage content, the webpage link, and the webpage title.

8. The method according to claim 2, characterized in that, The step of conducting an online literature search based on the literature search information to obtain the literature search results includes: Based on the aforementioned document search keywords, an online document search is conducted to obtain a list of document identifiers; Based on the document content corresponding to the document identifier list, the document abstract and document title are parsed out. The document search results are generated based on the document abstract, the document title, and the document links within the document content.

9. An electronic device, characterized in that, include: The electronic device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is in operation, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method according to any one of claims 1 to 8.