Knowledge recall method and device based on document type, equipment and storage medium

By adopting differentiated retrieval strategies and deep semantic matching for different document types, the problem of low recall accuracy caused by the diversity of document types in the knowledge base is solved, and higher knowledge recall accuracy and agent response reliability are achieved.

CN122019711APending Publication Date: 2026-05-12JIQI CHENGDU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JIQI CHENGDU TECH CO LTD
Filing Date
2026-01-20
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

The diversity of document types and structural differences in the knowledge base leads to variations in semantic retrieval accuracy during knowledge recall, resulting in a decrease in recall accuracy.

Method used

A target retrieval strategy corresponding to the document type to be retrieved is adopted to retrieve relevant knowledge content from the knowledge base. By pre-setting similarity filtering and semantic relevance hybrid re-ranking, combined with a large model for secondary semantic matching, the final recall knowledge list is determined.

Benefits of technology

It improves the accuracy of knowledge retrieval, ensures precise matching and retrieval across different document types, and enhances the accuracy of the agent's answers to questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122019711A_ABST
    Figure CN122019711A_ABST
Patent Text Reader

Abstract

The invention provides a knowledge recall method and device based on a document type, equipment and a storage medium, and the method comprises the steps: responding to an input question of a user, employing a target retrieval strategy corresponding to the document type of a to-be-retrieved document, and retrieving first knowledge contents related to the input question of the user from a knowledge base; screening the first knowledge contents on the basis of a preset similarity to obtain second knowledge contents of which the similarity is greater than the preset similarity in the first knowledge contents, and performing hybrid reordering on the first knowledge contents on the basis of semantic relevancy between the second knowledge contents and the user question to obtain a reordered knowledge list; under the condition that the matching degree of the reordered knowledge list does not meet a preset condition, performing secondary semantic matching on the input question of the user and each second knowledge content through a large model; and determining a final recall knowledge list based on a matching result. According to the invention, the accuracy of knowledge recall is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and natural language processing technology, and in particular to a knowledge retrieval method, apparatus, device, and storage medium based on document type. Background Technology

[0002] The knowledge base, as an external capability of the intelligent agent, serves as part of the information source when answering user questions. When industry-specific or enterprise-specific knowledge is involved, information from the knowledge base is necessary as input for answering questions. Otherwise, the intelligent agent will rely on information synthesized from the model, resulting in inaccurate answers or even nonsensical statements.

[0003] Currently, due to the diversity of document types and structural differences in knowledge bases, the semantic retrieval accuracy varies during knowledge recall, resulting in a decrease in recall accuracy. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides a document-type-based knowledge retrieval method, apparatus, device, and storage medium, which improves retrieval accuracy.

[0005] In a first aspect, the present invention provides a knowledge retrieval method based on document type, the method comprising the following steps: In response to the user's input question, a target retrieval strategy corresponding to the document type of the document to be retrieved is adopted to retrieve the first knowledge content related to the user's input question from the knowledge base; Based on a preset similarity, each of the first knowledge contents is filtered to obtain each of the second knowledge contents whose similarity is greater than the preset similarity. Based on the semantic relevance of each of the second knowledge contents to the user's question, each of the first knowledge contents is mixed and reordered to obtain a reordered knowledge list. If the matching degree of the reordered knowledge list does not meet the preset conditions, a second semantic matching is performed between the user's input question and each of the second knowledge contents using a large model. Based on the matching results, the final list of knowledge to be recalled is determined.

[0006] According to the present invention, a knowledge retrieval method based on document type is provided, wherein the document type includes a first type of unstructured document and a second type of structured question-answer pair; before retrieving the first knowledge content related to the user's input question from the knowledge base in response to the user's input question by adopting a target retrieval strategy corresponding to the document type of the document to be retrieved, the method further includes: Based on the format, structure, or content characteristics of the document to be retrieved, documents that conform to the preset question-and-answer format are identified as the second type of structured question-and-answer pairs. Documents that do not conform to the preset question-and-answer format are identified as unstructured documents of the first type.

[0007] According to a document type-based knowledge retrieval method provided by the present invention, before retrieving the first knowledge content related to the user's input question from the knowledge base by adopting a target retrieval strategy corresponding to the document type of the document to be retrieved in response to the user's input question, the method further includes: For the first type of unstructured document, text parsing and semantic slicing are performed on the first type of unstructured document to form multiple document slices, and a corresponding vectorized representation is generated for each document slice to construct a first index; For the second type of structured question-answer pairs, multiple independent processing units are determined based on the completeness of each question-answer pair, and a corresponding vectorized representation is generated for the question part in each processing unit to construct a second index.

[0008] According to a document type-based knowledge retrieval method provided by the present invention, the first knowledge content is mixed and reordered based on the semantic relevance of each second knowledge content to the user question to obtain a reordered knowledge list, including: Calculate the first semantic relevance between the user's input question and each retrieved question-answer pair, and calculate the second semantic relevance between the user's input question and each document slice. The question-answer pairs are sorted according to the first semantic relevance of each pair to obtain a sorted list of question-answer pairs. Each document slice is sorted according to the second semantic relevance to form a sorted list of document slices. Based on the sorted question-answer pair list and the sorted document slice list, the reordered knowledge list is determined.

[0009] According to a document type-based knowledge retrieval method provided by the present invention, before performing secondary semantic matching between the user's input question and each of the second knowledge contents using a large model when the matching degree of the reordered knowledge list does not meet a preset condition, the method further includes: Configure a first relevance threshold for unstructured documents of the first type, and configure a second relevance threshold for structured question-answer pairs of the second type; Based on the first relevance threshold, knowledge content that meets the preset conditions is selected from the sorted list of document slices. Based on the second relevance threshold, knowledge content that meets the preset conditions is selected from the sorted question-and-answer pair list.

[0010] According to the document type-based knowledge retrieval method provided by the present invention, the step of performing secondary semantic matching between the user's input question and each second knowledge content through a large model includes: Identify candidate knowledge content in the reordered knowledge list that has a relevance to the user's input question that is higher than the minimum benchmark but lower than the first relevance threshold or the second relevance threshold. The candidate knowledge content is input into the large model, and the large model is guided by preset prompt words to determine the semantic relevance between the candidate knowledge content and the user's input question, so as to obtain the associated candidate knowledge content; The associated candidate knowledge content is determined as the matching result.

