Question-answering method and device for professional field knowledge, electronic equipment and storage medium

CN121166728BActive Publication Date: 2026-10-09ZHEJIANG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511698622.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-10-09
Estimated Expiration
2045-11-19

AI Technical Summary

Technical Problem

但是,目前的智能问答方法的可靠性还有待提升,无法满足专业领域对智能问答系统的置信度的要求

Benefits of technology

[0013] In summary, this application provides a question-answering method, apparatus, electronic device, and storage medium for domain-specific knowledge. It involves acquiring a query instruction and a graph database of the specified domain; based on the graph database, using a specified large model, identifying keywords in the query instruction and determining whether at least one keyword exists in the graph database; if so, converting the query instruction into a query statement supported by the graph database; retrieving the graph database based on the query statement to obtain a structured query object, and converting the structured query object into the target query result of the query instruction; if not, generating a prompt word indicating that the query instruction cannot be answered. By combining the specified large model and the graph database, accurate question-answering from the query instruction to the target query result is achieved. When none of the keywords in the query instruction exist in the graph database, the specified large model generates a prompt word indicating that the answer cannot be given, ensuring the reliability and confidence of the target query result.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166728B_ABST
    Figure CN121166728B_ABST
Patent Text Reader

Abstract

The application provides a professional field knowledge question answering method and device, electronic equipment and storage medium, and relates to the field of artificial intelligence. A query instruction and a graph database of a specified field are obtained; based on the graph database, a specified large model is used to identify keywords in the query instruction and determine whether at least one keyword exists in the graph database; if yes, the query instruction is converted into a query statement supported by the graph database; based on the query statement, retrieval is performed in the graph database to obtain a structured query object, and the structured query object is converted into a target query result of the query instruction; if no, a prompt word indicating that the query instruction cannot be answered is generated. By combining the specified large model and the graph database, accurate question answering from the query instruction to the target query result is achieved. When all the keywords in the query instruction do not exist in the graph database, the specified large model generates a prompt word indicating that the query instruction cannot be answered, thereby ensuring the reliability and confidence of the target query result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, particularly question-answering methods, devices, electronic devices, and storage media for specialized domain knowledge. Background Technology

[0002] In professional fields such as healthcare, finance, and law, intelligent question-answering systems are core tools for improving service efficiency and decision-making quality. The question-answering needs in these fields are characterized by high specialization and low tolerance for error. For example, the healthcare field requires accurate matching of diseases and treatment plans; the financial field requires answering risk questions based on compliance rules; and the legal field requires providing consultation services strictly in accordance with legal provisions and precedents. However, the reliability of current intelligent question-answering methods still needs improvement and cannot meet the confidence requirements of these professional fields. Summary of the Invention

[0003] In view of this, this application provides a question-and-answer method for professional domain knowledge, the method comprising: Retrieve query commands and a pre-built graph database for a specified domain; Based on the graph database, a pre-trained specified large model is used to identify keywords in the query command and determine whether at least one of the keywords exists in the graph database. If so, the query instruction is converted into a query statement supported by the graph database; based on the query statement, a retrieval is performed in the graph database to obtain structured data objects, and the structured data objects are converted into the target query result of the query instruction; If not, a prompt word is generated to indicate that the query cannot be answered.

[0004] Optionally, before performing the retrieval in the graph database based on the query statement, the method further includes: Determine whether there exists a historical query statement in the historical query pair that is identical to the query statement; the historical query pair is used to store historical query statements and corresponding historical structured data objects; If it exists, the historical structured data object corresponding to the historical query statement will be used as the structured data object. If it does not exist, proceed to the step of retrieving data from the graph database based on the query statement.

[0005] Optionally, after performing a retrieval in the graph database based on the query statement, the method further includes: Determine if the search results are empty; If not, the result is taken as the structured data object, and the process proceeds to the step of converting the structured data object into the target query result of the query instruction. If so, proceed to the step of generating a prompt word to indicate that the query instruction cannot be answered.

