LLM-based database query instruction processing method and system

Through the LLM-based database query instruction processing method, query text is directly identified from the user's voice data and generated query tasks, solving the problem of insufficient data query efficiency and accuracy in the prior art, and achieving a more efficient and convenient data query process.

CN119760058AActive Publication Date: 2025-04-04GUANGZHOU ZHISUAN INFORMATION TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411635709.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-04-04
Estimated Expiration
2044-11-15

AI Technical Summary

Technical Problem

The prior art cannot effectively convert the user's language query instructions directly into database query instructions, resulting in the lack of efficiency and convenience of data query, and the accuracy of query results depends on the user's query instruction construction capabilities.

Method used

The database query instruction processing method based on LLM is adopted to obtain the user's voice data, identify the data query text, determine the data query task based on the LLM algorithm model, and send the task to the automatic query agent to perform to obtain the query results.

Benefits of technology

It realizes more accurately and efficiently performing data query tasks directly based on the user's voice, improving the efficiency and convenience of data query, and reducing data query costs and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760058A_ABST
    Figure CN119760058A_ABST
Patent Text Reader

Abstract

The invention discloses an LLM-based database query instruction processing method and system. The method comprises the steps of obtaining voice data of a target user; recognizing a data query text from the voice data according to a preset voice recognition screening algorithm; based on an LLM algorithm model, determining a corresponding data query task according to the data query text; and sending the data query task to a corresponding automatic query agent to execute and obtain a data query result, and returning the data query result to the target user. Therefore, the data query task can be executed more accurately, efficiently and directly according to the voice of the user, the data query efficiency and convenience are improved, and the data query cost and errors are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method and system for processing database query instructions based on LLM. Background Art

[0002] With the increasing demand for big data computing and the widespread improvement of data processing capabilities, data storage and query are being used more and more widely in various fields. How to achieve more efficient and accurate data query has become an important technical issue. The prior art proposes standard database query instructions to achieve database data query acquisition, but this technology still cannot achieve direct conversion and application of user language query instructions. Therefore, the convenience and efficiency of data query are still lacking. The accuracy of the query results still depends on the user's ability to construct data query instructions and cannot be fully guaranteed. It can be seen that the prior art has defects that need to be solved urgently. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a database query instruction processing method and system based on LLM, which can more accurately and efficiently execute data query tasks directly according to the user's voice, improve the efficiency and convenience of data query, and reduce data query costs and errors.

[0004] In order to solve the above technical problems, the first aspect of the present invention discloses a database query instruction processing method based on LLM, the method comprising: Obtain the target user's voice data; According to a preset speech recognition screening algorithm, identifying a data query text from the speech data; Based on the LLM algorithm model, determine the corresponding data query task according to the data query text; The data query task is sent to the corresponding automatic query agent to execute and obtain the data query result, and the data query result is returned to the target user.

[0005] As an optional implementation, in the first aspect of the present invention, identifying the data query text from the voice data according to a preset voice recognition screening algorithm includes: Determine the speech text corresponding to the speech data based on a speech recognition algorithm; Matching the voice text based on a preset query keyword library to obtain multiple matching results; According to the texts separated by the plurality of matching results, a data query text is determined from the speech text.

[0006] As an optional implementation, in the first aspect of the present invention, determining the data query text from the speech text according to the texts separated by the plurality of matching results comprises: For any two matching results whose positions are adjacent in the speech text, obtaining the interval text between the two matching results whose positions are adjacent in the speech text; According to a preset keyword coherence rule, determining whether the two matching results belong to a coherent keyword combination, and obtaining a first judgment result; When the first judgment result is yes, determining the interval text as a candidate query text; All the candidate query texts are combined to obtain a data query text.

[0007] As an optional implementation manner, in the first aspect of the present invention, combining all the candidate query texts to obtain the data query text comprises: For any two candidate query texts that are adjacent in position in the speech text, calculating the text similarity between the two candidate query texts; Determine whether the text similarity is greater than a preset first similarity threshold, and obtain a second determination result; When the second judgment result is yes, determining any of the candidate query texts as a target query text segment; When the second judgment result is no, judging whether the text similarity is less than a preset second similarity threshold, and obtaining a third judgment result; the second similarity threshold is less than the first similarity threshold; When the third judgment result is yes, combining the two candidate query texts in order to obtain a target query text segment; When the third judgment result is no, determining any of the candidate query texts as a target query text segment; All the target query text segments are concatenated and combined according to the order of their positions in the voice text to obtain a data query text.