[0011] Secondly, the present invention also provides a document type-based knowledge retrieval device, which includes the following modules: The differentiated retrieval module is used to respond to the user's input question by adopting a target retrieval strategy corresponding to the document type of the document to be retrieved, and retrieving the first knowledge content related to the user's input question from the knowledge base; The hybrid reordering module is used to filter each first knowledge content based on a preset similarity to obtain each second knowledge content whose similarity is greater than the preset similarity, and to perform hybrid reordering on each first knowledge content based on the semantic relevance of each second knowledge content to the user question to obtain a reordered knowledge list. The deep judgment module is used to perform secondary semantic matching between the user's input question and each of the second knowledge contents through a large model when the matching degree of the reordered knowledge list does not meet the preset conditions. The recall module is used to determine the final list of knowledge to be recalled based on the matching results.

[0012] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the document type-based knowledge retrieval method as described above.

[0013] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the document type-based knowledge retrieval method as described above.

[0014] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the document type-based knowledge retrieval method as described above.

[0015] The document-type-based knowledge retrieval method, apparatus, device, and storage medium provided by this invention, in response to a user's input question, employs a target retrieval strategy corresponding to the document type of the document to be retrieved to retrieve first knowledge content related to the user's input question from a knowledge base; then, the first knowledge content is filtered based on a preset similarity to obtain second knowledge content with a similarity greater than the preset similarity; and the first knowledge content is then reordered based on the semantic relevance of each second knowledge content to the user's question to obtain a reordered knowledge list; if the matching degree of the reordered knowledge list does not meet the preset conditions, a large model is used to perform secondary semantic matching between the user's input question and each second knowledge content; finally, based on the matching results, the final retrieved knowledge list is determined.

[0016] This invention employs different target retrieval strategies for different document types, processing and judging them separately. Furthermore, it adds a deep judgment logic node. When the matching degree of the reordered knowledge list does not meet the preset conditions (and matching knowledge cannot be retrieved), a large model is used to perform secondary semantic matching between the user's input question and each second knowledge content. Then, based on the matching results, the final recall knowledge list is determined, improving the accuracy of knowledge recall. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is one of the flowcharts of the document type-based knowledge retrieval method provided by the present invention.

[0019] Figure 2 This is a schematic diagram of the question-and-answer pair format knowledge content provided by the present invention.

[0020] Figure 3 This is a schematic diagram of the document-based knowledge content provided by the present invention.

[0021] Figure 4 This is a schematic diagram of the configuration interface for the first and second correlation thresholds provided by the present invention.

[0022] Figure 5 This is the second flowchart of the document type-based knowledge retrieval method provided by the present invention.

[0023] Figure 6 This is a schematic diagram of the document-type-based knowledge retrieval device provided by the present invention.

[0024] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0026] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, a first node can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0027] The following is combined Figures 1-7 This invention describes a document-type-based knowledge retrieval method, apparatus, device, and storage medium.

[0028] Figure 1 This is one of the flowcharts illustrating the document type-based knowledge retrieval method provided by the present invention, such as... Figure 1 As shown, the method includes the following: Step 101: In response to the user's input question, adopt the target retrieval strategy corresponding to the document type of the document to be retrieved, and retrieve the first knowledge content related to the user's input question from the knowledge base.

[0029] It should be noted that the execution subject of this invention is an electronic device, used to implement a document type-based knowledge retrieval method to improve the accuracy of knowledge retrieval.

[0030] First, in response to the user's input question, the system processes and determines the document type of the document to be retrieved. Document types include, for example, document format or question-and-answer pair format. Question-and-answer pair format includes a question and its corresponding answer, while document format includes technical documents, reports, and articles.

[0031] The target retrieval strategy represents what content is used to retrieve information from the knowledge base. For example, for a document in the form of a question-answer pair, the answer is retrieved based on the question, keywords, and similar question-answer pairs; for a document in the form of a document, the answer is retrieved based on the entire content of the document.

[0032] In practical applications, in response to user questions, different retrieval strategies corresponding to different document types are used to retrieve information from the knowledge base and generate initial knowledge content (i.e., first knowledge content) corresponding to different document types.

[0033] Step 102: Filter each first knowledge content based on the preset similarity to obtain each second knowledge content whose similarity is greater than the preset similarity. Then, based on the semantic relevance of each second knowledge content to the user's question, re-sort each second knowledge content to obtain the re-sorted knowledge list.

[0034] Specifically, after initially retrieving the initial knowledge content (i.e., the first knowledge content) corresponding to different document types, each knowledge content is first filtered based on a preset similarity, for example, a preset similarity of 80%. In practical applications, each piece of first knowledge content is matched with the user's input question for similarity. If the similarity between the first knowledge content and the user's input question is greater than or equal to the preset similarity, then the first knowledge content is used as the second knowledge content; otherwise, if the similarity between the second knowledge content and the user's input question is less than the preset similarity, then the first knowledge content is not retained. The above discrimination is performed on each piece of first knowledge content in turn, and each piece of second knowledge content with a similarity greater than the preset similarity is used as the input for the next step.

[0035] The second knowledge content is mixed and reordered according to its semantic relevance to the user's question, resulting in a reordered knowledge list. The reordered knowledge list includes knowledge content arranged from high to low semantic relevance.

[0036] Step 103: If the matching degree of the reordered knowledge list does not meet the preset conditions, perform secondary semantic matching between the user's input question and each second knowledge content through the large model.

[0037] Specifically, after obtaining the reordered knowledge list, the knowledge content in the reordered knowledge list is evaluated according to preset conditions (such as a preset semantic relevance threshold), and the knowledge content in the reordered knowledge list that meets the preset conditions (such as the relevance threshold of the user input question being greater than the preset semantic relevance threshold) is selected as candidate knowledge content.

[0038] However, in practical applications, there may be anomalies in threshold matching. That is, the actual knowledge content is relevant to the user's question, but because the threshold is lower than the configured range, the matching knowledge cannot be retrieved.