[0006] Optionally, after determining whether the search result is empty, the method further includes: If the result is empty, determine whether there is information associated with each of the keywords in the specified professional knowledge base; If it exists, identify the first added object in the information and update the first added object to the graph database; If it does not exist, then obtain the second added object determined by the user based on the query instruction, and update the second added object to the graph database; The added object includes at least one of the entities, relationships, and attributes associated with the query instruction.

[0007] Optionally, the number of specified large models is multiple; the step of converting the query instruction into a query statement supported by the graph database through the specified large models includes: Obtain the initial query statements obtained by converting the query instructions in each of the specified large models; Determine the number of identical query statements in each of the initial query statements, and the maximum value among the stated numbers; When the maximum value is greater than the preset value, the initial query statement corresponding to the maximum value is used as the query statement.

[0008] Optionally, after determining the maximum value among the stated quantities, the method further includes: When the maximum value is not greater than the preset value, obtain the user-inputted verification query statement; The query instruction and the verification query statement are used to form a training sample; The training samples are used to fine-tune and train each of the specified large models.

[0009] Optionally, if at least one of the keywords does not exist in the graph database, the method further includes: Obtain the user-inputted validation query statement; The query instruction and the verification query statement are used to form a training sample; The specified large model is fine-tuned using the training samples.

[0010] This application also provides a question-and-answer device for professional domain knowledge, the device comprising: The acquisition module is used to obtain query commands and a pre-built graph database for a specified domain; The first judgment module is used to identify keywords in the query command based on the graph database and a pre-trained specified large model, and to determine whether at least one of the keywords exists in the graph database; if so, the result determination module is triggered; if not, the prompt word generation module is triggered. The result determination module is used to convert the query instruction into a query statement supported by the graph database; perform a retrieval in the graph database based on the query statement to obtain a structured data object, and convert the structured data object into the target query result of the query instruction; The prompt word generation module is used to generate prompt words indicating that the query command cannot be answered.

[0011] This application also provides an electronic device, including: Memory, used to store computer programs; A processor, used to implement the steps of the question-and-answer method for any of the aforementioned professional domains of knowledge when executing the computer program.

[0012] This application also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the question-and-answer method for any of the aforementioned professional domain knowledge.

[0013] In summary, this application provides a question-answering method, apparatus, electronic device, and storage medium for domain-specific knowledge. It involves acquiring a query instruction and a graph database of the specified domain; based on the graph database, using a specified large model, identifying keywords in the query instruction and determining whether at least one keyword exists in the graph database; if so, converting the query instruction into a query statement supported by the graph database; retrieving the graph database based on the query statement to obtain a structured query object, and converting the structured query object into the target query result of the query instruction; if not, generating a prompt word indicating that the query instruction cannot be answered. By combining the specified large model and the graph database, accurate question-answering from the query instruction to the target query result is achieved. When none of the keywords in the query instruction exist in the graph database, the specified large model generates a prompt word indicating that the answer cannot be given, ensuring the reliability and confidence of the target query result. Attached Figure Description

[0014] Figure 1 A first flowchart of a question-and-answer method for professional domain knowledge provided in this application; Figure 2 A second flowchart of a question-and-answer method for professional domain knowledge provided in this application; Figure 3 A third flowchart of a question-and-answer method for professional domain knowledge provided in this application; Figure 4A schematic diagram of the structure of a question-and-answer device for a specific field of knowledge provided in this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation

[0015] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0016] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0017] Please refer to Figure 1 , Figure 1 A first flowchart of a question-answering method for professional domain knowledge provided in this application, the method comprising: S101. Obtain the query command and the pre-built graph database for the specified domain.

[0018] The above query instructions can be text questions entered by the user in natural language, or they can be audio or images, etc. This application does not make any special restrictions on them.

[0019] The aforementioned instruction domains can be general domains containing common-sense knowledge, or specialized domains such as medicine, finance, and law. Obtaining a pre-built graph database of the specified domain facilitates the determination of the target query results corresponding to the query instructions based on the graph database, ensuring the professionalism of the target query results and improving question-answering efficiency.

[0020] S102. Based on the graph database, identify keywords in the query command using a pre-trained specified large model, and determine whether at least one keyword exists in the graph database; if yes, proceed to S103; if no, proceed to S104.