[0008] As an optional implementation, in the first aspect of the present invention, the determining the corresponding data query task according to the data query text based on the LLM algorithm model includes: Based on the preset prompt word engineering rules, generating prompt words including the data query text; Input the prompt word into the trained LLM algorithm model to obtain multiple possible data query instructions as output; According to the multiple possible data query instructions, a corresponding data query task is generated.

[0009] As an optional implementation, in the first aspect of the present invention, generating corresponding data query tasks according to the multiple possible data query instructions includes: For any of the possible data query instructions, calculate an average value of instruction similarities between the possible data query instruction and each of the other possible data query instructions to obtain a first instruction similarity parameter corresponding to the possible data query instruction; Determine all the possible data query instructions whose first instruction similarity parameters are greater than a preset first parameter threshold as candidate data query instructions; For any of the candidate data query instructions, calculate the average value of the instruction similarity between the candidate data query instruction and each of the other candidate data query instructions to obtain a second instruction similarity parameter corresponding to the candidate data query instruction; Determine the candidate data query instructions whose second instruction similarity parameters are greater than a preset second parameter threshold as target data query instructions Generate a data query task corresponding to each of the target data query instructions.

[0010] As an optional implementation, in the first aspect of the present invention, sending the data query task to the corresponding automatic query agent to execute and obtain the data query result includes: For each of the data query tasks, determining a task parameter corresponding to the data query task; Calculate the task similarity between the historical task parameters in the historical query task record corresponding to each candidate query agent and the task parameters; Determine the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task; Send each of the data query tasks to the corresponding target query agent, and receive the task query results returned by each of the target query agents; The intersection of the task query results returned by all the target query agents is calculated to obtain the data query result.

[0011] As an optional embodiment, in the first aspect of the present invention, the method further comprises: Determine all the candidate data query instructions whose second instruction similarity parameters are less than the second parameter threshold as potential data query instructions; Input each of the potential data query instructions into the LLM algorithm model to obtain a corresponding potential task description; Each of the potential task descriptions is returned to the target user for display, and a selection instruction of the target user for any of the potential task descriptions is received, so as to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.

[0012] A second aspect of an embodiment of the present invention discloses a database query instruction processing system based on LLM, the system comprising: An acquisition module is used to acquire the voice data of the target user; A recognition module, used to recognize data query text from the voice data according to a preset voice recognition screening algorithm; A determination module, used to determine a corresponding data query task according to the data query text based on the LLM algorithm model; The sending module is used to send the data query task to the corresponding automatic query agent to execute and obtain the data query result, and return the data query result to the target user.

[0013] As an optional implementation, in the second aspect of the present invention, the specific manner in which the recognition module recognizes the data query text from the voice data according to a preset voice recognition screening algorithm includes: Determine the speech text corresponding to the speech data based on a speech recognition algorithm; Matching the voice text based on a preset query keyword library to obtain multiple matching results; According to the texts separated by the plurality of matching results, a data query text is determined from the speech text.

[0014] As an optional implementation, in the second aspect of the present invention, the recognition module determines the specific manner of the data query text from the speech text according to the texts separated by the plurality of matching results, including: For any two matching results whose positions are adjacent in the speech text, obtaining the interval text between the two matching results whose positions are adjacent in the speech text; According to a preset keyword coherence rule, determining whether the two matching results belong to a coherent keyword combination, and obtaining a first judgment result; When the first judgment result is yes, determining the interval text as a candidate query text; All the candidate query texts are combined to obtain a data query text.