[0039] Based on the above anomalies, this invention adds model depth judgment logic, that is, adds a large model judgment node to perform semantic judgment again on the knowledge obtained from user input question and similarity matching based on prompt words, so as to ensure the accuracy of recalled knowledge.

[0040] The judgment process constructs prompt words based on the user input question and each second knowledge content. Based on the prompt words, the large model filters out the knowledge content in each second knowledge content that is semantically related to the user input question, that is, the associated candidate knowledge content (that is, the matching result of the second matching).

[0041] Step 104: Based on the matching results, determine the final recall knowledge list.

[0042] Specifically, the matching result is the associated candidate knowledge content obtained based on secondary semantic matching. Then, the associated candidate knowledge content is added to the final recalled knowledge list.

[0043] The method provided in this embodiment, in response to a user's input question, employs a target retrieval strategy corresponding to the document type of the document to be retrieved, and retrieves first knowledge content related to the user's input question from the knowledge base; then, it filters each first knowledge content based on a preset similarity to obtain each second knowledge content whose similarity is greater than the preset similarity, and performs a mixed reordering of each first knowledge content based on the semantic relevance of each second knowledge content to the user's question to obtain a reordered knowledge list; if the matching degree of the reordered knowledge list does not meet the preset conditions, a large model is used to perform a secondary semantic matching between the user's input question and each second knowledge content; finally, based on the matching results, the final recalled knowledge list is determined.

[0044] This invention employs different target retrieval strategies for different document types, processing and judging them separately. Furthermore, it adds a deep judgment logic node. When the matching degree of the reordered knowledge list does not meet the preset conditions (and matching knowledge cannot be retrieved), a large model is used to perform secondary semantic matching between the user's input question and each second knowledge content. Then, based on the matching results, the final recall knowledge list is determined, improving the accuracy of knowledge recall.

[0045] It should be noted that each implementation method of this application can be freely combined, rearranged, or executed individually, and does not need to rely on or depend on a fixed execution order.

[0046] According to the present invention, a knowledge retrieval method based on document type is provided, wherein the document type includes a first type of unstructured document and a second type of structured question-answer pair; in response to a user's input question, before retrieving the first knowledge content related to the user's input question from the knowledge base using a target retrieval strategy corresponding to the document type of the document to be retrieved, the method further includes: Based on the format, structure, or content characteristics of the documents to be retrieved, those that conform to the preset question-and-answer format are identified as the second type of structured question-and-answer pairs. Documents that do not conform to the preset question-and-answer format are identified as unstructured documents of type 1.

[0047] Specifically, this invention divides knowledge into a first type of unstructured documents (document format) and a second type of structured question-and-answer pairs (question-and-answer pair format). That is, the document types include the first type of unstructured documents and the second type of structured question-and-answer pairs.

[0048] Figure 2 This is a schematic diagram of the question-and-answer pair format knowledge content provided by the present invention, such as... Figure 2 As shown, the knowledge base includes multiple question-and-answer pairs (questions). Each question-and-answer pair includes the question, the corresponding answer, and keywords. Each knowledge entry has corresponding "Edit" and "Delete" buttons. Within the knowledge base, users can "Add," "Batch Process," "Search," and "Reset" question-and-answer pairs. A "Back" button is also located in the upper right corner.

[0049] Figure 3 This is a schematic diagram of the document-based knowledge content provided by the present invention, such as... Figure 3 As shown, the knowledge base includes multiple document-based instructions. Each document-based knowledge item includes its name, format, size, whether it parses images, parsing status, and the information of the uploading user. Each knowledge item is followed by "Preview" and "Delete" buttons. Within the knowledge base, users can "Import Documents," "Batch Delete," "Search," and "Reset" document-based knowledge items. A "Back" button is also located in the upper right corner.

[0050] In some embodiments, the determination of document type is also included before the retrieval is performed, and this process can be implemented in one or more combinations of the following: 1. Format and Structure Analysis: Parse the document's metadata and file format, or use pattern matching algorithms to search for preset question-and-answer markers (such as "Q: / A:", "Q / Answer", etc.) in the entire document.

[0051] 2. Content Feature Extraction: Using natural language processing technology, extract features such as the proportion of interrogative sentences, the distribution of interrogative words, and the structural patterns of paragraph pairs in the document.

[0052] 3. Classification Model Determination: The document text is input into a pre-trained text classification model. This model is trained on a large number of question-answer pair samples and unstructured document samples, and can output the probability that the document belongs to the question-answer pair type. When this probability exceeds a set threshold, it is determined to be of type II; otherwise, it is determined to be of type I. The following examples illustrate the question-and-answer pair format and the document format: ①Document A (clearly a question-and-answer pair): Q: How do I reset my password? A: Please visit your account settings page and click the "Forgot Password" link... Q: Service support hours? A: Monday to Friday, 9:00-18:00.

[0053] Recognition process: The regular expression immediately matched multiple Q: and A:, and the rule engine directly determined it to be successful.

[0054] ②Document B (unmarked but actually a question-and-answer pair): What is RAG? RAG is an abbreviation for Retrieval Enhancement Generation, which combines... What are its advantages? Advantages include reducing large model illusions and utilizing external knowledge bases.

[0055] Recognition process: The rule engine did not find any explicit markers. However, analysis revealed that the paragraphs were paired; the first paragraph ended with a question mark, and the second paragraph was a declarative sentence containing the interrogative word "what." Based on these semantic and structural patterns, the classification model assigned a high-probability score (e.g., 0.9), exceeding the threshold, and thus was classified as a question-answer pair.

[0056] ③Document C (Technical Document): Chapter 3 Installation Guide Recognition process: No explicit tags, no paired question-and-answer patterns in paragraphs, and few interrogative sentences. The classification model gives a low probability score (e.g., 0.05), classifying it as an unstructured document.

[0057] The method provided in this embodiment maximizes the accuracy of classifying documents into "structured question-answer pairs" or "unstructured documents". This invention adopts different target retrieval strategies for different document types and processes and judges them separately, thereby improving the accuracy of knowledge retrieval.