[0021] Different types of graph databases support different types of query statements. For example, Neo4j graph database supports Cypher type queries. To enable a specified large model to convert query instructions into queries supported by the graph database, it needs to be pre-trained to master the conversion logic from query instructions to queries. This can be done by training the specified large model using pre-labeled natural language questions and corresponding query statements. This application does not impose any special restrictions on the type of specified large model or the training process.

[0022] At the same time, the acquired graph database needs to be input into a pre-trained specified large model so that the specified large model can recognize the ontological structure of the graph database, understand the basic elements such as nodes, relationships and attributes in the graph database, and thus convert the query instructions into specific query statements.

[0023] It is important to emphasize that after the specified large model receives the query instruction, it first identifies the keywords in the query instruction and determines whether at least one keyword exists in the graph database. Keywords can be entities, relations, and attributes in the query instruction. Based on the determination result, the specified large model chooses whether to convert the query instruction into a query statement supported by the graph database. In other words, based on the determination result, it chooses whether to generate the target query result corresponding to the query instruction, that is, whether to answer the query instruction.

[0024] S103. Convert the query instruction into a query statement supported by the graph database; perform a retrieval in the graph database based on the query statement to obtain structured data objects, and convert the structured data objects into the target query result of the query instruction.

[0025] If at least one keyword in the query command exists in the graph database, the specified large model will convert the query command into a query statement supported by the graph database. As mentioned earlier, the pre-trained specified large model has mastered the conversion logic from query command to query statement and can convert query command into a specific query statement based on the graph database.

[0026] For example, a user might input the query "What are the side effects of aspirin?". The specified large model is based on a graph database in the medical field. The keyword "aspirin" corresponds to the "Drug" node in the graph database, and the keyword "side effects" corresponds to the "SideEffect" node. In the graph database, starting from the "Drug" node, a connection is made to the "SideEffect" node using the "HAS_SIDE_EFFECT" relationship. Since the query asks about the side effects, the name of the "SideEffect" node needs to be returned. Finally, the specified large model generates the query statement: "MATCH (d:Drug {name:'Aspirin'})-[:HAS_SIDE_EFFECT]->(se:SideEffect) RETURN se.name".

[0027] After obtaining the query statement, a search is performed in the graph database based on the query statement to retrieve structured data objects. Then, the structured data objects are transformed into the target query results corresponding to the query instructions. This application does not limit the specific process of transforming structured data objects into target query results. For example, a pre-trained general-purpose large language model can be used to generate target query results in natural language form by combining the query instructions and structured data objects.

[0028] Taking the query "What are the side effects of aspirin?" as an example, the structured data objects retrieved from the graph database are "gastrointestinal discomfort" and "increased bleeding risk". The final target query result returned is "The side effects of aspirin include gastrointestinal discomfort and increased bleeding risk".

[0029] As can be seen, this application only converts a query instruction into a query statement when at least one keyword exists in the graph database. Based on the structured data objects retrieved from the graph database using the query statement, it generates the target query results, ensuring the reliability of the target query results. Simultaneously, it fully utilizes a domain-specific graph database to guarantee the professionalism of the target query results and improve question-answering efficiency, possessing advantages such as strong interpretability and clear knowledge traceability.

[0030] Of course, in practical applications, for professional fields with extremely high confidence requirements, it can be determined whether all keywords in the query command exist in the graph database; if so, then the steps in this section, which convert the query command into a query statement supported by the graph database and generate the target query results based on the query statement, are executed; otherwise, a prompt word indicating that the query command cannot be answered is generated by a specified large model.

[0031] S104. Generate a prompt word to indicate that the query command cannot be answered.

[0032] When the query command does not contain keywords that exist in the graph database, the large model is specified to directly generate prompt words to indicate that the query command cannot be answered. This avoids generating incorrect answers when dealing with semantically complex, vaguely expressed, or unrelated queries to the current graph database, which would affect the reliability of the question answering.