[0015] As an optional implementation, in the second aspect of the present invention, the specific manner in which the recognition module combines all the candidate query texts to obtain the data query text includes: For any two candidate query texts that are adjacent in position in the speech text, calculating the text similarity between the two candidate query texts; Determine whether the text similarity is greater than a preset first similarity threshold, and obtain a second determination result; When the second judgment result is yes, determining any of the candidate query texts as a target query text segment; When the second judgment result is no, judging whether the text similarity is less than a preset second similarity threshold, and obtaining a third judgment result; the second similarity threshold is less than the first similarity threshold; When the third judgment result is yes, combining the two candidate query texts in order to obtain a target query text segment; When the third judgment result is no, determining any of the candidate query texts as a target query text segment; All the target query text segments are concatenated and combined according to the order of their positions in the voice text to obtain a data query text.

[0016] As an optional implementation, in the second aspect of the present invention, the determination module determines the specific manner of the corresponding data query task according to the data query text based on the LLM algorithm model, including: Based on the preset prompt word engineering rules, generating prompt words including the data query text; Input the prompt word into the trained LLM algorithm model to obtain multiple possible data query instructions as output; According to the multiple possible data query instructions, a corresponding data query task is generated.

[0017] As an optional implementation, in the second aspect of the present invention, the specific manner in which the determination module generates the corresponding data query task according to the multiple possible data query instructions includes: For any of the possible data query instructions, calculate an average value of instruction similarities between the possible data query instruction and each of the other possible data query instructions to obtain a first instruction similarity parameter corresponding to the possible data query instruction; Determine all the possible data query instructions whose first instruction similarity parameters are greater than a preset first parameter threshold as candidate data query instructions; For any of the candidate data query instructions, calculate the average value of the instruction similarity between the candidate data query instruction and each of the other candidate data query instructions to obtain a second instruction similarity parameter corresponding to the candidate data query instruction; Determine the candidate data query instructions whose second instruction similarity parameters are greater than a preset second parameter threshold as target data query instructions Generate a data query task corresponding to each of the target data query instructions.

[0018] As an optional implementation, in the second aspect of the present invention, the specific manner in which the sending module sends the data query task to the corresponding automatic query agent to execute and obtain the data query result includes: For each of the data query tasks, determining a task parameter corresponding to the data query task; Calculate the task similarity between the historical task parameters in the historical query task record corresponding to each candidate query agent and the task parameters; Determine the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task; Send each of the data query tasks to the corresponding target query agent, and receive the task query results returned by each of the target query agents; The intersection of the task query results returned by all the target query agents is calculated to obtain the data query result.

[0019] As an optional embodiment, in the second aspect of the present invention, the system is further configured to perform the following steps: Determine all the candidate data query instructions whose second instruction similarity parameters are less than the second parameter threshold as potential data query instructions; Input each of the potential data query instructions into the LLM algorithm model to obtain a corresponding potential task description; Each of the potential task descriptions is returned to the target user for display, and a selection instruction of the target user for any of the potential task descriptions is received, so as to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.

[0020] The third aspect of the present invention discloses another database query instruction processing system based on LLM, the system comprising: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute part or all of the steps in the LLM-based database query instruction processing method disclosed in the first aspect of the present invention.

[0021] The fourth aspect of the present invention discloses a computer storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute some or all of the steps in the LLM-based database query instruction processing method disclosed in the first aspect of the present invention.

[0022] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: The present invention can identify data query text from the user's voice data according to a preset voice recognition screening algorithm, and then determine the corresponding data query task to the corresponding automatic query agent based on the LLM algorithm to execute and obtain the data query result, thereby being able to more accurately and efficiently execute the data query task directly according to the user's voice, improve the efficiency and convenience of data query, and reduce data query costs and errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 It is a flowchart of a method for processing database query instructions based on LLM disclosed in an embodiment of the present invention.

[0025] Figure 2 It is a structural diagram of a database query instruction processing system based on LLM disclosed in an embodiment of the present invention.

[0026] Figure 3 It is a structural diagram of another LLM-based database query instruction processing system disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] The terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or equipment.

[0029] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0030] The present invention discloses a database query instruction processing method and system based on LLM, which can identify data query text from user's voice data according to a preset voice recognition screening algorithm, and then determine the corresponding data query task to the corresponding automatic query intelligent agent based on the LLM algorithm to execute and obtain data query results, so that data query tasks can be executed directly according to the user's voice more accurately and efficiently, improve the efficiency and convenience of data query, and reduce data query costs and errors. The following are detailed descriptions.