[0058] According to the document type-based knowledge retrieval method provided by the present invention, in response to a user's input question, before retrieving the first knowledge content related to the user's input question from the knowledge base using a target retrieval strategy corresponding to the document type of the document to be retrieved, the method further includes: For the first type of unstructured documents, text parsing and semantic slicing are performed to form multiple document slices, and a corresponding vectorized representation is generated for each document slice to construct the first index; For the second type of structured question-answer pairs, multiple independent processing units are determined based on the completeness of each question-answer pair, and a corresponding vectorized representation is generated for the question part in each processing unit to construct a second index.

[0059] Specifically, in some embodiments, the retrieval process includes creating corresponding indexes for different types of documents, which includes the following steps: Part 1: Building the First Index (for Unstructured Documents) First, semantic slicing is performed on the first type of unstructured documents, including: identifying the boundaries of chapters, subheadings, figure titles, or code blocks in the document; slicing is performed based on the boundaries, and each slice contains a logically complete unit of description.

[0060] The goal of the first index is to convert long, continuous unstructured documents (such as technical manuals, product specifications, and research reports) into a series of semantically complete and independently searchable text chunks, and to generate a high-dimensional vector representation for each chunk, storing it in a vector database. The process of building the first index includes the following steps: Step S1-1: Document Preprocessing and Parsing Input: Raw unstructured documents, in formats such as Portable Document Format (PDF), Word, HyperText Markup Language (HTML), Markdown, etc.

[0061] operate: Format parsing: Use appropriate parsing libraries (such as PyPDF2, python-docx, BeautifulSoup) to extract plain text, style information (such as font, bold) and structural elements (such as headings, lists) from the document.

[0062] Text cleaning: Remove irrelevant headers, footers, page numbers, and line breaks; convert full-width characters to half-width characters; and perform basic standardization.

[0063] Step S1-2: Document Structure Analysis and Semantic Slicing Input: Cleaned structured text stream and its metadata.

[0064] operate: 1. Structure recognition: Automatically recognizes the hierarchical structure of a document based on style and text patterns.

[0065] Identify titles: Mark chapter titles and subheadings using regular expressions (such as Chapter [1234567890]) or font size / bold information.