[0033] Taking a graph database belonging to the medical field as an example, with the query "What is the market capitalization of Company A?", the specified large model extracts keywords from the query command including "Company A" and "market capitalization," and determines that neither of these keywords exists in the graph database. Based on this, the specified large model chooses to stop generating the target query answer for this query command to avoid inaccurate or even fabricated target query answers.

[0034] In summary, this application provides a question-answering method for domain-specific knowledge. The method involves: obtaining a query instruction and a graph database for the specified domain; identifying keywords in the query instruction based on the graph database and a specified large model, and determining whether at least one keyword exists in the graph database; if so, converting the query instruction into a query statement supported by the graph database; retrieving the graph database based on the query statement to obtain a structured query object, and converting the structured query object into the target query result of the query instruction; if not, generating a prompt indicating that the query instruction cannot be answered.

[0035] Leveraging the semantic understanding capabilities of a designated large model, keywords in query instructions are identified. Target query results are only generated when at least one keyword in the query instruction exists in the graph database, ensuring the reliability of the results. It also fully utilizes a domain-specific graph database, transforming user queries into queries against the database, guaranteeing the professionalism of the results and improving question-answering efficiency. It boasts advantages in strong interpretability and clear knowledge traceability. When no keyword in the query instruction exists in the graph database, the designated large model generates prompts indicating that the query cannot be answered, avoiding the generation of unfounded responses. It exhibits significant advantages in domain adaptability, support for dynamic knowledge updates, and high confidence levels.

[0036] Based on the above embodiments: As an optional embodiment, before performing a retrieval in the graph database based on the query statement, the method further includes: Determine if a historical query pair exists that is identical to the query statement; historical query pairs are used to store historical query statements and their corresponding historical structured data objects. If it exists, the historical structured data object corresponding to the historical query statement will be used as the structured data object. If it does not exist, proceed to the step of retrieving data from the graph database based on the query statement.

[0037] In this embodiment, a historical query pair is provided for storing historical query statements and their corresponding historical structured data objects. Please refer to... Figure 2 , Figure 2 The second flowchart of a question-and-answer method for professional domain knowledge provided in this application. Figure 2 As shown, after each structured data object is retrieved from the graph database, the structured data object is treated as a historical structured data object, the query statement corresponding to the structured data object is treated as a historical query statement, and then the historical query statement and the corresponding historical structured data object are stored in the historical query pair.

[0038] For example, if the query command in the previous text is "What are the side effects of aspirin?", the historical query statement would be: "MATCH(d:Drug {name: 'Aspirin'})-[:HAS_SIDE_EFFECT]->(se:SideEffect) RETURNse.name", and the corresponding historical structured data objects would be: "Gastrointestinal discomfort" and "Increased bleeding risk". This historical query statement and the historical structured data object are stored in the historical query pair.

[0039] Please refer to Figure 2 , Figure 2 This application provides a second flowchart for a question-answering method for domain-specific knowledge. Based on this, after converting the query instruction into a query statement, the system first searches for historical query statements identical to the current query statement in the historical query pairs. If a matching historical query statement is found, the corresponding historical structured data object is directly used as the structured data object for the current query statement, and subsequent steps for generating the target query result are performed, thereby improving query efficiency and question-answering efficiency. If no matching historical query statement is found, structured data objects are further retrieved from the graph database.

[0040] In summary, this embodiment optimizes the retrieval efficiency of structured data objects by using historical query pairs, avoids performance bottlenecks caused by frequent retrieval of graph databases, and ensures question-answering efficiency even in high-concurrency scenarios.

[0041] As an optional embodiment, after performing a retrieval in the graph database based on the query statement, the method further includes: Determine if the search results are empty; If not, the result is treated as a structured data object, and the process proceeds to the step of converting the structured data object into the target query result of the query instruction. If so, proceed to S104.

[0042] Given that knowledge within a specific domain is dynamically added and updated, knowledge gaps may occur in graph databases. When the content in the graph database cannot cover the user's query, the results retrieved from the graph database using the query statement may be empty.