[0031] Embodiment 1 See also Figure 1 , Figure 1 : is a flowchart of a method for processing a database query instruction based on LLM disclosed in an embodiment of the present invention. Figure 1 The described LLM-based database query instruction processing method can be applied to a data processing system / data processing device / data processing server (wherein the server includes a local processing server or a cloud processing server). Figure 1 As shown, the LLM-based database query instruction processing method may include the following operations: 101. Acquire voice data of a target user.

[0032] 102. According to a preset voice recognition screening algorithm, data query text is identified from the voice data. 103. Based on the LLM algorithm model, determine the corresponding data query task according to the data query text. 104. Send the data query task to the corresponding automatic query agent to execute and obtain the data query result, and return the data query result to the target user.

[0033] It can be seen that the above-mentioned embodiments of the invention can identify data query text from the user's voice data according to the preset voice recognition screening algorithm, and then determine the corresponding data query task to the corresponding automatic query agent based on the LLM algorithm to execute and obtain the data query results, thereby being able to more accurately and efficiently execute data query tasks directly according to the user's voice, improve the efficiency and convenience of data query, and reduce data query costs and errors.

[0034] As an optional embodiment, in the above step, according to a preset speech recognition screening algorithm, identifying the data query text from the speech data includes: Based on the speech recognition algorithm, determine the speech text corresponding to the speech data; Matching the voice text based on a preset query keyword library to obtain multiple matching results; According to the texts separated by a plurality of matching results, a data query text is determined from the speech text.

[0035] It can be seen that through the above-mentioned optional embodiments, it is possible to determine the voice text based on voice recognition, and then obtain the data query text based on keyword matching, to achieve accurate data query text recognition, so as to facilitate the subsequent determination of data query tasks, and assist in more accurately and efficiently executing data query tasks directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0036] As an optional embodiment, in the above step, determining the data query text from the speech text according to the texts separated by the plurality of matching results includes: For any two matching results whose positions are adjacent in the speech text, obtain the interval text between the positions of the two matching results in the speech text; According to a preset keyword coherence rule, determining whether the two matching results belong to a coherent keyword combination, and obtaining a first judgment result; When the first judgment result is yes, determining the interval text as a candidate query text; All candidate query texts are combined to obtain the data query text.

[0037] It can be seen that through the above-mentioned optional embodiments, continuous matching results can be matched for coherence to obtain the interval text between keywords with coherent word order, and combined to obtain accurate data query text, so as to facilitate the subsequent determination of data query tasks, and assist in more accurately and efficiently executing data query tasks directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0038] As an optional embodiment, in the above step, combining all candidate query texts to obtain a data query text includes: For any two candidate query texts that are adjacent in position in the speech text, calculating the text similarity between the two candidate query texts; Determine whether the text similarity is greater than a preset first similarity threshold, and obtain a second determination result; When the second judgment result is yes, determining any candidate query text as a target query text segment; When the second judgment result is no, determine whether the text similarity is less than a preset second similarity threshold to obtain a third judgment result; optionally, the second similarity threshold is less than the first similarity threshold; When the third judgment result is yes, the two candidate query texts are combined in order to obtain a target query text segment; When the third judgment result is no, determining any candidate query text as a target query text segment; All target query text fragments are concatenated and combined according to the order of their positions in the voice text to obtain the data query text.

[0039] It can be seen that through the above-mentioned optional embodiments, the similarities between consecutive candidate query texts can be calculated and threshold judged to combine to obtain a data query text with greater information content, more accuracy and brevity, so as to facilitate the subsequent determination of data query tasks, and assist in more accurately and efficiently executing data query tasks directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0040] As an optional embodiment, in the above steps, based on the LLM algorithm model, determining the corresponding data query task according to the data query text includes: Based on the preset prompt word engineering rules, generate prompt words including data query text; Input the prompt word into the trained LLM algorithm model to obtain multiple possible data query instructions as output; According to multiple possible data query instructions, corresponding data query tasks are generated.