[0066] Identify special blocks: Identify code blocks (such as text enclosed in quotation marks), table titles (such as "Table 1-1"), and chart titles (such as "... Figure 2 The boundary of .3”.

[0067] 2. Semantic slicing strategy: Title-based slicing: Group consecutive paragraphs into a slice using chapters or subheadings as natural boundaries. Ensure that each slice contains a relatively complete thematic argument.

[0068] Sliding window slicing (backup): For documents without explicit titles, use a fixed-size text window (e.g., 500 characters) for sliding slicing and set an overlap area (e.g., 100 characters) to avoid cutting off semantics in the middle of sentences.

[0069] Integrity guarantee rules: Ensure that the content of a slice is semantically consistent. For example, a parameter description should include its "definition, type, value range, and example". Ensure that charts, code blocks, and their corresponding descriptive text are within the same slice.

[0070] Additional metadata for each slice: Records metadata such as the source document, chapter title, and position in the original text for each slice.

[0071] Step S1-3: Vectorized Representation and Index Construction Input: Semantic slice text and its metadata.

[0072] operate: 1. Text Embedding: Using a pre-trained text embedding model, each text slice is treated as a whole and transformed into a high-dimensional dense vector (e.g., a 1536-dimensional floating-point vector). This vector encodes the semantic information of the slice.

[0073] 2. Build a vector index: Store the generated (vector, sliced ​​text, metadata) triples in a dedicated vector database or build a local index.

[0074] 3. Result: The first index is formed. When a user asks a question, the system vectorizes the question and performs an approximate nearest neighbor search in this index to recall several document slices that are most semantically similar.

[0075] For document-based knowledge, we need to perform similarity matching on the slices after the initial document parsing. When recalling knowledge content, we configure different thresholds based on the scenario, and we can also flexibly configure the scope of relevant content to be recalled. Specifically, for documents such as technical specifications, we perform high-fidelity slicing by chapter and subheading, retaining content such as chart titles and code blocks, while ensuring that each slice contains complete parameter descriptions and return value information.

[0076] Part Two: Building the Second Index (for Structured Question-Answer Pairs) The goal of the second index is to construct an index from a set of discrete question-answer pairs, with the "question" as the core retrieval key. It maintains the integrity of the "answers" and strongly associates them with the "question."

[0077] Step S2-1: Question-answer pair extraction and unitization Input: Documents already identified as second type, such as a list of frequently asked questions (FAQ), a comma-separated values ​​(CSV) file, or a JavaScript object notation (JSON) file in a specific format.

[0078] operate: 1. Structured Extraction: Based on the inherent format of the document, accurately extract each pair of "question" and "answer".

[0079] For CSV: directly read the "Question" column and the "Answer" column.

[0080] For JSON: Parse the specified q and a fields.

[0081] For text marked with "Q:" or "A:", use regular expressions to match and extract the text.

[0082] 2. Unitized encapsulation: Each (question, answer) pair is encapsulated as an independent, indivisible processing unit. No slicing or truncation is performed internally on the question-answer pair.

[0083] Step S2-2: Problem Text Enhancement and Vectorization Input: The “problem” text extracted from each processing unit.

[0084] operate: 1. Keyword / Similar Question Expansion (Optional but Important): The original question is segmented and keywords are extracted. Using a thesaurus or language model, several semantically similar questions are generated for the original question. For example, for "How to reset password?", "What to do if I forget my password?" and "Steps to retrieve password?" can be generated. The original question, keywords, and similar questions are then concatenated or combined to form a richer "search query text".

[0085] 2. Vectorization: Using the same text embedding model as the first index, the "question text" (or enhanced search query text) of each processing unit is converted into a high-dimensional vector. Here, the vectorized object is the "question," not the "answer."

[0086] Step S2-3: Index building and associated storage Input: Question vector, complete question-answer pair text, and possible extended questions.

[0087] operate: 1. Construct a vector index: Store the question vectors of all question-answer pairs into a vector database to construct a second index.

[0088] 2. Relate to complete content: In the database, establish strong associations between question vectors and their corresponding complete answers, original questions, and lists of similar questions.

[0089] 3. Result: A second index is formed. When a user asks a question, the system vectorizes the question and searches for the most similar "question vector" in this index. Since the index is for "questions," this essentially achieves a kind of "question matching" or "intent matching," thereby accurately recalling the preset standard answer.

[0090] In practical applications, for question-answer pair retrieval, we need to accurately match keywords, questions, and similar questions. For the Q&A list, we need to maintain the integrity of each question-answer pair as a slice and for recall.

[0091] This application transforms raw, heterogeneous knowledge base content into high-quality, structured vector indexes suitable for subsequent differentiated retrieval and intelligent ranking. The first index (for semantic search) converts long documents into semantically complete fragments, ensuring that each search result is a self-consistent unit of information (such as a complete parameter description or operational steps). When answering user questions about specific technical details, it can directly recall paragraphs containing complete context, fundamentally avoiding information fragmentation or noise introduction caused by arbitrary segmentation, greatly improving the accuracy of generated answers. The second index (for intent matching) constructs standard question-answer pairs as a precise mapping of "question → answer." When a user's question is highly similar to a preset question, it can achieve near 100% accurate recall, directly outputting a standard answer, ensuring the consistency and reliability of answers to common and key questions, and avoiding the risks that may arise from the "free-flowing" nature of large models.

[0092] The method provided in this example has two indexes. The first index carries dedicated processing logic for unstructured documents: semantic slicing preserves the contextual integrity and logical structure of technical documents, making them suitable for semantic similarity searches. The second index carries dedicated processing logic for structured question-and-answer pairs: by building an index around the "question," it achieves precise intent matching rather than generalized semantic search. The construction of these two indexes physically separates and differentiates document types, directly embodying the "type-aware" concept of this invention.

[0093] According to a document type-based knowledge retrieval method provided by the present invention, the first knowledge content is reordered based on the semantic relevance of each second knowledge content to the user's question to obtain a reordered knowledge list, including: Calculate the first semantic relevance between the user's input question and each retrieved question-answer pair, and calculate the second semantic relevance between the user's input question and each document slice. The question-answer pairs are sorted according to their primary semantic relevance to obtain a sorted list of question-answer pairs. Each document slice is sorted according to its second semantic relevance to form a sorted list of document slices; Based on the sorted list of question-answer pairs and the sorted list of document slices, determine the reordered list of knowledge.

[0094] Specifically, in some embodiments, the process of mixing and reordering the initial knowledge content in step 102 includes the following steps: First, the first semantic relevance between the user's input question and each retrieved question-answer pair is calculated, and the second semantic relevance between the user's input question and each document slice is calculated. Calculating the first semantic relevance (for question-answer pairs) and the second semantic relevance (for document slices) is the core computational step in this scheme to achieve precise matching and semantic matching decomposition.

[0095] The first semantic relevance score is used to determine the degree of matching between the user's intent and the preset questions in the knowledge base. Its calculation includes the following steps 1-4: 1. Obtain the query vector: The user's input question is processed through a pre-trained text embedding model to obtain its vector representation V_user.

[0096] 2. Obtain candidate question vectors: Retrieve a set of candidate question-answer pairs from the second index. For each candidate pair, its question vector V_q_k has been pre-stored in the index (this vector may have been generated based on the original question, keywords, and similar questions when the index was built).

[0097] 3. Calculate basic semantic similarity: For each candidate question-answer pair, calculate the cosine similarity between the vector representation V_user corresponding to the user's input question and the question vector of the candidate question-answer pair. This is the core score that measures the semantic similarity between the user's question and the preset questions.

[0098] Output: For each retrieved question-answer pair QA_k, calculate a numerical value S1_k as its first semantic relevance.

[0099] The second semantic relevance is used to determine the semantic relevance between a user's question and unstructured document fragments in the knowledge base. The calculation of the second semantic relevance includes the following steps 1-3: 1. Obtain the query vector: As above, obtain the vector V_user of the user's question.

[0100] 2. Obtain candidate slice vectors: Retrieve a set of candidate document slices from the first index. For each candidate slice DocChunk_j, the vector V_chunk_j of its full text has been pre-stored in the index.

[0101] 3. Calculate semantic similarity: For each candidate document slice, the cosine similarity between the vector of each candidate document slice and the vector of the user question is calculated. The cosine similarity directly reflects the semantic proximity between the user question and the content of the entire document slice. Since the semantic integrity is guaranteed during the slice construction, this score has high reference value.

[0102] 4. (Optional) Fine-tune or rearrange using metadata: Metadata such as the authority of the slice source (e.g., from an official manual vs. from personal notes) and freshness (update time) can be considered to make minor adjustments to the similarity score or as an additional feature for subsequent re-ranking.

[0103] 5. Output: For each retrieved document slice DocChunk_j, calculate a numerical S2_j as its second semantic relevance.

[0104] Furthermore, sorting the questions and answers according to the first semantic relevance from high to low yields a sorted list of question-and-answer pairs, which is also known as the sorted question-and-answer pair list; sorting them according to the second semantic relevance from high to low yields a sorted list of document slices.

[0105] Then, based on the sorted list of question-answer pairs and the sorted list of document slices, the re-sorted knowledge list is determined. This is the most crucial step: merging two lists sorted according to different criteria into a unified final list. There are several implementation strategies: Strategy 1: Normalize the scores and then directly sort them (most commonly used) 1. Fraction normalization: Normalize the fractions in the two lists to map them to the same dimension.

[0106] 2. Weighted merging and final sorting: Assign weights (configurable) to the two types to reflect the system's preference for different types of content.

[0107] Merge all entries from the two lists and sort them in descending order of the final scores to obtain a mixed list.

[0108] 3. Generate the final list: Take the first K items of the mixed list (e.g., K=5) as the final list.

[0109] Strategy 2: Based on a learning-based ranking model 1. Feature Engineering: Construct a set of features for each candidate entry (whether a question-answer pair or a document slice): Basic feature: Original relevance score (S1 or S2) Type characteristics: Document type (0 / 1 indicates) Quality characteristics: source authority, timeliness, text length, etc. Interaction features: Textual features matching the user's question (such as BM25 score). 2. Model Prediction: Each candidate item is scored using a pre-trained learning ranking model (such as LambdaMART or RankNet).

[0110] The model has learned during training how to integrate various features and prioritize the most relevant results.

[0111] 3. Sort by model score: All candidate items are sorted in descending order directly based on the relevance scores predicted by the model.

[0112] Strategy 3: Merging after threshold filtering Apply categorized thresholds separately: for question-and-answer knowledge, apply a question-and-answer pair threshold of 0.5; for document knowledge, apply a question-and-answer pair threshold of 0.3. Then, merge these two parts and sort them by either the original score or the normalized score.

[0113] The method provided in this embodiment uses the reordered knowledge list as context input to provide to a large language model to generate the final answer, thereby improving the accuracy and relevance of the final recalled knowledge.

[0114] According to the document type-based knowledge retrieval method provided by the present invention, before performing secondary semantic matching between the user's input question and each second knowledge content through a large model when the matching degree of the reordered knowledge list does not meet the preset conditions, the method further includes: Configure a first relevance threshold for unstructured documents of the first type, and configure a second relevance threshold for structured question-answer pairs of the second type; Based on the first relevance threshold, knowledge content that meets the preset conditions is selected from the sorted list of document slices. Based on the second relevance threshold, knowledge content that meets the preset conditions is selected from the sorted question-and-answer pair list.

[0115] Specifically, in some embodiments, the process of filtering for knowledge content that meets preset conditions before secondary semantic matching includes the following steps: Configure a first relevance threshold (e.g., 0.3) for unstructured documents of the first type, and a second relevance threshold (e.g., 0.5) for structured question-and-answer pairs of the second type. It should be noted that the ranking requirements differ significantly depending on the type of knowledge content; therefore, we will configure and match the thresholds separately in the following steps.

[0116] Further, knowledge content that meets preset conditions is filtered from the sorted document slice list based on a first relevance threshold; knowledge content that meets preset conditions is filtered from the sorted question-answer pair list based on a second relevance threshold. The preset conditions include, for example, that the number of filtered content meeting the threshold conditions is lower than a preset relevance threshold, or that the highest value of the first relevance and the second relevance is lower than a preset relevance threshold.

[0117] For example, Figure 4This is a schematic diagram of the configuration interface for the first and second correlation thresholds provided by the present invention, as shown below. Figure 4 As shown, in the retrieval settings, the threshold for question-and-answer knowledge is set to 0.5, and the recall is set to 5. For document knowledge, the threshold is set to 0.3, and the recall is set to 5. The figure shows that the default is a hybrid retrieval. The hybrid retrieval uses a re-ranking model to perform semantic matching on the knowledge retrieved by relevance matching, and selects the top n items whose threshold is greater than the configured x value (x is the configured threshold, and n is the configured recall).

[0118] The method provided in this embodiment configures a first relevance threshold for unstructured documents and a second relevance threshold for structured question-answer pairs of the second type. Then, it filters knowledge content that meets preset conditions from a sorted list of document slices based on the first relevance threshold, and filters knowledge content that meets preset conditions from a sorted list of question-answer pairs based on the second relevance threshold. By setting different thresholds for the two types, it responds to two different accuracy requirements: "question-answer pairs need precise matching" and "documents need semantic association." Furthermore, at the operational level, this differentiated accuracy control is enforced through differentiated filtering criteria. This step, along with the preceding document type identification and differentiated index construction, constitutes a complete, self-consistent, and efficient "type-aware retrieval enhancement" technical solution, an indispensable link in improving the accuracy and reliability of intelligent agent question answering.

[0119] According to the present invention, a document-type-based knowledge retrieval method performs secondary semantic matching between the user's input question and various second knowledge contents through a large model, including: Identify candidate knowledge content in the reordered knowledge list that has a relevance to the user's input question that is higher than the minimum baseline but lower than the first or second relevance threshold. The candidate knowledge content is input into the large model, and the large model is guided by preset prompt words to judge the semantic relevance between the candidate knowledge content and the user's input question, so as to obtain the associated candidate knowledge content. The associated candidate knowledge content is identified as the matching result.

[0120] Specifically, in some embodiments, the secondary semantic matching process in step 103 includes the following steps: First, identify candidate knowledge content in the reordered knowledge list that has a relevance to the user's input question higher than the minimum baseline but lower than the first or second relevance threshold. In other words, an unreasonable preset threshold setting prevents the retrieval of matching knowledge. At this point, a minimum baseline can be defined, which is a safety boundary lower than the formal threshold. Knowledge content below the minimum baseline is considered almost irrelevant and does not require in-depth analysis; content between the minimum baseline and the relevance threshold can be understood as candidate knowledge in a "gray area," worthy of further analysis.

[0121] Based on this, the embodiments of this application add model depth judgment logic. The purpose of the model depth judgment logic is to use the deep semantic understanding and reasoning ability of the large language model to make a second accurate judgment on the candidate knowledge in the "gray area" and identify the part that is truly related to the user's question.

[0122] Specifically, the steps include the following: 1. Construct the judgment task and prompt: For example: You are a precise information relevance discriminator. Please rigorously determine whether the "reference knowledge" is substantially helpful in answering the "user question".

[0123] Output only "Yes" or "No".

[0124] User question: {user_question} Reference knowledge: {candidate_content} Furthermore, the model can be asked to briefly provide its reasoning for its judgments, facilitating subsequent analysis and model optimization. Fine-tuning prompts can be designed for different types of knowledge; for example, emphasizing parameter and step matching in technical documents, and highlighting consistency of intent in question-and-answer pairs.

[0125] 2. Batch call large models: Each entry in the deep-level candidate pool is formatted according to the aforementioned prompt word template to form a batch of judgment requests. A large language model is then invoked for batch inference.

[0126] To improve efficiency, multiple pairs of (user questions, candidate knowledge) can be combined in the same request, and the model can be made to judge each pair independently.

[0127] 3. Analytical model output: Extract the "yes" or "no" judgment results returned by the model. Collect the candidate knowledge content that will be marked as "yes" into the associated candidate set, which stores multiple candidate knowledge contents.

[0128] Furthermore, the associated candidate knowledge content (the associated candidate set) is determined as the matching result. Specifically, the associated candidate set (with new scores) is merged with the direct recall set previously obtained through threshold filtering. This merged set is then sorted in descending order according to its relevance score to generate the final reordered knowledge list.

[0129] The method provided in this embodiment solves the inherent problem of low similarity in traditional vector retrieval due to "semantic relevance but large differences in vocabulary / sentence structure." As a safety net, it effectively reduces the omission of relevant knowledge, especially when dealing with complex and diverse problems. It is equivalent to configuring a dynamic and intelligent compensation mechanism for a static threshold, reducing the system's sensitivity to threshold settings and enhancing its robustness. While ensuring high accuracy (through strict thresholds), it utilizes the intelligence of a large model to expand the coverage, achieving the effect of prioritizing accuracy and intelligently filling in gaps.

[0130] Figure 5 This is the second flowchart of the document type-based knowledge retrieval method provided by the present invention, as shown below. Figure 5 As shown, the method includes: Receive user input and perform knowledge base content retrieval; process the retrieved content.

[0131] The knowledge base determines the agent: if it can answer, it outputs the answer based on the matching knowledge entry; if it cannot answer, it outputs the answer through model / network search.

[0132] The method provided in this embodiment, based on traditional knowledge content retrieval, adds special processing of retrieval content (classification processing) and knowledge base depth judgment model node (secondary semantic matching) processing, which greatly improves the accuracy of intelligent agent knowledge retrieval.

[0133] The document-type-based knowledge retrieval device provided by the present invention is described below. The document-type-based knowledge retrieval device described below and the document-type-based knowledge retrieval method described above can be referred to in correspondence with each other.

[0134] Figure 6 This is a schematic diagram of the document-type-based knowledge retrieval device provided by the present invention. Figure 6 The document-type-based knowledge retrieval device 600 includes the following modules: The differentiated retrieval module 610 is used to respond to the user's input question by adopting a target retrieval strategy corresponding to the document type of the document to be retrieved, and retrieving the first knowledge content related to the user's input question from the knowledge base. The hybrid reordering module 620 is used to filter each first knowledge content based on a preset similarity to obtain each second knowledge content whose similarity is greater than the preset similarity, and to perform hybrid reordering on each first knowledge content based on the semantic relevance of each second knowledge content to the user question to obtain a reordered knowledge list. The depth judgment module 630 is used to perform secondary semantic matching between the user's input question and each of the second knowledge contents through a large model when the matching degree of the reordered knowledge list does not meet the preset conditions. The recall module 640 is used to determine the final recall knowledge list based on the matching results.

[0135] The device provided in this embodiment adopts different target retrieval strategies for different document types, processes and judges them separately, and adds a deep judgment logic node. When the matching degree of the reordered knowledge list does not meet the preset conditions (the matching knowledge cannot be retrieved), a large model is used to perform secondary semantic matching between the user's input question and each second knowledge content. Then, based on the matching results, the final recall knowledge list is determined, which improves the accuracy of knowledge recall.

[0136] According to the present invention, a knowledge retrieval device 600 based on document type is provided, wherein the document type includes a first type of unstructured documents and a second type of structured question-answer pairs; the differential retrieval module 610 is further configured to: Based on the format, structure, or content characteristics of the document to be retrieved, documents that conform to the preset question-and-answer format are identified as the second type of structured question-and-answer pairs. Documents that do not conform to the preset question-and-answer format are identified as unstructured documents of the first type.

[0137] According to the document type-based knowledge retrieval device 600 provided by the present invention, the differential retrieval module 610 is further used for: For the first type of unstructured document, text parsing and semantic slicing are performed on the first type of unstructured document to form multiple document slices, and a corresponding vectorized representation is generated for each document slice to construct a first index; For the second type of structured question-answer pairs, multiple independent processing units are determined based on the completeness of each question-answer pair, and a corresponding vectorized representation is generated for the question part in each processing unit to construct a second index.

[0138] According to the document type-based knowledge retrieval device 600 provided by the present invention, the hybrid reordering module 620 is specifically used for: Calculate the first semantic relevance between the user's input question and each retrieved question-answer pair, and calculate the second semantic relevance between the user's input question and each document slice. The question-answer pairs are sorted according to the first semantic relevance of each pair to obtain a sorted list of question-answer pairs. Each document slice is sorted according to the second semantic relevance to form a sorted list of document slices. Based on the sorted question-answer pair list and the sorted document slice list, the reordered knowledge list is determined.

[0139] According to the present invention, a document type-based knowledge retrieval device 600 is provided, the device further comprising a threshold setting module; The threshold setting module is specifically used for: Configure a first relevance threshold for unstructured documents of the first type, and configure a second relevance threshold for structured question-answer pairs of the second type; Based on the first relevance threshold, knowledge content that meets the preset conditions is selected from the sorted list of document slices. Based on the second relevance threshold, knowledge content that meets the preset conditions is selected from the sorted question-and-answer pair list.

[0140] According to the present invention, a document type-based knowledge retrieval device 600 is provided, wherein the depth judgment module 630 is specifically used for: Identify candidate knowledge content in the reordered knowledge list that has a relevance to the user's input question that is higher than the minimum benchmark but lower than the first relevance threshold or the second relevance threshold. The candidate knowledge content is input into the large model, and the large model is guided by preset prompt words to determine the semantic relevance between the candidate knowledge content and the user's input question, so as to obtain the associated candidate knowledge content; The associated candidate knowledge content is determined as the matching result.

[0141] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 7 As shown, the electronic device may include: a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 can invoke logical instructions in the memory 730 to execute a document-type-based knowledge retrieval method, which includes: In response to the user's input question, a target retrieval strategy corresponding to the document type of the document to be retrieved is adopted to retrieve the first knowledge content related to the user's input question from the knowledge base; Based on a preset similarity, each of the first knowledge contents is filtered to obtain each of the second knowledge contents whose similarity is greater than the preset similarity. Based on the semantic relevance of each of the second knowledge contents to the user's question, each of the first knowledge contents is mixed and reordered to obtain a reordered knowledge list. If the matching degree of the reordered knowledge list does not meet the preset conditions, a second semantic matching is performed between the user's input question and each of the second knowledge contents using a large model. Based on the matching results, the final list of knowledge to be recalled is determined.

[0142] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part 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 the present invention. 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.

[0143] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the document-type-based knowledge retrieval method provided by the above methods, the method comprising: In response to the user's input question, a target retrieval strategy corresponding to the document type of the document to be retrieved is adopted to retrieve the first knowledge content related to the user's input question from the knowledge base; Based on a preset similarity, each of the first knowledge contents is filtered to obtain each of the second knowledge contents whose similarity is greater than the preset similarity. Based on the semantic relevance of each of the second knowledge contents to the user's question, each of the first knowledge contents is mixed and reordered to obtain a reordered knowledge list. If the matching degree of the reordered knowledge list does not meet the preset conditions, a second semantic matching is performed between the user's input question and each of the second knowledge contents using a large model. Based on the matching results, the final list of knowledge to be recalled is determined.

[0144] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the document-type-based knowledge retrieval methods provided by the above methods, the method comprising: In response to the user's input question, a target retrieval strategy corresponding to the document type of the document to be retrieved is adopted to retrieve the first knowledge content related to the user's input question from the knowledge base; Based on a preset similarity, each of the first knowledge contents is filtered to obtain each of the second knowledge contents whose similarity is greater than the preset similarity. Based on the semantic relevance of each of the second knowledge contents to the user's question, each of the first knowledge contents is mixed and reordered to obtain a reordered knowledge list. If the matching degree of the reordered knowledge list does not meet the preset conditions, a second semantic matching is performed between the user's input question and each of the second knowledge contents using a large model. Based on the matching results, the final list of knowledge to be recalled is determined.

[0145] The device embodiments described above are merely illustrative. 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0146] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications 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 the present invention.