[0043] Please refer to Figure 3 , Figure 3 This is a third flowchart of a question-answering method for professional domain knowledge provided in this application. In this embodiment, after retrieving data from a graph database based on a query statement, it first determines whether the search results are empty. If the results are empty, it guides a specified large model to generate prompts indicating that the query instruction cannot be answered, rather than returning unreliable answers to the target query, thus avoiding the possibility of fabricated information. If the results are not empty, the retrieved results are treated as structured data objects, and the process proceeds to the step of converting the structured data objects into the target query results of the query instruction, thus answering the query instruction normally.

[0044] In this embodiment, it is determined whether the result obtained by searching the graph database using the query statement is empty, thereby further avoiding the fabrication of facts and preventing the generation of unfounded answers.

[0045] As an optional embodiment, after determining whether the search result is empty, the method further includes: If the result is empty, determine whether there is information related to each keyword in the specified professional knowledge base; If it exists, identify the first added object in the information and update the graph database with the first added object; If it does not exist, then retrieve the second added object determined by the user based on the query command, and update the graph database with the second added object; The added object includes at least one of the entities, relationships, and attributes associated with the query command.

[0046] As mentioned earlier, knowledge within a specific domain is dynamically added and updated, thus requiring an increase in the knowledge coverage of the graph database. Therefore, this embodiment iteratively updates the graph database and gradually expands its knowledge coverage when the query retrieves no results from the graph database, indicating a knowledge gap.

[0047] Specifically, the process first determines whether information related to each keyword exists in the specified professional knowledge base. These keywords are the keywords in the query command, including entities, relationships, and attributes. If they exist, it is assumed that the specified professional knowledge base can supplement the missing knowledge in the graph database. Therefore, the first addable object is identified from the above information. The first addable object can include at least one of the entities, relationships, and attributes in the information, and can be selected according to actual needs. Since all first addable objects are related to the keywords in the query command, they are added as knowledge supplements and updated in the graph database.

[0048] Building upon this, when the designated professional knowledge base also fails to cover the knowledge related to the query instruction, a second supplementary object is obtained based on the user's query instruction. For example, if the user is an expert in a specific field, the expert determines a second supplementary object related to the query instruction based on their professional knowledge, so that this second supplementary object can be added to the graph database as knowledge supplementation. The second supplementary object includes at least one of the entities, relationships, and attributes associated with the query instruction, which can be specifically set by the domain expert based on their professional knowledge and experience.

[0049] This embodiment does not specifically limit the process of updating the graph database with added objects. For example, the entities contained in the added object are created in the graph database; based on the relationships in the added object, new relationships are added between the entities in the graph database that are involved in those relationships; based on the attributes in the added object, new attributes are added under the entities in the graph database that are involved in those relationships.

[0050] In summary, this embodiment combines the knowledge of a designated professional knowledge base and domain experts to update the graph database in a targeted manner, thereby increasing the knowledge coverage of the graph database and improving the probability of successfully answering query commands.

[0051] As an optional implementation, the number of large models is specified as multiple; by specifying large models, query instructions are converted into query statements supported by the graph database, including: Obtain the initial query statements obtained after converting the query instructions for each specified large model; Determine the number of identical query statements in each initial query statement, and the maximum value among these numbers; When the maximum value is greater than the preset value, the initial query statement corresponding to the maximum value will be used as the query statement.

[0052] Considering that a query statement is a standardized statement, when the query instruction is the same, the initial query statements obtained after transforming the query instruction using multiple specified large models should maintain a high degree of consistency. Therefore, in this embodiment, the final query statement is determined based on the consistency of the initial query statements generated by each specified large model.

[0053] Specifically, after obtaining each initial query statement, the number of identical query statements in each initial query statement is determined, along with the maximum value among these numbers. For semantically complex query instructions, some specified large models may generate the same first type of initial query statement, while others may generate a second type of initial query statement. However, as long as the maximum number of identical query statements is greater than a preset value, the initial query statement corresponding to the maximum value can be used as the query statement, thus ensuring the accuracy of the query statement.

[0054] Of course, for domains with high confidence requirements, the initial query statement can be used as the query statement when all the initial query statements output by all specified large models are the same, that is, when the maximum value among all the quantities is equal to the quantity of the specified large model.