[0041] It can be seen that through the above-mentioned optional embodiments, after the prompt words corresponding to the data query text are generated according to the prompt word engineering, the possible data query instructions can be determined according to the trained LLM algorithm model to accurately determine the data query task, and assist in more accurately and efficiently executing the data query task directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0042] As an optional embodiment, in the above steps, generating corresponding data query tasks according to multiple possible data query instructions includes: For any possible data query instruction, calculate an average value of instruction similarities between the possible data query instruction and each other possible data query instruction to obtain a first instruction similarity parameter corresponding to the possible data query instruction; Determine all possible data query instructions whose first instruction similarity parameters are greater than a preset first parameter threshold as candidate data query instructions; For any candidate data query instruction, calculate the average value of the instruction similarity between the candidate data query instruction and each other candidate data query instruction to obtain a second instruction similarity parameter corresponding to the candidate data query instruction; Determine all candidate data query instructions whose second instruction similarity parameters are greater than a preset second parameter threshold as target data query instructions Generate a data query task corresponding to each target data query instruction.

[0043] It can be seen that through the above-mentioned optional embodiments, it is possible to calculate the similarities between multiple possible data query instructions and perform double screening to obtain a closer target data query instruction, so as to accurately determine the data query task, and assist in more accurately and efficiently executing the data query task directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0044] As an optional embodiment, in the above steps, sending the data query task to the corresponding automatic query agent to execute and obtain the data query result includes: For each data query task, determine the task parameters corresponding to the data query task; Calculate the task similarity between the historical task parameters and the task parameters in the historical query task records corresponding to each candidate query agent; The candidate query agent with the highest task similarity is determined as the target query agent corresponding to the data query task; Send each data query task to the corresponding target query agent, and receive the task query results returned by each target query agent; Calculate the intersection of the task query results returned by all target query agents to obtain the data query results.

[0045] It can be seen that through the above-mentioned optional embodiments, it is possible to determine an appropriate query agent for each query task based on the similarity of task parameters, and to calculate the union of the query results of multiple agents to obtain accurate query results, thereby achieving more accurate and efficient execution of data query tasks directly based on the user's voice, improving the efficiency and convenience of data query, and reducing data query costs and errors.

[0046] As an optional embodiment, in the above steps, the method further includes: Determine all candidate data query instructions whose second instruction similarity parameters are less than a second parameter threshold as potential data query instructions; Input each potential data query instruction into the LLM algorithm model to obtain the corresponding potential task description; Each potential task description is returned to the target user for display, and a selection instruction of the target user for any potential task description is received, so as to determine the potential data query instruction corresponding to the potential task description as the target data query instruction.

[0047] It can be seen that through the above optional embodiments, the instructions with similarity parameters centered can be used as potential instructions, and the task description can be determined through the LLM model and returned as a recommended task for users to choose from, so as to explore the user's potential needs, improve the efficiency and convenience of data query, and reduce data query costs and errors.

[0048] Embodiment 2 See also Figure 2 , Figure 2 : is a schematic diagram of a database query instruction processing system based on LLM disclosed in an embodiment of the present invention. Figure 2 The described database query instruction processing system based on LLM can be applied to a data processing system / data processing device / data processing server (wherein the server includes a local processing server or a cloud processing server). Figure 2 As shown, the LLM-based database query instruction processing system may include: The acquisition module 201 is used to acquire the voice data of the target user.

[0049] The recognition module 202 is used to recognize data query text from the voice data according to a preset voice recognition screening algorithm. The determination module 203 is used to determine the corresponding data query task according to the data query text based on the LLM algorithm model. The sending module 204 is used to send the data query task to the corresponding automatic query agent to execute and obtain the data query result, and return the data query result to the target user.

[0050] It can be seen that the above-mentioned embodiments of the invention can identify data query text from the user's voice data according to the preset voice recognition screening algorithm, and then determine the corresponding data query task to the corresponding automatic query agent based on the LLM algorithm to execute and obtain the data query results, thereby being able to more accurately and efficiently execute data query tasks directly according to the user's voice, improve the efficiency and convenience of data query, and reduce data query costs and errors.

