Database query instruction processing method and system based on LLM
By processing user voice data through speech recognition and LLM algorithms, the system identifies and executes data query tasks, solving the problem of inconvenient conversion of user language query commands in existing technologies and achieving efficient and accurate data query.
Patent Information
- Application Number
- CN202411635709.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-11-15
AI Technical Summary
Existing technologies cannot effectively realize the direct conversion and application of user language query commands, resulting in a lack of convenience and efficiency in data querying. The accuracy of query results depends on the user's ability to construct data query commands.
By acquiring the user's voice data, using a preset voice recognition filtering algorithm and LLM algorithm model, the system identifies the data query text and determines the corresponding data query task, which is then sent to the automatic query agent for execution to obtain the results.
It enables efficient and accurate execution of data query tasks based on user voice, improving the convenience and efficiency of queries, and reducing query costs and errors.
Smart Images

Figure CN119760058B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a database query instruction processing method and system based on LLM. BACKGROUND
[0002] With the improvement of big data computing demand and the wide improvement of data processing capability, data storage and query are more and more widely applied in various fields, and how to realize more efficient and accurate data query becomes an important technical problem. The prior art proposes a standard database query instruction to realize the data query and acquisition of the database, but this technology still cannot realize the direct conversion and application of the language query instruction of the user, so the convenience and efficiency of the data query are still lacking, and the accuracy of the query result still depends on the construction ability of the data query instruction of the user and cannot be completely guaranteed. It can be seen that the prior art has defects and needs to be solved. SUMMARY
[0003] The technical problem to be solved by the present application is to provide a database query instruction processing method and system based on LLM, which can more accurately and efficiently directly execute a data query task according to the voice of a user, improve the efficiency and convenience of data query, and reduce the data query cost and errors.
[0004] In order to solve the above technical problems, the first aspect of the present application discloses a database query instruction processing method based on LLM, which comprises:
[0005] acquiring voice data of a target user;
[0006] identifying a data query text from the voice data according to a preset voice recognition screening algorithm;
[0007] determining a corresponding data query task according to the data query text based on an LLM algorithm model;
[0008] sending the data query task to a corresponding automatic query intelligent agent to execute and obtain a data query result, and returning the data query result to the target user.
[0009] As an optional implementation manner, in the first aspect of the present application, the data query text is identified from the voice data according to the preset voice recognition screening algorithm, which comprises:
[0010] determining a voice text corresponding to the voice data based on a voice recognition algorithm;
[0011] matching the voice text based on a preset query keyword library to obtain a plurality of matching results;
[0012] According to the interval texts of the multiple matching results, the data query text is determined from the voice text.
[0013] As an optional implementation, in the first aspect of the present application, the determining of the data query text from the voice text according to the interval texts of the multiple matching results comprises:
[0014] For any two of the matching results adjacent in position in the voice text, the interval text between the two matching results in the voice text is obtained;
[0015] According to a preset keyword coherence rule, it is determined whether the two matching results belong to a coherent keyword combination, and a first determination result is obtained;
[0016] When the first determination result is yes, the interval text is determined as a candidate query text;
[0017] All the candidate query texts are combined to obtain a data query text.
[0018] As an optional implementation, in the first aspect of the present application, the combining of all the candidate query texts to obtain a data query text comprises:
[0019] For any two of the candidate query texts adjacent in position in the voice text, a text similarity between the two candidate query texts is calculated;
[0020] It is determined whether the text similarity is greater than a preset first similarity threshold, and a second determination result is obtained;
[0021] When the second determination result is yes, any of the candidate query texts is determined as a target query text segment;
[0022] When the second determination result is no, it is determined whether the text similarity is less than a preset second similarity threshold, and a third determination result is obtained; the second similarity threshold is less than the first similarity threshold;
[0023] When the third determination result is yes, the two candidate query texts are combined according to the order to obtain a target query text segment;
[0024] When the third determination result is no, any of the candidate query texts is determined as a target query text segment;
[0025] All the target query text segments are spliced and combined according to the order of positions in the voice text to obtain a data query text.
[0026] As an optional implementation, in the first aspect of the present invention, the step of determining the corresponding data query task based on the data query text according to the LLM algorithm model includes:
[0027] Based on preset prompt word engineering rules, prompt words including the data query text are generated;
[0028] The prompt words are input into the trained LLM algorithm model to obtain multiple possible data query instructions.
[0029] Based on the multiple possible data query instructions, a corresponding data query task is generated.
[0030] As an optional implementation, in the first aspect of the present invention, generating a corresponding data query task based on the plurality of possible data query instructions includes:
[0031] For any of the possible data query instructions, calculate the average value of the instruction similarity between the possible data query instruction and each other possible data query instruction to obtain the first instruction similarity parameter corresponding to the possible data query instruction;
[0032] All possible data query instructions whose first instruction similarity parameter is greater than a preset first parameter threshold are identified as candidate data query instructions.
[0033] 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 the second instruction similarity parameter corresponding to the candidate data query instruction;
[0034] All candidate data query instructions whose second instruction similarity parameter is greater than a preset second parameter threshold are identified as target data query instructions;
[0035] Generate a data query task corresponding to each of the target data query instructions.
[0036] As an optional implementation, in the first aspect of the present invention, sending the data query task to a corresponding automatic query agent for execution and obtaining the data query result includes:
[0037] For each data query task, determine the task parameters corresponding to that data query task;
[0038] 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;
[0039] determine the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task;
[0040] send each data query task to the corresponding target query agent, and receive the task query result returned by each target query agent;
[0041] calculate the intersection of the task query results returned by all target query agents to obtain a data query result.
[0042] As an optional implementation, in the first aspect of the present application, the method further comprises:
[0043] determine the candidate data query instruction with a second instruction similarity parameter less than the second parameter threshold as a potential data query instruction;
[0044] input each potential data query instruction into the LLM algorithm model to obtain a corresponding potential task description;
[0045] return each potential task description to the target user for display, and receive a selection instruction of the target user on any potential task description to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.
[0046] The second aspect of the embodiment of the present application discloses a database query instruction processing system based on LLM, which comprises:
[0047] an acquisition module configured to acquire voice data of a target user;
[0048] an identification module configured to identify a data query text from the voice data according to a preset voice recognition screening algorithm;
[0049] a determination module configured to determine a corresponding data query task based on an LLM algorithm model according to the data query text;
[0050] a sending module configured to send the data query task to a corresponding automatic query agent for execution and obtain a data query result, and return the data query result to the target user.
[0051] As an optional implementation, in the second aspect of the present application, the specific manner in which the identification module identifies a data query text from the voice data according to a preset voice recognition screening algorithm comprises:
[0052] determine a voice text corresponding to the voice data based on a voice recognition algorithm;
[0053] matching the voice text based on a preset query keyword library to obtain a plurality of matching results;
[0054] determining data query text from the voice text according to interval text between the plurality of matching results.
[0055] As an optional implementation, in the second aspect, the specific manner in which the identifying module determines data query text from the voice text according to interval text between the plurality of matching results includes:
[0056] for any two matching results adjacent in position in the voice text, obtaining interval text between the two matching results in position in the voice text;
[0057] determining whether the two matching results belong to a coherent keyword combination according to a preset keyword coherence rule to obtain a first determination result;
[0058] when the first determination result is yes, determining the interval text as candidate query text;
[0059] combining all the candidate query text to obtain data query text.
[0060] As an optional implementation, in the second aspect, the specific manner in which the identifying module combines all the candidate query text to obtain data query text includes:
[0061] for any two candidate query texts adjacent in position in the voice text, calculating text similarity between the two candidate query texts;
[0062] determining whether the text similarity is greater than a preset first similarity threshold to obtain a second determination result;
[0063] when the second determination result is yes, determining any candidate query text as target query text segment;
[0064] when the second determination result is no, determining whether the text similarity is less than a preset second similarity threshold to obtain a third determination result; the second similarity threshold is less than the first similarity threshold;
[0065] when the third determination result is yes, combining the two candidate query texts in order to obtain target query text segment;
[0066] when the third determination result is no, determining any candidate query text as target query text segment;
[0067] Splice and combine all the target query text segments according to the position sequence in the voice text to obtain a data query text.
[0068] As an optional implementation, in the second aspect of the present application, the specific manner in which the determining module determines the corresponding data query task according to the data query text based on the LLM algorithm model comprises:
[0069] Generate a prompt word comprising the data query text based on a preset prompt word engineering rule;
[0070] Input the prompt word into the trained LLM algorithm model to obtain a plurality of possible data query instructions as output;
[0071] Generate a corresponding data query task according to the plurality of possible data query instructions.
[0072] As an optional implementation, in the second aspect of the present application, the specific manner in which the determining module generates a corresponding data query task according to the plurality of possible data query instructions comprises:
[0073] For any possible data query instruction, calculate the average value of the instruction similarity 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;
[0074] 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;
[0075] 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;
[0076] Determine the candidate data query instruction whose second instruction similarity parameter is greater than a preset second parameter threshold as a target data query instruction;
[0077] Generate a data query task corresponding to each target data query instruction.
[0078] As an optional implementation, in the second aspect of the present application, the specific manner in which the sending module sends the data query task to a corresponding automatic query intelligent agent for execution and obtains a data query result comprises:
[0079] For each data query task, determine a task parameter corresponding to the data query task;
[0080] calculate a task similarity between the historical task parameter in the historical query task record corresponding to each candidate query agent and the task parameter;
[0081] determine the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task;
[0082] send each data query task to the corresponding target query agent, and receive the task query result returned by each target query agent;
[0083] calculate the intersection of the task query results returned by all target query agents to obtain a data query result.
[0084] As an optional implementation, in the second aspect of the present application, the system is further configured to perform the following steps:
[0085] determine the candidate data query instruction with a second instruction similarity parameter less than the second parameter threshold as a potential data query instruction;
[0086] input each potential data query instruction into the LLM algorithm model to obtain a corresponding potential task description;
[0087] return each potential task description to the target user for display, and receive a selection instruction of the target user on any potential task description to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.
[0088] A third aspect of the present application discloses another LLM-based database query instruction processing system, which comprises:
[0089] a memory storing executable program codes;
[0090] a processor coupled with the memory;
[0091] The processor invokes the executable program codes stored in the memory to perform part or all of the steps of the LLM-based database query instruction processing method disclosed in the first aspect of the present application.
[0092] A fourth aspect of the present application discloses a computer storage medium storing computer instructions, which, when invoked, are configured to perform part or all of the steps of the LLM-based database query instruction processing method disclosed in the first aspect of the present application.
[0093] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0094] The application can identify data query text from the voice data of the user according to the preset voice recognition screening algorithm, determine the corresponding data query task to the corresponding automatic query intelligent agent based on the LLM algorithm to execute and obtain the data query result, thereby being able to more accurately and efficiently directly execute the data query task according to the voice of the user, improving the efficiency and convenience of data query, and reducing the data query cost and errors. BRIEF DESCRIPTION OF DRAWINGS
[0095] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0096] Figure 1 is a flow diagram of a database query instruction processing method based on LLM disclosed by an embodiment of the present application.
[0097] Figure 2 is a structural diagram of a database query instruction processing system based on LLM disclosed by an embodiment of the present application.
[0098] Figure 3 is a structural diagram of another database query instruction processing system based on LLM disclosed by an embodiment of the present application. DETAILED DESCRIPTION
[0099] In order to make the person skilled in the art better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0100] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, not to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or equipment.
[0101] Reference to“an embodiment” herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase“in an embodiment” in various places in the specification are not necessarily referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. As will be apparent to those of ordinary skill in the art, embodiments described herein can be combined with other embodiments.
[0102] The application discloses a database query instruction processing method and system based on LLM, which can identify data query text from the voice data of a user according to a preset voice recognition screening algorithm, determine a corresponding data query task based on an LLM algorithm, send the data query task to a corresponding automatic query agent to execute and obtain a data query result, so as to more accurately and efficiently directly execute a data query task according to the voice of the user, improve the efficiency and convenience of data query, and reduce data query cost and errors. The following will be described in detail.
[0103] Embodiment one
[0104] Please refer to Figure 1 , Figure 1 is a flowchart of a database query instruction processing method based on LLM disclosed by an embodiment of the application. Among them, Figure 1 The database query instruction processing method based on LLM described above 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). As Figure 1 shown, the database query instruction processing method based on LLM can include the following operations:
[0105] 101, obtaining voice data of a target user.
[0106] 102, identifying data query text from the voice data according to a preset voice recognition screening algorithm.
[0107] 103, determining a corresponding data query task according to the data query text based on an LLM algorithm model.
[0108] 104, 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.
[0109] It can be seen that the above embodiments of the application can identify data query text from the voice data of the user according to the preset voice recognition screening algorithm, and determine the corresponding data query task to the corresponding automatic query intelligent agent based on the LLM algorithm to execute and obtain the data query result, so that the data query task can be directly executed according to the voice of the user more accurately and efficiently, the efficiency and convenience of data query are improved, and the data query cost and error are reduced.
[0110] As an optional embodiment, in the above step, the data query text is identified from the voice data according to the preset voice recognition screening algorithm, comprising:
[0111] Based on the voice recognition algorithm, the voice text corresponding to the voice data is determined;
[0112] Based on the preset query keyword library, the voice text is matched to obtain a plurality of matching results;
[0113] According to the text interval between the plurality of matching results, the data query text is determined from the voice text.
[0114] It can be seen that through the above optional embodiment, the voice text can be determined based on voice recognition, and the data query text can be obtained based on keyword matching to realize accurate data query text recognition, so as to determine the data query task subsequently, and assist in realizing more accurate and efficient direct execution of the data query task according to the voice of the user, improving the efficiency and convenience of data query, and reducing the data query cost and error.
[0115] As an optional embodiment, in the above step, the data query text is determined from the voice text according to the text interval between the plurality of matching results, comprising:
[0116] For any two matching results adjacent in position in the voice text, the interval text between the positions of the two matching results in the voice text is obtained;
[0117] According to the preset keyword continuity rule, it is determined whether the two matching results belong to a continuous keyword combination to obtain a first determination result;
[0118] When the first determination result is yes, the interval text is determined as a candidate query text;
[0119] All candidate query texts are combined to obtain the data query text.
[0120] It can be seen that through the above optional embodiments, the consecutive matching results can be matched in sequence to obtain the interval text between the keywords in sequence, and the accurate data query text is combined to facilitate subsequent determination of the data query task, and to assist in more accurately and efficiently directly executing the data query task according to the user's voice, improving the efficiency and convenience of data query, and reducing data query cost and errors.
[0121] As an optional embodiment, in the above step, the combining of all candidate query texts to obtain the data query text comprises:
[0122] For any two candidate query texts adjacent in position in the voice text, the text similarity between the two candidate query texts is calculated;
[0123] It is judged whether the text similarity is greater than a preset first similarity threshold to obtain a second judgment result;
[0124] When the second judgment result is yes, any candidate query text is determined as the target query text segment;
[0125] When the second judgment result is no, it is judged 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;
[0126] When the third judgment result is yes, the two candidate query texts are combined in order to obtain the target query text segment;
[0127] When the third judgment result is no, any candidate query text is determined as the target query text segment;
[0128] All target query text segments are spliced and combined in order according to the position in the voice text to obtain the data query text.
[0129] It can be seen that through the above optional embodiments, the similarity between the consecutive candidate query texts can be calculated and threshold judged to obtain a data query text with more information and more accurate and short, so as to facilitate subsequent determination of the data query task, and to assist in more accurately and efficiently directly executing the data query task according to the user's voice, improving the efficiency and convenience of data query, and reducing data query cost and errors.
[0130] As an optional embodiment, in the above step, the corresponding data query task is determined according to the data query text based on the LLM algorithm model, comprising:
[0131] The prompt word including the data query text is generated based on a preset prompt word engineering rule;
[0132] inputting the prompt word into the trained LLM algorithm model to obtain a plurality of possible data query instructions as output;
[0133] generating a corresponding data query task according to the plurality of possible data query instructions.
[0134] It can be seen that through the above optional embodiments, after the prompt word corresponding to the data query text is generated according to the prompt word, the possible data query instructions are determined according to the trained LLM algorithm model to accurately determine the data query task, which assists in more accurately and efficiently directly executing the data query task according to the user's voice, improves the efficiency and convenience of data query, and reduces the cost and error of data query.
[0135] As an optional embodiment, in the above step, generating a corresponding data query task according to the plurality of possible data query instructions comprises:
[0136] For any possible data query instruction, the average value of the instruction similarity between the possible data query instruction and each other possible data query instruction is calculated to obtain a first instruction similarity parameter corresponding to the possible data query instruction;
[0137] All possible data query instructions with a first instruction similarity parameter greater than a preset first parameter threshold are determined as candidate data query instructions;
[0138] For any candidate data query instruction, the average value of the instruction similarity between the candidate data query instruction and each other candidate data query instruction is calculated to obtain a second instruction similarity parameter corresponding to the candidate data query instruction;
[0139] The candidate data query instruction with a second instruction similarity parameter greater than a preset second parameter threshold is determined as a target data query instruction;
[0140] Generating a data query task corresponding to each target data query instruction.
[0141] It can be seen that through the above optional embodiments, the similarity between a plurality of possible data query instructions is calculated and double-screened to obtain a more close target data query instruction to accurately determine the data query task, which assists in more accurately and efficiently directly executing the data query task according to the user's voice, improves the efficiency and convenience of data query, and reduces the cost and error of data query.
[0142] As an optional embodiment, in the above step, sending the data query task to the corresponding automatic query intelligent agent to execute and obtain a data query result comprises:
[0143] For each data query task, determining a task parameter corresponding to the data query task;
[0144] calculating a task similarity between the historical task parameters in the historical query task record corresponding to each candidate query agent and the task parameters;
[0145] determining the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task;
[0146] sending each data query task to the corresponding target query agent and receiving the task query result returned by each target query agent;
[0147] calculating the intersection of the task query results returned by all target query agents to obtain the data query result.
[0148] As can be seen, through the above optional embodiments, the appropriate query agent can be determined for each query task based on the similarity of the task parameters, the query results of multiple agents are calculated in union to obtain accurate query results, more accurate and efficient data query tasks are directly performed according to the user's voice, the efficiency and convenience of data query are improved, and the data query cost and errors are reduced.
[0149] As an optional embodiment, the method in the above step further comprises:
[0150] determining all candidate data query instructions with a second instruction similarity parameter less than a second parameter threshold as potential data query instructions;
[0151] inputting each potential data query instruction into an LLM algorithm model to obtain a corresponding potential task description;
[0152] returning each potential task description to the target user for display, and receiving a selection instruction of the target user on any potential task description to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.
[0153] As can be seen, through the above optional embodiments, the instruction with a similarity parameter in the middle is used as a potential instruction, the task description is determined through the LLM model and returned as a recommended task for the user to select, the user's potential needs are mined, the efficiency and convenience of data query are improved, and the data query cost and errors are reduced.
[0154] Embodiment Two
[0155] Please refer to Figure 2 , Figure 2 is a structural schematic diagram of a database query instruction processing system based on LLM disclosed by the embodiments of the present application. Among them, Figure 2The described LLM-based database query instruction processing system can be applied in a data processing system / data processing device / data processing server (wherein the server includes a local processing server or a cloud processing server). As shown in Figure 2 The LLM-based database query instruction processing system can include:
[0156] The acquisition module 201 is configured to acquire voice data of a target user.
[0157] The recognition module 202 is configured to recognize data query text from the voice data according to a preset voice recognition screening algorithm.
[0158] The determination module 203 is configured to determine a corresponding data query task according to the data query text based on an LLM algorithm model.
[0159] The sending module 204 is configured to send the data query task to a corresponding automatic query agent to execute and obtain a data query result, and return the data query result to the target user.
[0160] As can be seen, the above embodiments can recognize data query text from voice data of a user according to a preset voice recognition screening algorithm, and then determine a corresponding data query task to a corresponding automatic query agent based on an LLM algorithm to execute and obtain a data query result, so as to more accurately and efficiently directly execute a data query task according to voice of the user, improve efficiency and convenience of data query, and reduce data query cost and errors.
[0161] As an optional embodiment, the specific manner in which the recognition module recognizes data query text from voice data according to a preset voice recognition screening algorithm includes:
[0162] Based on the voice recognition algorithm, the voice data corresponding voice text is determined;
[0163] Based on the preset query keyword library, the voice text is matched to obtain a plurality of matching results;
[0164] According to the text interval between the plurality of matching results, the data query text is determined from the voice text.
[0165] As can be seen, through the above optional embodiment, voice text can be determined based on voice recognition, and data query text can be obtained based on keyword matching, precise data query text recognition is realized, so as to facilitate subsequent determination of a data query task, and more accurate and efficient direct execution of a data query task according to voice of a user is assisted, efficiency and convenience of data query are improved, and data query cost and errors are reduced.
[0166] As an optional embodiment, the specific manner in which the recognition module determines the data query text from the interval text between the plurality of matching results includes:
[0167] For any two matching results adjacent in position in the speech text, interval text between the two matching results in the speech text is obtained;
[0168] According to a preset keyword coherence rule, it is determined whether the two matching results belong to a coherent keyword combination, and a first determination result is obtained;
[0169] When the first determination result is yes, the interval text is determined as a candidate query text;
[0170] All candidate query texts are combined to obtain the data query text.
[0171] It can be seen that, through the above optional embodiment, the interval text between keywords in sequence can be obtained by performing coherence matching on continuous matching results, and an accurate data query text can be obtained by combination, so as to facilitate subsequent determination of a data query task, assist in more accurately and efficiently directly executing the data query task according to the user's voice, improve the efficiency and convenience of data query, and reduce data query cost and errors.
[0172] As an optional embodiment, the specific manner in which the recognition module combines all candidate query texts to obtain the data query text includes:
[0173] For any two candidate query texts adjacent in position in the speech text, a text similarity between the two candidate query texts is calculated;
[0174] It is determined whether the text similarity is greater than a preset first similarity threshold, and a second determination result is obtained;
[0175] When the second determination result is yes, any candidate query text is determined as a target query text segment;
[0176] When the second determination result is no, it is determined whether the text similarity is less than a preset second similarity threshold, and a third determination result is obtained; optionally, the second similarity threshold is less than the first similarity threshold;
[0177] When the third determination result is yes, the two candidate query texts are combined in order to obtain the target query text segment;
[0178] When the third determination result is no, any candidate query text is determined as the target query text segment;
[0179] All target query text segments are spliced and combined in order of position in the speech text to obtain the data query text.
[0180] It can be seen that through the above optional embodiments, the similarity between continuous candidate query texts can be calculated and threshold judged to combine to obtain data query texts with larger information amount and more accurate and concise, so as to facilitate subsequent determination of data query tasks, assist in realizing more accurate and efficient direct execution of data query tasks according to the user's voice, improve the efficiency and convenience of data query, and reduce data query cost and errors.
[0181] As an optional embodiment, the specific manner in which the determination module determines the corresponding data query task according to the data query text based on the LLM algorithm model includes:
[0182] Generating prompt words including the data query text based on preset prompt word engineering rules;
[0183] Inputting the prompt words into the trained LLM algorithm model to obtain output multiple possible data query instructions;
[0184] Generating the corresponding data query task according to the multiple possible data query instructions.
[0185] It can be seen that through the above optional embodiments, after generating the prompt words corresponding to the data query text according to the prompt word engineering, the possible data query instructions are determined according to the trained LLM algorithm model to accurately determine the data query task, assist in realizing more accurate and efficient direct execution of data query tasks according to the user's voice, improve the efficiency and convenience of data query, and reduce data query cost and errors.
[0186] As an optional embodiment, the specific manner in which the determination module generates the corresponding data query task according to the multiple possible data query instructions includes:
[0187] For any possible data query instruction, calculating the average value of the instruction similarity 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;
[0188] Determining all possible data query instructions with all first instruction similarity parameters greater than a preset first parameter threshold as candidate data query instructions;
[0189] For any candidate data query instruction, calculating 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;
[0190] Determining the candidate data query instruction with all second instruction similarity parameters greater than a preset second parameter threshold as a target data query instruction;
[0191] generating a data query task corresponding to each target data query instruction.
[0192] It can be seen that through the above optional embodiments, the target data query instruction closer to the user's voice can be obtained by calculating and double-filtering the similarity between multiple possible data query instructions to accurately determine the data query task, assist in more accurately and efficiently directly executing the data query task according to the user's voice, improve the efficiency and convenience of data query, and reduce data query cost and errors.
[0193] As an optional embodiment, the sending module sends the data query task to the corresponding automatic query intelligent agent to execute and obtain the specific manner of the data query result, including:
[0194] For each data query task, determine the task parameter corresponding to the data query task;
[0195] Calculate the task similarity between the historical task parameter in the historical query task record corresponding to each candidate query intelligent agent and the task parameter;
[0196] The candidate query intelligent agent with the highest task similarity is determined as the target query intelligent agent corresponding to the data query task;
[0197] Send each data query task to the corresponding target query intelligent agent, and receive the task query result returned by each target query intelligent agent;
[0198] Calculate the intersection of the task query results returned by all target query intelligent agents to obtain the data query result.
[0199] It can be seen that through the above optional embodiments, the query intelligent agent suitable for each query task can be determined based on the similarity of the task parameter, and the query results of multiple intelligent agents are calculated to obtain accurate query results, which realizes more accurate and efficient direct execution of the data query task according to the user's voice, improves the efficiency and convenience of data query, and reduces data query cost and errors.
[0200] As an optional embodiment, the system is also used to perform the following steps:
[0201] Determine all candidate data query instructions with a second instruction similarity parameter less than a second parameter threshold as potential data query instructions;
[0202] Input each potential data query instruction into the LLM algorithm model to obtain the corresponding potential task description;
[0203] The potential task description is returned to the target user for display, and the target user receives a selection instruction of any potential task description to determine the potential data query instruction corresponding to the potential task description as the target data query instruction.
[0204] It can be seen that through the optional embodiments described above, the task description returned by the LLM model as a recommended task for the user to select as a potential instruction for the similarity parameter centering instruction can mine the potential needs of the user, improve the efficiency and convenience of data query, and reduce the cost and error of data query.
[0205] Embodiment three
[0206] Please refer to Figure 3 , Figure 3 is another LLM-based database query instruction processing system disclosed by the embodiments of the present application. Figure 3 The described LLM-based database query instruction processing system is applied in a data processing system / data processing device / data processing server (wherein the server includes a local processing server or a cloud processing server). As Figure 3 shown, the LLM-based database query instruction processing system can include:
[0207] a memory 301 storing executable program codes;
[0208] a processor 302 coupled with the memory 301;
[0209] The processor 302 calls the executable program codes stored in the memory 301 to execute the steps of the LLM-based database query instruction processing method described in embodiment one.
[0210] Embodiment four
[0211] The embodiments of the present application disclose a computer readable storage medium storing a computer program for electronic data exchange, wherein the computer program causes a computer to execute the steps of the LLM-based database query instruction processing method described in embodiment one.
[0212] Embodiment five
[0213] The embodiments of the present application disclose a computer program product including a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps of the LLM-based database query instruction processing method described in embodiment one.
[0214] The above-described embodiments of the present specification are described with reference to particular embodiments. Other embodiments are within the scope of the following claims. In some cases, actions recited in the claims can be performed in a different order and still achieve desirable results. Additionally, the processes depicted in the accompanying figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.
[0215] The systems, apparatuses, modules, or units illustrated by the above-described embodiments can be specifically realized by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can 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.
[0216] For the convenience of description, the above apparatuses are described in various units by functions respectively when described. Of course, the functions of the units can be realized in the same or multiple software and / or hardware when implementing the present specification.
[0217] Those skilled in the art should understand that the embodiments of the present specification can be provided as a method, a system, or a computer program product. Therefore, the embodiments of the present specification can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0218] The present specification is described with reference to flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present specification. It should be understood that each flow and / or block in the flowcharts and / or block diagrams 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 apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a machine that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in the flow or multiple flows and / or blocks Figure 1 The apparatus that implements the functions specified in the flow or multiple flows and / or blocks.
[0219] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0220] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0221] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0222] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory, etc. The memory is an example of computer readable media.
[0223] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as 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 disc read-only memory (CD-ROM), digital versatile discs (DVDs) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media, such as modulated data signals and carrier waves.
[0224] It should also be noted that the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without further constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0225] The specification can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. The specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including memory storage devices.
[0226] The various embodiments in the specification are described in progressive manner, and the same or similar parts between the various embodiments can be mutually referred to, and each embodiment focuses on the difference from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0227] Finally, it should be noted that the database query instruction processing method and system based on LLM disclosed by the embodiments of the present application are only the preferred embodiments of the present application, and are used to explain the technical solutions of the present application, but not to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalent ones. The modification or replacement does not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for processing database query instructions based on LLM, characterized in that, The method comprises: acquiring voice data of a target user; identifying data query text from the voice data according to a preset voice recognition screening algorithm; determining a corresponding data query task according to the data query text based on an LLM algorithm model, comprising: generating prompt words including the data query text based on a preset prompt word engineering rule; inputting the prompt words into a trained LLM algorithm model to obtain outputted multiple possible data query instructions; for any possible data query instruction, calculating the average of the instruction similarity 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; determining 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, calculating the average 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; determining the candidate data query instruction whose second instruction similarity parameter is greater than a preset second parameter threshold as a target data query instruction; generating a data query task corresponding to each target data query instruction; sending the data query task to a corresponding automatic query intelligent agent for execution and obtaining a data query result, and returning the data query result to the target user.
2. The LLM-based database query instruction processing method according to claim 1, characterized in that, The data query text is identified from the voice data according to a preset voice recognition screening algorithm, comprising: determining a voice text corresponding to the voice data based on a voice recognition algorithm; matching the voice text based on a preset query keyword library to obtain multiple matching results; for any two matching results adjacent in position in the voice text, acquiring interval text between the positions of the two matching results in the voice text; determining whether the two matching results belong to a coherent keyword combination according to a preset keyword coherence rule to obtain a first determination result; when the first determination result is yes, determining the interval text as a candidate query text; combining all candidate query texts to obtain a data query text.
3. The LLM-based database query instruction processing method according to claim 2, characterized in that, The data query text is obtained by combining all candidate query texts, comprising: for any two candidate query texts adjacent in position in the voice text, calculating the text similarity between the two candidate query texts; determining whether the text similarity is greater than a preset first similarity threshold to obtain a second determination result; when the second determination result is yes, determining any candidate query text as a target query text segment; when the second determination result is no, determining whether the text similarity is less than a preset second similarity threshold to obtain a third determination result; the second similarity threshold is less than the first similarity threshold; when the third determination result is yes, combining the two candidate query texts in order to obtain a target query text segment; determining any of the candidate query texts as a target query text segment when the third determination result is negative; splicing and combining all the target query text segments in the order of positions in the voice text to obtain a data query text.
4. The LLM-based database query instruction processing method of claim 1, wherein, The sending of the data query task to the corresponding automatic query agent for execution and obtaining of a data query result comprises: For each data query task, determining a task parameter corresponding to the data query task; calculating a task similarity between the historical task parameter in the historical query task record corresponding to each candidate query agent and the task parameter; determining the candidate query agent with the highest task similarity as the target query agent corresponding to the data query task; sending each data query task to the corresponding target query agent and receiving a task query result returned by each target query agent; calculating the intersection of the task query results returned by all the target query agents to obtain a data query result.
5. The LLM-based database query instruction processing method according to claim 4, characterized in that, The method further comprises: determining all the candidate data query instructions with a second instruction similarity parameter less than the second parameter threshold as potential data query instructions; inputting each potential data query instruction into the LLM algorithm model to obtain a corresponding potential task description; returning each potential task description to the target user for display and receiving a selection instruction of the target user on any potential task description to determine the potential data query instruction corresponding to the potential task description as a target data query instruction.
6. An LLM-based database query instruction processing system, characterized by, The system comprises: an acquisition module configured to acquire voice data of a target user; an identification module configured to identify a data query text from the voice data according to a preset voice recognition filtering algorithm; a determination module configured to determine a corresponding data query task according to the data query text based on an LLM algorithm model, comprising: generating a prompt word comprising the data query text based on a preset prompt word engineering rule; inputting the prompt word into a trained LLM algorithm model to obtain a plurality of possible data query instructions; for any possible data query instruction, calculating an average value of instruction similarity 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; determining all the possible data query instructions with a first instruction similarity parameter greater than a preset first parameter threshold as candidate data query instructions; for any candidate data query instruction, calculating an average value of 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; determining the candidate data query instruction with a second instruction similarity parameter greater than a preset second parameter threshold as a target data query instruction; generating a data query task corresponding to each target data query instruction; The sending module is configured to send the data query task to a corresponding automatic query intelligent agent to execute and obtain a data query result, and return the data query result to the target user.
7. An LLM-based database query instruction processing system, characterized by, The system comprises: a memory storing executable program codes; a processor coupled with the memory; the processor invokes the executable program codes stored in the memory to execute the LLM-based database query instruction processing method according to any one of claims 1-5.
Citation Information
Patent Citations
Data query method and device, electronic equipment and storage medium
CN117667973A
Data query method and device, electronic equipment and storage medium
CN118035280A