[0055] As an optional implementation, when the maximum value is greater than a preset value, the query command and query statement are used to form a training sample; the target large model is then fine-tuned using the training sample. The target large model is a specified large model whose generated initial query statement is inconsistent with the actual query statement.

[0056] If the maximum value is greater than the preset value, for each target model whose initial query statement is inconsistent with the query statement, the target model is fine-tuned using training samples composed of query instructions and query statements to improve the conversion performance of the target model and ensure that it can more accurately convert query instructions into query statements in the future.

[0057] As an optional embodiment, after determining the maximum value among the quantities, the method further includes: When the maximum value is not greater than the preset value, obtain the validation query statement input by the user; The query commands and validation query statements are combined to form training samples; Fine-tuning training is performed on each specified large model using training samples.

[0058] If the maximum value is not greater than the preset value, none of the initial query statements generated by the specified large models meet the requirements, and the conversion performance of each specified large model fails to meet the requirements. Therefore, the validation query statement determined by the user based on the query instruction is obtained, and the query instruction and validation query statement are used to form a training sample. This sample is then used to fine-tune and train all specified large models to improve their conversion performance, ensuring that they can more accurately convert query instructions into query statements in the future, thereby guaranteeing the reliability of question answering.

[0059] As an optional embodiment, if at least one keyword does not exist in the graph database, the method further includes: Obtain the user-inputted validation query statement; The query commands and validation query statements are combined to form training samples; Fine-tuning of a specified large model is performed using training samples.

[0060] Please refer to Figure 2 , Figure 2 This is a second flowchart of a question-answering method for professional domain knowledge provided in this application. When all keywords in a query instruction do not exist in the graph database, the query instruction is recorded, and the corresponding validation query statement is determined through manual annotation. After obtaining the validation query statement, the query instruction and the validation query statement are used to form a training sample. This sample is then fine-tuned on a specified large model to further improve its conversion performance, ensuring that it can accurately convert more query instructions into query statements and increasing the probability of successfully answering query instructions.

[0061] Please refer to Figure 4 , Figure 4 A schematic diagram of a question-and-answer device for professional domain knowledge provided in this application, the device comprising: The acquisition module 401 is used to acquire query instructions and a pre-built graph database for a specified domain; The first judgment module 402 is used to identify keywords in the query command based on the graph database and a pre-trained specified large model, and to determine whether at least one keyword exists in the graph database; if so, the result determination module 403 is triggered; if not, the prompt word generation module 404 is triggered. The result determination module 403 is used to convert the query instruction into a query statement supported by the graph database; to perform a retrieval in the graph database based on the query statement to obtain structured data objects, and to convert the structured data objects into the target query result of the query instruction; The prompt word generation module 404 is used to generate prompt words to indicate that a query command cannot be answered.

[0062] For a detailed description of the question-and-answer device for professional domain knowledge provided in this application, please refer to the embodiments of the question-and-answer method for professional domain knowledge described above, which will not be repeated here.

[0063] As an optional embodiment, the device further includes: The second judgment module is used to determine whether there is a historical query statement that is the same as the query statement in the historical query pair before performing a retrieval in the graph database based on the query statement; the historical query pair is used to store the historical query statement and the corresponding historical structured data object; if it exists, the first object determination module is triggered; if it does not exist, the step of performing a retrieval in the graph database based on the query statement is entered. The first object determination module is used to treat the historical structured data objects corresponding to historical query statements as structured data objects.

[0064] As an optional embodiment, the device further includes: The third judgment module is used to determine whether the search result is empty after performing a search in the graph database based on the query statement; if not, the second object determination module is triggered; if so, the prompt word generation module 404 is triggered. The second object determination module is used to treat the result as a structured data object and proceed to the step of converting the structured data object into the target query result of the query instruction.

[0065] As an optional embodiment, the device further includes: The fourth judgment module is used to determine whether the search results are empty. If the results are empty, it determines whether there is information related to each keyword in the specified professional knowledge base. If there is information, the first addition module is triggered; if there is no information, the second addition module is triggered. The first addition module is used to identify the first addition object in the information and update the first addition object to the graph database; The second addition module is used to obtain the second addition object determined by the user based on the query command, and update the second addition object to the graph database; The added object includes at least one of the entities, relationships, and attributes associated with the query command.