[0051] As an optional embodiment, the recognition module recognizes the specific manner of the data query text from the voice data according to the preset voice recognition screening algorithm, including: Based on the speech recognition algorithm, determine the speech text corresponding to the speech data; Matching the voice text based on a preset query keyword library to obtain multiple matching results; According to the texts separated by a plurality of matching results, a data query text is determined from the speech text.

[0052] It can be seen that through the above-mentioned optional embodiments, it is possible to determine the voice text based on voice recognition, and then obtain the data query text based on keyword matching, to achieve accurate data query text recognition, so as to facilitate the subsequent determination of data query tasks, and assist in more accurately and efficiently executing data query tasks directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0053] As an optional embodiment, the recognition module determines the specific manner of the data query text from the speech text according to the texts separated by the plurality of matching results, including: For any two matching results whose positions are adjacent in the speech text, obtain the interval text between the positions of the two matching results in the speech text; According to a preset keyword coherence rule, determining whether the two matching results belong to a coherent keyword combination, and obtaining a first judgment result; When the first judgment result is yes, determining the interval text as a candidate query text; All candidate query texts are combined to obtain the data query text.

[0054] It can be seen that through the above-mentioned optional embodiments, continuous matching results can be matched for coherence to obtain the interval text between keywords with coherent word order, and combined to obtain accurate data query text, so as to facilitate the subsequent determination of data query tasks, and assist in more accurately and efficiently executing data query tasks directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0055] As an optional embodiment, the specific manner in which the recognition module combines all candidate query texts to obtain the data query text includes: For any two candidate query texts that are adjacent in position in the speech text, calculating the text similarity between the two candidate query texts; Determine whether the text similarity is greater than a preset first similarity threshold, and obtain a second determination result; When the second judgment result is yes, determining any candidate query text as a target query text segment; When the second judgment result is no, determine whether the text similarity is less than a preset second similarity threshold to obtain a third judgment result; optionally, the second similarity threshold is less than the first similarity threshold; When the third judgment result is yes, the two candidate query texts are combined in order to obtain a target query text segment; When the third judgment result is no, determining any candidate query text as a target query text segment; All target query text fragments are concatenated and combined according to the order of their positions in the voice text to obtain the data query text.

[0056] It can be seen that through the above-mentioned optional embodiments, the similarities between consecutive candidate query texts can be calculated and threshold judged to combine to obtain a data query text with greater information content, more accuracy and brevity, so as to facilitate the subsequent determination of data query tasks, and assist in more accurately and efficiently executing data query tasks directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0057] As an optional embodiment, the determination module determines the specific manner of the corresponding data query task based on the LLM algorithm model and the data query text, including: Based on the preset prompt word engineering rules, generate prompt words including data query text; Input the prompt word into the trained LLM algorithm model to obtain multiple possible data query instructions as output; According to multiple possible data query instructions, corresponding data query tasks are generated.

[0058] It can be seen that through the above-mentioned optional embodiments, after the prompt words corresponding to the data query text are generated according to the prompt word engineering, the possible data query instructions can be determined according to the trained LLM algorithm model to accurately determine the data query task, and assist in more accurately and efficiently executing the data query task directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0059] As an optional embodiment, the specific manner in which the determination module generates a corresponding data query task according to multiple possible data query instructions includes: For any possible data query instruction, calculate an average value of instruction similarities between the possible data query instruction and each other possible data query instruction to obtain a first instruction similarity parameter corresponding to the possible data query instruction; Determine all possible data query instructions whose first instruction similarity parameters are greater than a preset first parameter threshold as candidate data query instructions; For any candidate data query instruction, calculate the average value of the instruction similarity between the candidate data query instruction and each other candidate data query instruction to obtain a second instruction similarity parameter corresponding to the candidate data query instruction; Determine all candidate data query instructions whose second instruction similarity parameters are greater than a preset second parameter threshold as target data query instructions Generate a data query task corresponding to each target data query instruction.

