Retrieval method of dynamic knowledge base, medium and electronic equipment
By receiving users' organizational codes and natural language queries, dynamically selecting target knowledge bases and performing vector similarity retrieval, the problem of low knowledge base retrieval efficiency in existing technologies is solved, achieving efficient and accurate knowledge base retrieval and response.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHEXIAOZHI (BEIJING) TECHNOLOGY CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-10
AI Technical Summary
In existing RAG technology, the vector retrieval efficiency of the knowledge base is low, resulting in long waiting times for users and inaccurate search results, and it is impossible to achieve dynamic matching of knowledge base retrieval with the user's organization.
By receiving users' organizational codes and natural language questions, the system uses an intent recognition model to match business tags, dynamically selects a target knowledge base, performs vector similarity retrieval in the target knowledge base, recalls relevant text fragments, and generates responses by combining them with a large language model.
It narrows the search scope, improves search efficiency, ensures that users can only access the knowledge base they have permission to access, and generates highly relevant responses to questions, thus improving response quality.
Smart Images

Figure CN121833930A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence, and specifically relates to a retrieval method, medium, and electronic device for a dynamic knowledge base. Background Technology
[0002] In existing RAG (Retrieval-Augmented Generation) technologies, knowledge bases are often pre-created. For knowledge such as laws and judicial interpretations, all users can share them. However, policies, regulations, and work guidelines differ for users in different regions. Some specialized knowledge is only accessible to members of the organization, with access restricted to those outside. Furthermore, different user questions do not necessarily trigger a search of all matching knowledge bases. This is because knowledge bases are essentially vectors, and vector retrieval is inherently inefficient. Searching against matching knowledge bases based on user queries would be extremely inefficient, given the vast amount of existing laws, judicial interpretations, and policies available. This results in excessively long user wait times, a poor user experience, and less precise retrieved information. In other words, current technologies do not provide a flexible knowledge base that dynamically matches the user's organization. Summary of the Invention
[0003] In view of this, in order to solve the problem that users cannot dynamically select knowledge bases, the purpose of this invention is to provide a method, medium and electronic device for retrieving dynamic knowledge bases.
[0004] In a first aspect, embodiments of the present invention provide a retrieval method for a dynamic knowledge base, comprising:
[0005] Receive a user's login request and extract the user's organization code from the login request;
[0006] Receive a user's natural language question, identify the user's natural language question through an intent recognition model to obtain an intent recognition classification result, and match business tags based on the intent recognition classification result;
[0007] Dynamically select the target knowledge base from the knowledge base based on the user's organization code and the business tags matched by the user's natural language question;
[0008] The user's natural language question is converted into vector form, and vector similarity retrieval is performed in the target knowledge base to recall relevant text fragments;
[0009] The text fragment and the predefined prompt word template are input into the large language model to generate a response and output it.
[0010] Furthermore, the step of dynamically selecting the target knowledge base in the knowledge base based on the user's organization code and the business tags matched by the user's natural language question includes:
[0011] Based on the organization code, find the initial knowledge base corresponding to the user's organization in the knowledge base, and filter out the target knowledge base related to the business tag in the initial knowledge base.
[0012] Further, the step of finding the initial knowledge base corresponding to the user's organization in the knowledge base based on the organization code, and filtering the target knowledge base related to the business tag in the initial knowledge base based on the business tag includes:
[0013] A pre-configured permission association record is provided, in which the user's organization code is associated and bound with the knowledge base identifier and business tag set;
[0014] In the permission association record, the initial knowledge base corresponding to the user's organization is obtained based on the user's organization code;
[0015] Based on the business tag, a target knowledge base related to the business tag is selected from the initial knowledge base.
[0016] Furthermore, prior to executing the user's login request, the knowledge base is pre-created:
[0017] Create storage space;
[0018] Obtain the multimodal source file containing business specifications;
[0019] The multimodal source file is parsed and its structure is identified to obtain the text content;
[0020] The text content is divided into multiple semantically complete text fragments by combining semantic segmentation and document structure segmentation.
[0021] Each of the aforementioned text fragments is converted into a fixed-dimensional vector representation;
[0022] The vector representation and its corresponding business metadata are stored in a vector database to form a corresponding knowledge base, and a unique knowledge base identifier is assigned to the knowledge base.
[0023] The knowledge base is uploaded to a storage space, which has a storage space identifier.
[0024] Furthermore, the step of inputting the text fragment and the predefined prompt word template into the large language model to provide a response and output includes:
[0025] Based on the business tags, the corresponding large language model is adopted. The large language model processes the predefined prompt word templates and text fragments to generate a structured response and output it.
[0026] Furthermore, receiving a user's login request and extracting the user's organization code from the login request includes:
[0027] Upon receiving a user's login request, the system verifies the user's identity. Once the identity verification is successful, the system extracts the user's organization code from the login request. The organization code contains a unique coded segment associated with the administrative region to which the user belongs.
[0028] Furthermore, the step involves using a corresponding large language model based on business tags. This large language model processes predefined prompt word templates and text fragments to generate a structured response, which is then output as follows:
[0029] Query the matching records of pre-configured business tags with the corresponding large language model and prompt word template;
[0030] In the matching records, based on the binding relationship between business tags, large language models, and prompt word templates, the corresponding large language models and prompt word templates are loaded. After processing the text fragments using the prompt word templates, a structured response is generated and output.
[0031] Furthermore, the pre-configured permission association record, which associates and binds the user's organization code with the knowledge base identifier and business tag set, includes:
[0032] The system associates and binds the user's organization code, knowledge base identifier, and business tag, and also associates the storage space identifier corresponding to the knowledge base.
[0033] In a second aspect, embodiments of the present invention provide a computer scale storage medium, comprising: for storing computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method described in any of the above-mentioned embodiments.
[0034] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, characterized in that the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to describe the method described in any of the preceding embodiments.
[0035] The technical solution of this invention receives a user's login request and extracts the user's organization code from the request; receives the user's natural language question and uses an intent recognition model to identify the question, obtaining a classification result; matches business tags based on the classification result; and dynamically selects a target knowledge base from the knowledge base based on the user's organization code and the business tags matched to the question. This narrows the scope of the knowledge base to be searched based on the user's organization code. Within this scope, target knowledge bases related to the question are further filtered based on the business tags matched to the question. This further narrows the scope of the target knowledge base and ensures it is highly relevant to the question. Simultaneously, the target knowledge base determined by the user's organization code ensures that the user can only access knowledge bases they have access to. Members within an organization have access to the organization's proprietary knowledge base upon login, and this proprietary knowledge base can only be selected by members within the organization. Members outside the organization, due to different organization codes, cannot find a matching proprietary knowledge base upon login. The user's natural language question is converted into vector form, and vector similarity retrieval is performed in the target knowledge base to recall relevant text fragments. These text fragments and predefined prompt word templates are then input into a large language model to generate and output a response. Therefore, the technical solution of this invention dynamically matches the target knowledge base based on the user's organizational code and natural language question. This not only narrows the search scope and greatly improves search efficiency, but also allows for searching based on a knowledge base that matches the question, resulting in highly relevant retrieved content and higher quality subsequent responses. Attached Figure Description
[0036] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:
[0037] Figure 1 This is a flowchart illustrating the creation of a knowledge base according to an embodiment of the present invention;
[0038] Figure 2 This is a schematic diagram of the knowledge base according to an embodiment of the present invention;
[0039] Figure 3 This is a flowchart of a dynamic knowledge base retrieval method according to an embodiment of the present invention;
[0040] Figure 4 This is a schematic diagram of an electronic device implementing the present invention. Detailed Implementation
[0041] The present invention is described below based on embodiments, but the invention is not limited to these embodiments. In the detailed description of the invention below, certain specific details are described in detail. Those skilled in the art will fully understand the invention even without these details. To avoid obscuring the essence of the invention, well-known methods, processes, flows, elements, and circuits are not described in detail.
[0042] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0043] Unless the context explicitly requires it, words such as "including" or "contains" in the instruction manual should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".
[0044] In the description of this invention, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0045] Example 1
[0046] To address the problems of existing technologies, this invention provides a retrieval method for dynamic knowledge bases.
[0047] Figure 1 This is a flowchart of the knowledge base creation process according to an embodiment of the present invention.
[0048] Reference Figure 1 In one alternative implementation, the present invention creates a knowledge base through steps 1000-7000.
[0049] The knowledge base of this invention can be created by backend administrators or users. For example, knowledge bases such as laws and judicial interpretations can be created by backend administrators. Policies, regulations, and work guidelines can be created by either backend administrators or users.
[0050] Step 1000: Create storage space.
[0051] In one specific implementation, the storage space can be a folder. Preferably, the folder is named after a specific organization.
[0052] Figure 2 This is a schematic diagram of the knowledge base in an embodiment of the present invention.
[0053] Reference Figure 2In this invention, the knowledge base refers to the collection of knowledge bases under all folders. For example, users in region A preferably name their folder "Knowledge Base of Region A," and within the files of the Knowledge Base of Region A, they can upload knowledge bases A1, A2, and A3, etc., the specific number of which is not limited in this invention. Similarly, users in region B preferably name their folder "Knowledge Base of Region B." Within the files of the Knowledge Base of Region B, they can upload knowledge bases B1, B2, and B3, etc., the specific number of which is not limited in this invention. Users in region C preferably name their folder "Region C Knowledge Base". Within the "Region C Knowledge Base" folder, they can upload knowledge bases C1, C2, and C3, etc., the specific number of which is not limited in this invention. The knowledge bases in this invention refer to knowledge bases A1, A2, A3, B1, B2, B3, C1, C2, and C3, etc. When a new user from a new region joins the technical solution of this patent, preferably, a folder is created based on the user's region, named "Region Knowledge Base", and knowledge bases are uploaded within this folder.
[0054] In this invention, there are multiple users belonging to region A, multiple users belonging to region B, and multiple users belonging to region C. In this invention, users have their own organizational affiliations, and the knowledge base created by a user can be accessed by members within that organization. The specific implementation of this technical feature will be described in subsequent steps 310 and 320.
[0055] The following section details the steps for creating each knowledge base.
[0056] Step 2000: Obtain the multimodal source file containing the business specification content.
[0057] This invention relates to multimodal source files containing business specification content. Multimodal source files refer to digital document resources with diverse original forms, heterogeneous formats, and different information modalities, including but not limited to Word, Excel, PowerPoint, PDF, JPEG / PNG / SVG format images, MP4 / AVI / MKV format videos, and MP3 / WAV format audio. Multimodal source files include laws, judicial interpretations, policies and regulations, and work guidelines. They also include some proprietary knowledge. The initial formats of these multimodal source files containing business specification content can be Word, Excel, PDF, PPT, web pages, video, and audio, etc.
[0058] Step 3000: Perform content parsing and structure recognition on the multimodal source file to obtain the text content.
[0059] Step 4000: Using a combination of semantic segmentation and document structure segmentation, the text content is divided into multiple semantically complete text fragments.
[0060] Step 5000: Convert each of the text fragments into a fixed-dimensional vector representation.
[0061] Step 6000: Store the vector representation and its corresponding business metadata in the vector database to form a corresponding knowledge base, and assign a unique knowledge base identifier to the knowledge base.
[0062] Specifically, the vector database can be named "Knowledge Base A1".
[0063] Step 7000: Upload the knowledge base to the storage space, which has a storage space identifier.
[0064] Specifically, if a user in region A creates a folder named "Region A's Knowledge Base" in step 1000, then in step 6000, the user in region A will upload "Knowledge Base A1" to that folder.
[0065] Users in each region can create a knowledge base simply by repeating steps 1000-7000 above.
[0066] In other words, treat region A as an organization and create a storage space named "Region A's Knowledge Base" for this organization. This storage space contains one or more knowledge bases.
[0067] When members of an organization in region A (i.e., users belonging to this organization) upload knowledge (knowledge is structured or unstructured information composed of various types of text, data, facts, and experience), the knowledge is generated into a corresponding vector form according to steps 2000-7000. The knowledge represented by the vector is stored in the storage space of "Region A's Knowledge Base" in the form of a knowledge base. Members under the organization in region A can include one or more users, and the knowledge in the storage space named "Region A's Knowledge Base" can also be one or more sub-knowledge bases.
[0068] Figure 3 This is a flowchart of a dynamic knowledge base retrieval method according to an embodiment of the present invention.
[0069] Reference Figure 3 The retrieval method of the dynamic knowledge base of the present invention includes steps 100-500.
[0070] Step 100: Receive the user's login request and extract the user's organization code from the login request;
[0071] Step 200: Receive a user's natural language question, identify the user's natural language question using an intent recognition model to obtain an intent recognition classification result, and match business tags based on the intent recognition classification result;
[0072] Step 300: Dynamically select a target knowledge base in the knowledge base based on the user's organization code and the business tags matched by the user's natural language question;
[0073] Step 400: Convert the user's natural language question into vector form, perform vector similarity retrieval in the target knowledge base, and recall relevant text fragments;
[0074] Step 500: Input the text fragment and the predefined prompt word template into the large language model to provide a response and output it.
[0075] Steps 100-500 of the present invention will be described in detail below.
[0076] Step 100: Receive the user's login request and extract the user's organization code from the login request;
[0077] In one specific implementation, a user's login request is received, the user's identity is verified, and after the identity verification is successful, the user's organization code is extracted from the user's login request. The organization code contains a code segment that uniquely associates with the administrative region to which the user belongs.
[0078] Specifically, in step 100, a user's login request is received, and the user's identity is verified. After the identity verification is successful, the user's organization code is extracted from the user's login request. The organization code contains a coding segment associated with the user's organization. The user's organization may be, for example, the user's region or administrative region. The purpose of this is to extract the user's region, administrative region, or organization when the user logs in, so that in subsequent steps, a proprietary or private knowledge base can be dynamically matched for the user based on the organization code provided by the user.
[0079] Step 200: Receive a user's natural language question, identify the user's natural language question using an intent recognition model to obtain an intent recognition classification result, and match business tags based on the intent recognition classification result;
[0080] In this invention, multiple business tags are predefined. The system receives natural language queries from users and performs intent recognition on these queries. Specifically, the intent recognition model can be used to identify the user's natural language queries; this model can employ a basic large language model. In other words, the intent recognition model matches the user's natural language queries to one or more predefined business tags. The purpose of this is to first classify the user's natural language queries using the intent recognition model, allowing for different processing based on different classifications in subsequent steps. The classification is based on matching the user's natural language queries with the predefined business tags. A user query can be matched with one or more business tags.
[0081] Step 300: Dynamically select a target knowledge base from the knowledge base based on the user's organization code and the business tags matched by the user's natural language question.
[0082] Specifically, step 300 includes three sub-steps. The three sub-steps of step 300 are step 310, step 320, and step 330.
[0083] Step 310: Pre-configure permission association records, in which the user's organization code is associated and bound with the knowledge base identifier and business tag set;
[0084] Step 320: In the permission association record, obtain the initial knowledge base corresponding to the organization to which the user belongs based on the user's organization code;
[0085] Step 330: Select target knowledge bases related to the business tags from the initial knowledge base based on the business tags.
[0086] Specifically, in step 310, the user's organization code is associated and bound to the knowledge base identifier, thus mapping the user to the knowledge base that the user can operate. Step 310 can be implemented by creating data records in a database table. One or more data records can be created. The fields of the data record include: storage space identifier, knowledge base identifier, and user's organization code. This record supports many-to-many mapping: a single organization identifier can be bound to multiple knowledge base identifiers. A single knowledge base identifier can also be shared by multiple organizations, such as a municipal-level "General Legal Knowledge Base" being open to all subordinate districts and counties.
[0087] In one optional embodiment, the permission association record is used to automatically determine the scope of knowledge bases that a user can access after completing authentication, so as to prohibit the user from retrieving information in knowledge bases that do not belong to the organization.
[0088] In one optional embodiment, the permission association record is configured during the system initialization phase, so that users can automatically obtain knowledge base access permissions matching their organization identity without having to manually select a region or knowledge base after logging in.
[0089] In one specific implementation, after a user logs in, their organization code has already been extracted in step 100. Since the administrator has pre-associated the organization code with the knowledge base identifiers unique to each organization member, the private knowledge bases that the current user can access are determined in conjunction with step 320.
[0090] Step 320: In the permission association record, retrieve the initial knowledge base corresponding to the user's organization based on the user's organization code. Through step 320, the user can use the initial knowledge base corresponding to their organization. In other words, the initial knowledge base is a part of the total knowledge base; this part is a proprietary or private knowledge base accessible to users within that organization. The purpose of this is threefold: first, to restrict access to proprietary or private knowledge bases; second, to narrow the search scope for specific questions, resulting in higher retrieval efficiency; and third, to ensure that the knowledge stored in proprietary or private knowledge bases is more accurate than the knowledge presented in the natural language queries of users within that organization.
[0091] In this invention, different tags are pre-selected for the knowledge base. Specifically, pre-defined business tags can be selected for the knowledge base when uploading it. In step 330, target knowledge bases related to the business tags are filtered out from the initial knowledge base. Step 330 can further narrow down the knowledge base to fit the user's natural language questions based on step 320. Specifically, this can be achieved by matching the business tags extracted in step 200 with the tags in the knowledge base, and using the subset of knowledge bases in the initial knowledge base that match the business tags as the target knowledge base.
[0092] In other words, besides dynamically selecting a proprietary or private knowledge base as the initial knowledge base for users of different organizations, this invention also needs to further match a target knowledge base related to the user's question within the initial knowledge base. The matching is based on whether the knowledge base's tags match the business tags of the user's natural language question. This results in a smaller target knowledge base that is highly relevant to the user's natural language question, leading to higher retrieval efficiency. Consequently, the quality of the subsequent responses is also higher.
[0093] Step 400: Convert the user's natural language question into vector form, perform vector similarity retrieval in the target knowledge base, and recall relevant text fragments.
[0094] Specifically, in step 400, the user's natural language query is converted into vector form, and vector similarity retrieval is performed in the target knowledge base. Compared with the prior art, because this invention adopts a dynamic selection method for the target knowledge base, a target knowledge base matching the user's natural language query has already been selected in step 400. That is, the search scope has been dynamically adjusted when the user's organization is different. For example, the initial knowledge bases corresponding to users from different organizations are different. When the business tags matching the user's natural language query are different, the knowledge base is filtered again to select the target knowledge base from the initial knowledge base, and vector similarity retrieval is performed in the target knowledge base to recall relevant text fragments.
[0095] For users belonging to different organizations, when any user in region A (or organization A) logs in, the initial knowledge base M is matched first, while when any user in region B (or organization B) logs in, the initial knowledge base N is matched first.
[0096] It should be noted that even for the same user, when his first question matches the target knowledge base, it can be a subset of knowledge base A, and when his second question matches the target knowledge base, it can be a subset of knowledge base B.
[0097] In other words, the knowledge base of this invention dynamically changes based on the user's organization or the user's natural language questions. The search scope is limited by the target knowledge base identifier, and semantic matching of user questions is performed in conjunction with a set of target business tags to retrieve information highly relevant to the user's organization and business scenario. The beneficial effects of this include at least the following: users in different organizations have their own proprietary or private knowledge bases. Once logged in, the proprietary or private knowledge base is determined. Members of different organizations do not have permission to access each other's proprietary or private knowledge bases. This invention also extracts business tags from the user's natural language questions, and the knowledge base also has corresponding business tags, which further narrows the search scope and makes the retrieved text fragments more accurate. Different user natural language questions may result in different business tags, and the selected target knowledge base will also be different; that is, the target knowledge base and the user's natural language questions are dynamically matched.
[0098] In subsequent steps of this invention, different large language models or prompt word templates of the large language model to be called can be selected according to different organizational codes or business tags. Alternatively, when the user's natural language question is a statistical question, since the vector knowledge base does not provide a good answer, the interface can be called to provide a subsequent response to the statistical question.
[0099] Step 500: Input the text fragment and the predefined prompt word template into the large language model to provide a response and output it.
[0100] In one optional implementation, a corresponding large language model is adopted based on the business tag. The large language model processes the predefined prompt word templates and text fragments to generate a structured response and output it.
[0101] In one specific implementation, the system queries the matching records of pre-configured business tags with the corresponding large language model and prompt word template. In the matching records, based on the binding relationship between the business tags and the large language model and prompt word template, the system loads the corresponding large language model and the corresponding prompt word template, processes the text fragments using the prompt word template, generates a structured response, and outputs it.
[0102] Specifically, a prompt word template can be loaded through a large language model to process text fragments, provide responses, and output them to the user. Combining the previous steps, step 500 can pre-set different prompt word templates when the user's code organization and the business tags corresponding to the user's natural language questions are different. The "prompt word template" is a structured text framework containing fixed instruction segments (such as "You are a consulting assistant"), variable placeholders (such as "{original text}", "{applicable objects}", "{effective time}"), and output format constraints (such as requiring presentation in the form of "basis: ...; core conclusion: ...; operation guidance: ..."). This invention also includes calling external business systems to obtain supplementary data. The large language model generates a structured response based on the prompt word template, recall information, and supplementary data.
[0103] Figure 4 This is a schematic diagram of an electronic device according to an embodiment of the present invention.
[0104] like Figure 4 The illustrated electronic device 4 includes a general hardware architecture, comprising at least a processor 41 and a memory 42. The processor 41 and memory 42 are connected via a bus 43. The memory 42 is adapted to store instructions or programs executable by the processor 41. The processor 41 may be a standalone microprocessor or a collection of one or more microprocessors. Thus, the processor 41 executes the instructions stored in the memory 42 to perform the method flow of the embodiments of the present invention as described above, thereby realizing data processing and control of other devices. The bus 43 connects the aforementioned components together, and also connects these components to a display controller 44, a display device, and an input / output (I / O) device 45. The input / output (I / O) device 45 may be a mouse, keyboard, modem, network interface, touch input device, motion-sensing input device, printer, and other devices known in the art. Typically, the input / output device 45 is connected to the system via an input / output (I / O) controller 46.
[0105] Those skilled in the art will understand that embodiments of this application can provide methods, apparatus (devices), or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0106] This application is described with reference to flowchart illustrations of methods, apparatus (devices), and computer program products according to embodiments of this application. It should be understood that each step in the flowchart can be implemented by computer program instructions.
[0107] These computer program instructions may be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction means, the implementation process of which is described in the instruction means. Figure 1 The function specified in one or more processes.
[0108] These computer program instructions may also be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing device, produce instructions for implementing processes. Figure 1 A device for a function specified in one or more processes.
[0109] Some embodiments of the present invention relate to a non-volatile readable storage medium for storing a computer-readable program for use by a computer to perform embodiments of some or all of the methods described above.
[0110] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program specifying the relevant hardware. This program is stored in a readable storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the embodiments of this application. The aforementioned readable storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0111] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. For those skilled in the art, the present invention can be modified and varied in various ways. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method of searching a dynamic knowledge base, characterized by, The method comprises: receiving a login request of a user, extracting an organization code of the user from the login request; receiving a natural language question of the user, identifying the natural language question of the user through an intent recognition model to obtain a classification result of intent recognition, and matching a business label according to the classification result of intent recognition; dynamically selecting a target knowledge base in a knowledge base according to the organization code of the user and the business label matched by the natural language question of the user; converting the natural language question of the user into a vector form, performing vector similarity retrieval in the target knowledge base, and recalling a related text segment; inputting the text segment and a predefined prompt word template into a large language model to give an answer and output.
2. The method of claim 1, wherein, The dynamic selection of the target knowledge base in the knowledge base according to the organization code of the user and the business label matched by the natural language question of the user comprises: finding an initial knowledge base corresponding to the organization of the user in the knowledge base according to the organization code, and screening a target knowledge base related to the business label in the initial knowledge base according to the business label.
3. The method of claim 2, wherein, The dynamic selection of the target knowledge base in the knowledge base according to the organization code of the user and the business label matched by the natural language question of the user comprises: preconfiguring a permission association record, which associates and binds the organization code of the user with a knowledge base identifier and a business label set; in the permission association record, obtaining the initial knowledge base corresponding to the organization of the user according to the organization code of the user; screening the target knowledge base related to the business label in the initial knowledge base according to the business label.
4. The method of claim 1, wherein, Before executing the login request of the user, the method further comprises knowledge base pre-creation: creating a storage space; obtaining a multi-modal source file containing business specification content; performing content analysis and structure recognition on the multi-modal source file to obtain text content; adopting a combination of semantic segmentation and document structure segmentation to divide the text content into a plurality of semantically complete text segments; converting each text segment into a fixed-dimensional vector representation; storing the vector representation and its corresponding business metadata into a vector database to form a corresponding knowledge base, and assigning a unique knowledge base identifier to the knowledge base; uploading the knowledge base to the storage space, and the storage space has a storage space identifier.
5. The method of claim 1, wherein, The inputting of the text segment and the predefined prompt word template into the large language model to give an answer and output comprises: adopting a corresponding large language model according to the business label, and generating a structured answer and outputting after processing the predefined prompt word template and the text segment through the large language model.
6. The method of claim 1, wherein, The receiving of the login request of the user and the extraction of the organization code of the user from the login request comprise: receiving a login request of a user, performing legality verification on the identity of the user, extracting the organization code of the user from the login request of the user after the identity legality verification is passed, and the organization code contains a code segment uniquely associated with the administrative region to which the user belongs.
7. The method of claim 5, wherein, The large language model corresponding to the business label is adopted to generate a structured response through processing of the text segment according to the predefined prompt word template and output the structured response. Query a matching record of a preconfigured business label and a corresponding large language model and prompt word template. In the matching record, according to the binding relationship between the business label and the large language model and the prompt word template, the corresponding large language model and the corresponding prompt word template are loaded, the text segment is processed through the prompt word template to generate a structured response and output the structured response.
8. The method of claim 3, wherein, The preconfigured permission association record, the user's organization code, the knowledge base identifier and the business label set are associated and bound in the permission association record, and the storage space identifier corresponding to the knowledge base is also associated. The computer program instructions, when executed by the processor, implement the method of any one of claims 1-8.
9. A computer readable storage medium for storing computer program instructions, characterized in that, The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method of any one of claims 1-8.
10. An electronic device comprising a memory and a processor, characterized in that,
Citation Information
Patent Citations
Enterprise knowledge base query method based on large language model
CN119719345A
Vector database-based enterprise knowledge base permission implementation method and system
CN120429380A
Intelligent document question and answer method, device and equipment and storage medium
CN120706544A
Multi-knowledge-base scheduling routing method based on intention recognition and feedback optimization
CN120973866A
Method and system for extracting contextual information from a knowledge base
US20210182709A1