[0066] As an optional embodiment, the number of large models is specified as multiple; the result determination module 403 includes: The initial query statement acquisition module is used to acquire the initial query statements obtained by converting the query instructions in each specified large model. The quantity determination module is used to determine the number of identical query statements in each initial query statement, as well as the maximum value among the quantities; The query statement determination module is used to determine the initial query statement corresponding to the maximum value as the query statement when the maximum value is greater than the preset value. The result determination submodule is used to retrieve structured data objects from the graph database based on the query statement, and then transform the structured data objects into the target query results of the query instructions.

[0067] As an optional embodiment, the device further includes: The first verification statement acquisition module is used to acquire the user-input verification query statement after determining the maximum value among the various quantities, provided that the maximum value is not greater than a preset value. The first sample composition module is used to compose training samples from query commands and validation query statements. The first training module is used to fine-tune the training of each specified large model using training samples.

[0068] As an optional embodiment, the device further includes: The second verification statement acquisition module is used to acquire the user-input verification query statement when at least one keyword does not exist in the graph database. The second sample composition module is used to compose training samples from query instructions and validation query statements. The second training module is used to fine-tune the training of a specified large model using training samples.

[0069] Please refer to Figure 5 , Figure 5 This application provides a schematic diagram of the structure of an electronic device, which includes: Memory 501 is used to store computer programs; Processor 502 is used to implement the steps of the question-and-answer method for any of the above-mentioned professional fields of knowledge when executing a computer program.

[0070] For a detailed description of the electronic device provided in this application, please refer to the embodiments of the question-and-answer method in the above-mentioned professional field knowledge; this application will not repeat the details here.

[0071] This application also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the question-and-answer method for any of the aforementioned professional domain knowledge.

[0072] The aforementioned storage media include all forms of non-volatile memory, media, and memory devices, such as semiconductor memory devices (e.g., EPROM, EEPROM, and flash memory devices), magnetic disks (e.g., internal hard disks or removable disks), magneto-optical disks, and CD-ROMs and DVD-ROMs. Processors and memory may be supplemented by or incorporated into dedicated logic circuitry.

[0073] For a detailed description of the storage medium provided in this application, please refer to the embodiments of the question-and-answer method in the above-mentioned professional field knowledge; this application will not repeat the details here.

[0074] While this specification contains numerous specific implementation details, these should not be construed as limiting the scope of any invention or the scope of the claims, but rather are primarily intended to describe features of specific embodiments of a particular invention. Certain features described in the various embodiments herein may also be implemented in combination in a single embodiment. Conversely, various features described in a single embodiment may also be implemented separately in various embodiments or in any suitable sub-combination. Furthermore, while features may function in certain combinations as described above and even initially claimed in this way, one or more features from a claimed combination may be removed from that combination in some cases, and a claimed combination may refer to a sub-combination or a variation thereof.

[0075] Similarly, although the operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.

Claims

1. A question-and-answer method for professional domain knowledge, characterized in that, The method includes: Retrieve query commands and a pre-built graph database for a specified domain; Based on the graph database, a pre-trained specified large model is used to identify keywords in the query command and determine whether at least one of the keywords exists in the graph database. If so, the query instruction is converted into a query statement supported by the graph database; based on the query statement, a retrieval is performed in the graph database to obtain structured data objects, and the structured data objects are converted into the target query result of the query instruction; If not, then generate a prompt word to indicate that the query cannot be answered; Before performing the retrieval in the graph database based on the query statement, the method further includes: Determine whether there exists a historical query statement in the historical query pair that is identical to the query statement; the historical query pair is used to store historical query statements and corresponding historical structured data objects; If it exists, the historical structured data object corresponding to the historical query statement will be used as the structured data object. If it does not exist, proceed to the step of searching the graph database based on the query statement; The number of specified large models is multiple; the process of converting the query instruction into a query statement supported by the graph database using the specified large models includes: Obtain the initial query statements obtained by converting the query instructions in each of the specified large models; Determine the number of identical query statements in each of the initial query statements, and the maximum value among the stated numbers; When the maximum value is greater than the preset value, the initial query statement corresponding to the maximum value is taken as the query statement; and the query instruction and the query statement are combined to form a training sample; the training sample is used to fine-tune the target large model; the target large model is a specified large model whose generated initial query statement is inconsistent with the query statement.