[0060] It can be seen that through the above-mentioned optional embodiments, it is possible to calculate the similarities between multiple possible data query instructions and perform double screening to obtain a closer target data query instruction, so as to accurately determine the data query task, and assist in more accurately and efficiently executing the data query task directly according to the user's voice, thereby improving the efficiency and convenience of data query and reducing data query costs and errors.

[0061] As an optional embodiment, the specific manner in which the sending module sends the data query task to the corresponding automatic query agent to execute and obtain the data query result includes: For each data query task, determine the task parameters corresponding to the data query task; Calculate the task similarity between the historical task parameters and the task parameters in the historical query task records corresponding to each candidate query agent; The candidate query agent with the highest task similarity is determined as the target query agent corresponding to the data query task; Send each data query task to the corresponding target query agent, and receive the task query results returned by each target query agent; Calculate the intersection of the task query results returned by all target query agents to obtain the data query results.

[0062] It can be seen that through the above-mentioned optional embodiments, it is possible to determine an appropriate query agent for each query task based on the similarity of task parameters, and to calculate the union of the query results of multiple agents to obtain accurate query results, thereby achieving more accurate and efficient execution of data query tasks directly based on the user's voice, improving the efficiency and convenience of data query, and reducing data query costs and errors.

[0063] As an optional embodiment, the system is further configured to perform the following steps: Determine all candidate data query instructions whose second instruction similarity parameters are less than a second parameter threshold as potential data query instructions; Input each potential data query instruction into the LLM algorithm model to obtain the corresponding potential task description; Each potential task description is returned to the target user for display, and a selection instruction of the target user for any potential task description is received, so as to determine the potential data query instruction corresponding to the potential task description as the target data query instruction.

[0064] It can be seen that through the above optional embodiments, the instructions with similarity parameters centered can be used as potential instructions, and the task description can be determined through the LLM model and returned as a recommended task for users to choose from, so as to explore the user's potential needs, improve the efficiency and convenience of data query, and reduce data query costs and errors.

[0065] Embodiment 3 See also Figure 3 , Figure 3 It is another LLM-based database query instruction processing system disclosed in an embodiment of the present invention. Figure 3 The described database query instruction processing system based on LLM is applied to a data processing system / data processing device / data processing server (wherein the server includes a local processing server or a cloud processing server). Figure 3 As shown, the LLM-based database query instruction processing system may include: A memory 301 storing executable program codes; a processor 302 coupled to the memory 301; The processor 302 calls the executable program code stored in the memory 301 to execute the steps of the LLM-based database query instruction processing method described in the first embodiment.

[0066] Embodiment 4 An embodiment of the present invention discloses a computer-readable storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to execute the steps of the LLM-based database query instruction processing method described in the first embodiment.

[0067] Embodiment 5 An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute the steps of the LLM-based database query instruction processing method described in the first embodiment.

[0068] The above describes specific embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0069] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0070] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0071] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may be in the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of this specification may be in the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0072] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0073] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0074] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0075] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0076] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0077] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0078] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0079] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0080] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0081] Finally, it should be noted that the LLM-based database query instruction processing method and system disclosed in the embodiment of the present invention only discloses the preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions recorded in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for processing database query instructions based on LLM, characterized in that: The method comprises: Obtain the target user's voice data; According to a preset speech recognition screening algorithm, identifying a data query text from the speech data; Based on the LLM algorithm model, determine the corresponding data query task according to the data query text; The data query task is sent to the corresponding automatic query agent to execute and obtain the data query result, and the data query result is returned to the target user.

2. The method for processing database query instructions based on LLM according to claim 1, characterized in that: The step of identifying the data query text from the voice data according to a preset voice recognition screening algorithm includes: Determine the speech text corresponding to the speech data based on a speech recognition algorithm; Matching the voice text based on a preset query keyword library to obtain multiple matching results; According to the texts separated by the plurality of matching results, a data query text is determined from the speech text.

3. The method for processing database query instructions based on LLM according to claim 2, characterized in that: The step of determining the data query text from the speech text according to the texts separated by the plurality of matching results comprises: For any two matching results whose positions are adjacent in the speech text, obtaining the interval text between the two matching results whose positions are adjacent in the speech text; According to a preset keyword coherence rule, determining whether the two matching results belong to a coherent keyword combination, and obtaining a first judgment result; When the first judgment result is yes, determining the interval text as a candidate query text; All the candidate query texts are combined to obtain a data query text.