Claims

1. A document type-based knowledge retrieval method, characterized in that, include: In response to the user's input question, a target retrieval strategy corresponding to the document type of the document to be retrieved is adopted to retrieve the first knowledge content related to the user's input question from the knowledge base; Based on a preset similarity, each of the first knowledge contents is filtered to obtain each of the second knowledge contents whose similarity is greater than the preset similarity. Based on the semantic relevance of each of the second knowledge contents to the user's question, each of the first knowledge contents is mixed and reordered to obtain a reordered knowledge list. If the matching degree of the reordered knowledge list does not meet the preset conditions, a second semantic matching is performed between the user's input question and each of the second knowledge contents using a large model. Based on the matching results, the final list of knowledge to be recalled is determined.

2. The document type-based knowledge retrieval method according to claim 1, characterized in that, The document types include unstructured documents of the first type and structured question-and-answer pairs of the second type; before retrieving the first knowledge content related to the user's input question from the knowledge base in response to the user's input question using a target retrieval strategy corresponding to the document type of the document to be retrieved, the method further includes: Based on the format, structure, or content characteristics of the document to be retrieved, documents that conform to the preset question-and-answer format are identified as the second type of structured question-and-answer pairs. Documents that do not conform to the preset question-and-answer format are identified as unstructured documents of the first type.