2. The question-and-answer method for professional domain knowledge as described in claim 1, characterized in that, After the retrieval is performed in the graph database based on the query statement, the method further includes: Determine if the search results are empty; If not, the result is taken as the structured data object, and the process proceeds to the step of converting the structured data object into the target query result of the query instruction. If so, proceed to the step of generating a prompt word to indicate that the query instruction cannot be answered.

3. The question-and-answer method for professional domain knowledge as described in claim 2, characterized in that, After determining whether the search result is empty, the method further includes: If the result is empty, determine whether there is information associated with each of the keywords in the specified professional knowledge base; If it exists, identify the first added object in the information and update the first added object to the graph database; If it does not exist, then obtain the second added object determined by the user based on the query instruction, and update the second added object to the graph database; The added object includes at least one of the entities, relationships, and attributes associated with the query instruction.

4. The question-and-answer method for professional domain knowledge as described in claim 1, characterized in that, After determining the maximum value among the aforementioned quantities, the method further includes: When the maximum value is not greater than the preset value, obtain the user-inputted verification query statement; The query instruction and the verification query statement are used to form a training sample; The training samples are used to fine-tune and train each of the specified large models.

5. The question-and-answer method for professional domain knowledge as described in claim 1, characterized in that, If at least one of the keywords does not exist in the graph database, the method further includes: Get the user-inputted validation query statement; The query instruction and the verification query statement are used to form a training sample; The specified large model is fine-tuned using the training samples.

6. A question-and-answer device for a professional field of knowledge, characterized in that, The device includes: The acquisition module is used to obtain query commands and a pre-built graph database for a specified domain; The first judgment module is used to identify keywords in the query command based on the graph database and a pre-trained specified large model, and to determine whether at least one of the keywords exists in the graph database; if so, the result determination module is triggered; if not, the prompt word generation module is triggered. The result determination module is used to convert the query instruction into a query statement supported by the graph database; perform a retrieval in the graph database based on the query statement to obtain a structured data object, and convert the structured data object into the target query result of the query instruction; The prompt word generation module is used to generate prompt words indicating that the query command cannot be answered; The second judgment module is used to determine whether there is a historical query statement that is the same as the query statement in the historical query pair before performing a retrieval in the graph database based on the query statement; the historical query pair is used to store the historical query statement and the corresponding historical structured data object; if it exists, the first object determination module is triggered; if it does not exist, the step of performing a retrieval in the graph database based on the query statement is entered. The first object determination module is used to treat the historical structured data objects corresponding to the historical query statements as structured data objects. The number of large models is specified as multiple; the result determination module includes: The initial query statement acquisition module is used to acquire the initial query statements obtained by converting the query instructions in each specified large model. The quantity determination module is used to determine the number of identical query statements in each initial query statement, as well as the maximum value among the quantities; The query statement determination module is used to determine the initial query statement corresponding to the maximum value as the query statement when the maximum value is greater than the preset value. The result determination submodule is used to retrieve structured data objects from the graph database based on the query statement, and to transform the structured data objects into the target query results of the query command. The device is also used to form a training sample from the query instruction and the query statement when the maximum value is greater than a preset value; to fine-tune the target large model using the training sample; the target large model is a specified large model that is inconsistent with the generated initial query statement.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the question-and-answer method for domain-specific knowledge as described in any one of claims 1 to 5 when executing the computer program.

8. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps of the question-and-answer method for professional domain knowledge as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Knowledge graph fusion large language model retrieval generation method and system oriented to psychological medicine field

    CN118427359A

  • Data analysis method based on atlas and large model and ChatBI system

    CN119622055A