4. The method for processing database query instructions based on LLM according to claim 3, characterized in that: The step of combining all the candidate query texts to obtain the data query text comprises: For any two candidate query texts that are adjacent in position in the speech text, calculating the text similarity between the two candidate query texts; Determine whether the text similarity is greater than a preset first similarity threshold, and obtain a second determination result; When the second judgment result is yes, determining any of the candidate query texts as a target query text segment; When the second judgment result is no, judging whether the text similarity is less than a preset second similarity threshold, and obtaining a third judgment result; the second similarity threshold is less than the first similarity threshold; When the third judgment result is yes, combining the two candidate query texts in order to obtain a target query text segment; When the third judgment result is no, determining any of the candidate query texts as a target query text segment; All the target query text segments are concatenated and combined according to the order of their positions in the voice text to obtain a data query text.

5. The method for processing database query instructions based on LLM according to claim 1, characterized in that: The method of determining a corresponding data query task based on the data query text based on the LLM algorithm model includes: Based on the preset prompt word engineering rules, generating prompt words including the data query text; Input the prompt word into the trained LLM algorithm model to obtain multiple possible data query instructions as output; According to the multiple possible data query instructions, a corresponding data query task is generated.

6. The method for processing database query instructions based on LLM according to claim 5, characterized in that: Generating corresponding data query tasks according to the multiple possible data query instructions includes: For any of the possible data query instructions, calculate an average value of instruction similarities between the possible data query instruction and each of the other possible data query instructions to obtain a first instruction similarity parameter corresponding to the possible data query instruction; Determine all the possible data query instructions whose first instruction similarity parameters are greater than a preset first parameter threshold as candidate data query instructions; For any of the candidate data query instructions, calculate the average value of the instruction similarity between the candidate data query instruction and each of the other candidate data query instructions to obtain a second instruction similarity parameter corresponding to the candidate data query instruction; Determine the candidate data query instructions whose second instruction similarity parameters are greater than a preset second parameter threshold as target data query instructions Generate a data query task corresponding to each of the target data query instructions.

7. The method for processing database query instructions based on LLM according to claim 6, characterized in that: The step of sending the data query task to a corresponding automatic query agent to execute and obtain the data query result includes: For each of the data query tasks, determining a task parameter corresponding to the data query task; Calculate the task similarity between the historical task parameters in the historical query task record corresponding to each candidate query agent and the task parameters; Determine the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task; Send each of the data query tasks to the corresponding target query agent, and receive the task query results returned by each of the target query agents; The intersection of the task query results returned by all the target query agents is calculated to obtain the data query result.

8. The method for processing database query instructions based on LLM according to claim 6, characterized in that: The method further comprises: Determine all the candidate data query instructions whose second instruction similarity parameters are less than the second parameter threshold as potential data query instructions; Input each of the potential data query instructions into the LLM algorithm model to obtain a corresponding potential task description; Each of the potential task descriptions is returned to the target user for display, and a selection instruction of the target user for any of the potential task descriptions is received, so as to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.

9. A database query instruction processing system based on LLM, characterized in that: The system comprises: An acquisition module is used to acquire the voice data of the target user; A recognition module, used to recognize data query text from the voice data according to a preset voice recognition screening algorithm; A determination module, used to determine a corresponding data query task according to the data query text based on the LLM algorithm model; The sending module is used to send the data query task to the corresponding automatic query agent to execute and obtain the data query result, and return the data query result to the target user.

10. A database query instruction processing system based on LLM, characterized in that: The system comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the LLM-based database query instruction processing method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Speech recognition system training method and device, speech recognition system recognition method and device and electronic equipment

    CN112885336A

  • Query request response method and device

    CN115114424A

  • Method and device for generating SQL (Structured Query Language) query instruction

    CN117493367A

  • Data query method and device, electronic equipment and storage medium

    CN117667973A

  • Data query method and device, electronic equipment and storage medium

    CN118035280A