3. The document type-based knowledge retrieval method according to claim 2, characterized in that, Before retrieving the first knowledge content related to the user's input question from the knowledge base using a target retrieval strategy corresponding to the document type of the document to be retrieved, the method further includes: For the first type of unstructured document, text parsing and semantic slicing are performed on the first type of unstructured document to form multiple document slices, and a corresponding vectorized representation is generated for each document slice to construct a first index; For the second type of structured question-answer pairs, multiple independent processing units are determined based on the completeness of each question-answer pair, and a corresponding vectorized representation is generated for the question part in each processing unit to construct a second index.

4. The document type-based knowledge retrieval method according to claim 1, characterized in that, The first knowledge content is reordered based on the semantic relevance between each second knowledge content and the user question to obtain a reordered knowledge list, including: Calculate the first semantic relevance between the user's input question and each retrieved question-answer pair, and calculate the second semantic relevance between the user's input question and each document slice. The question-answer pairs are sorted according to the first semantic relevance of each pair to obtain a sorted list of question-answer pairs. Each document slice is sorted according to the second semantic relevance to form a sorted list of document slices. Based on the sorted question-answer pair list and the sorted document slice list, the reordered knowledge list is determined.

5. The document type-based knowledge retrieval method according to claim 4, characterized in that, Before performing secondary semantic matching between the user's input question and each of the second knowledge contents using a large model when the matching degree of the reordered knowledge list does not meet the preset conditions, the method further includes: Configure a first relevance threshold for unstructured documents of the first type, and configure a second relevance threshold for structured question-answer pairs of the second type; Based on the first relevance threshold, knowledge content that meets the preset conditions is selected from the sorted list of document slices. Based on the second relevance threshold, knowledge content that meets the preset conditions is selected from the sorted question-and-answer pair list.

6. The document type-based knowledge retrieval method according to claim 5, characterized in that, The step of performing secondary semantic matching between the user's input question and each of the second knowledge contents using a large model includes: Identify candidate knowledge content in the reordered knowledge list that has a relevance to the user's input question that is higher than the minimum benchmark but lower than the first relevance threshold or the second relevance threshold. The candidate knowledge content is input into the large model, and the large model is guided by preset prompt words to determine the semantic relevance between the candidate knowledge content and the user's input question, so as to obtain the associated candidate knowledge content; The associated candidate knowledge content is determined as the matching result.

7. A document-type-based knowledge retrieval device, characterized in that, include: The differentiated retrieval module is used to respond to the user's input question by adopting a target retrieval strategy corresponding to the document type of the document to be retrieved, and retrieving the first knowledge content related to the user's input question from the knowledge base; The hybrid reordering module is used to filter each first knowledge content based on a preset similarity to obtain each second knowledge content whose similarity is greater than the preset similarity, and to perform hybrid reordering on each first knowledge content based on the semantic relevance of each second knowledge content to the user question to obtain a reordered knowledge list. The deep judgment module is used to perform secondary semantic matching between the user's input question and each of the second knowledge contents through a large model when the matching degree of the reordered knowledge list does not meet the preset conditions. The recall module is used to determine the final list of knowledge to be recalled based on the matching results.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the document type-based knowledge retrieval method as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the document type-based knowledge retrieval method as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the document type-based knowledge retrieval method as described in any one of claims 1 to 6.