Data processing method, device and computer equipment

By screening target intent and constructing prompt templates, and using the generative model to process data step by step, the problem of insufficient parsing of user input information by the generative model is solved, the quality and fault tolerance of the output results are improved, and flexibility is enhanced.

CN119441550BActive Publication Date: 2025-09-30BEIJING PACTERA JINXIN TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411533910.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-09-30
Estimated Expiration
2044-10-30

AI Technical Summary

Technical Problem

The existing generation model does not adequately analyze user input information, resulting in poor quality of generated output results and low fault tolerance.

Method used

By screening the preset query API list, determining the target intent and building a prompt template, the generative model is used to output the target API interface and query conditions, and data processing is performed in steps to improve the fault tolerance of the generative model.

Benefits of technology

The fault tolerance and output quality of the generated model are improved, and the generation model's ability to flexibly respond to different business scenarios and changes in demand is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441550B_ABST
    Figure CN119441550B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of big data processing, and in particular to a data processing method, apparatus and computer equipment. The method comprises: filtering from a preset query API list according to a target intent to obtain a preselected interface list, wherein the target intent is determined based on the user's input data, and the preselected interface list includes various query API interfaces associated with the target intent; inputting the input data, the target intent and the preselected interface list into a generation model to obtain the target API interface and query conditions output by the generation model; inputting the query conditions into the target API interface for querying to obtain the query results fed back by the target API interface; inputting the query results and the input data into the generation model for data processing to obtain the data processing results. The use of this method can improve the fault tolerance of the generation model, thereby improving the quality of the output results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of big data processing, and in particular to a data processing method, apparatus, and computer equipment. Background Art

[0002] With the continuous development and advancement of large model-based products, the demand for processing large amounts of background knowledge and precise context based on these models is increasing. This has led to the emergence of RAG (Retrieval-Augmented Generation) technology. RAG is a natural language processing method that combines information retrieval and text generation. It retrieves external knowledge bases to provide contextual information for the LLM (Large Language Model) generative model, enabling the generative model to generate more accurate and relevant text responses. In related technologies, the generative model parses user input information to determine the database and query parameters to be queried. SQL-formatted query code is then generated based on the query parameters and sent to the relevant database for data query. The database then feeds the query results back to the generative model in the form of code. Based on the query results, the generative model generates output results that are fed back to the user.

[0003] However, in related technologies, since the generation model directly parses the user's input information to obtain the database and query parameters that need to be queried, the performance requirements of the generation model are extremely high; this leads to the fact that in related technologies, the process of generating output results by the generation model has almost no redundant fault tolerance; it often happens that the model cannot fully understand the user's needs, resulting in request failure, resulting in poor quality of the generated output results.

[0004] Therefore, how to improve the fault tolerance of the generative model and thus improve the quality of the output results is an urgent problem that needs to be solved. Summary of the Invention

[0005] Based on this, it is necessary to provide a data processing method, device and computer equipment that can improve the fault tolerance of the generated model and thus improve the quality of the output results in response to the above technical problems.

[0006] In a first aspect, the present application provides a data processing method, comprising:

[0007] Filtering from a preset query API list according to a target intent to obtain a preselected interface list, wherein the target intent is determined based on user input data, and the preselected interface list includes various query API interfaces associated with the target intent;

[0008] Input the input data, the target intent, and the pre-selected interface list into a generation model to obtain the target API interface and query conditions output by the generation model;

[0009] Input the query condition into the target API interface to perform a query, and obtain the query result fed back by the target API interface;

[0010] The query result and the input data are input into the generation model for data processing to obtain a data processing result.

[0011] In one embodiment, inputting the input data, the target intent, and the pre-selected interface list into a generation model to obtain the target API interface and query conditions output by the generation model includes:

[0012] Constructing a first prompt template based on the input data, the target intent, and the pre-selected interface list;

[0013] The first prompt template is input into the generation model to obtain a selection result output by the generation model, where the selection result includes a target API interface and a query condition.

[0014] In one embodiment, the method further comprises:

[0015] Inputting the first prompt template into the generation model N times to obtain N selection results, where N>0;

[0016] If the N selection results are not completely the same, the difference items in the N selection results are compared, and first prompt information is generated based on the difference items, and the first prompt information is fed back to the requesting end.

[0017] In one embodiment, inputting the query condition into the target API interface for querying includes:

[0018] If the N selection results are exactly the same, the query condition is input into the target API interface for query, and the query result fed back by the target API interface is obtained.

[0019] In one embodiment, the method further comprises:

[0020] Input the query condition into the functional API interface to obtain the standard query condition fed back by the functional API interface, wherein the standard query condition is data processed by standard formatting;

[0021] The standard query conditions are input into the target API interface for query.

[0022] In one embodiment, inputting the query result and the input data into the generation model for data processing to obtain the data processing result includes:

[0023] constructing a second prompt template based on the query result and the input data;

[0024] The second prompt template is input into the generation model for data processing to obtain a data processing result.

[0025] In one embodiment, the method further comprises:

[0026] receiving input data, parsing the input data, and obtaining an initial intent;

[0027] Matching each intent template with the initial intent in turn;

[0028] If the intention template corresponding to the initial intention exists, determining the initial intention as the target intention;

[0029] If the intent template corresponding to the initial intent does not exist, a second prompt message is generated and the second prompt message is fed back to the requesting end.

[0030] In one embodiment, the intent template includes a function sub-template and a parameter type sub-template, the initial intent includes a requested function and a requested parameter type, and sequentially matching each intent template with the initial intent includes:

[0031] For each intent template, the function sub-template is matched with the initial intent in turn, and the parameter type sub-template is matched with the request parameter type.

[0032] In a second aspect, the present application further provides a data processing device, comprising a screening module, a first input module, a query module, and a second input module, wherein:

[0033] A screening module is used to filter from a preset query API list according to a target intent to obtain a pre-selected interface list, wherein the target intent is determined based on user input data, and the pre-selected interface list includes various query API interfaces associated with the target intent;

[0034] A first input module is used to input the input data, the target intent and the pre-selected interface list into the generation model, and obtain the target API interface and query conditions output by the generation model;

[0035] A query module, configured to input the query conditions into the target API interface for querying and obtain the query results fed back by the target API interface;

[0036] The second input module is used to input the query result and the input data into the generation model for data processing to obtain a data processing result.

[0037] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0038] Filtering from a preset query API list according to a target intent to obtain a preselected interface list, wherein the target intent is determined based on user input data, and the preselected interface list includes various query API interfaces associated with the target intent;

[0039] Input the input data, the target intent, and the pre-selected interface list into a generation model to obtain the target API interface and query conditions output by the generation model;

[0040] Input the query condition into the target API interface to perform a query, and obtain the query result fed back by the target API interface;

[0041] The query result and the input data are input into the generation model for data processing to obtain a data processing result.

[0042] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0043] Filtering from a preset query API list according to a target intent to obtain a preselected interface list, wherein the target intent is determined based on user input data, and the preselected interface list includes various query API interfaces associated with the target intent;

[0044] Input the input data, the target intent, and the pre-selected interface list into a generation model to obtain the target API interface and query conditions output by the generation model;

[0045] Input the query condition into the target API interface to perform a query, and obtain the query result fed back by the target API interface;

[0046] The query result and the input data are input into the generation model for data processing to obtain a data processing result.

[0047] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:

[0048] Filtering from a preset query API list according to a target intent to obtain a preselected interface list, wherein the target intent is determined based on user input data, and the preselected interface list includes various query API interfaces associated with the target intent;

[0049] Input the input data, the target intent, and the pre-selected interface list into a generation model to obtain the target API interface and query conditions output by the generation model;

[0050] Input the query condition into the target API interface to perform a query, and obtain the query result fed back by the target API interface;

[0051] The query result and the input data are input into the generation model for data processing to obtain a data processing result.

[0052] The above-mentioned data processing method, device, computer equipment, medium and program product perform text classification on the user's input data to obtain the user's target intent, and input the input data, the target intent and the pre-selected interface list into the generation model, and utilize the analysis and data processing capabilities of the generation model once to obtain the target API interface and query conditions output by the generation model; further, the query conditions are input into the target API interface for query, and the query results fed back by the target API interface are obtained; the query results and the input data are input into the generation model, and the analysis and data processing capabilities of the generation model are utilized again, so that the generation model uses the query results as a reference, analyzes and processes the user's input data, and uses the generated corresponding data processing results as output results. In the related art, the generation model receives the user's input data and directly generates the output results; compared with the related art, in the solution of the present application, the process of the generation model receiving the user's input data and directly generating the output results is split into three steps: determining the target API interface and query conditions, obtaining the query results and determining the output results, and utilizing the analysis and data processing capabilities of the generation model twice, so that the quality of the output results generated by the generation model is higher.

[0053] In addition, the related art uses direct structured query code to query the database, while the present application uses a generative model to parse the input data to obtain query conditions. The query conditions are parameterized data, and the target API interface is called to query the parameterized data. The parameterized data transmission allows the data passed to the API interface to be dynamically adjusted as needed without changing the overall data structure, so that the generative model can respond more flexibly to different business scenarios and demand changes, thereby reducing the probability of request failure due to failure in structured data generation or non-standard generation, thereby improving the fault tolerance of the generative model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0055] Figure 1 A diagram of an application environment of a data processing method in one embodiment;

[0056] Figure 2 1 is a flow chart of a data processing method in one embodiment;

[0057] Figure 3 A logical diagram of data processing in one embodiment;

[0058] Figure 4 A flowchart of steps for determining target intent in one embodiment;

[0059] Figure 5 A schematic flow chart of the step of determining a selection result in one embodiment;

[0060] Figure 6 A flowchart of a query result determination step in one embodiment;

[0061] Figure 7 is a structural block diagram of a data processing device in one embodiment;

[0062] Figure 8 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0064] The data processing method provided in the embodiments of the present application is applied to a computer device; wherein the computer device is configured with a generative model, the computer device receives user input data, processes the user input data, and the generative model generates output results based on the processed data and feeds them back to the user. In one possible scenario, the computer device may be a terminal device; the terminal device may be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. When the computer device is a terminal device, the computer device may directly receive user input data and directly display the generated output results to the user.

[0065] In another possible situation, Figure 1 As shown, the computer device may also be a server 104, and the data storage system may store data to be processed by the server 104; the user's terminal 102 may communicate with the server via a network. The user sends input data to the server 104 via the terminal 102, and the server 104 receives the user's input data and directly feeds back the generated output results to the terminal 102, which then displays the output results to the user.

[0066] In an exemplary embodiment, Figure 2 As shown, a data processing method is provided, which is applied to Figure 1 The computer device in the example is used to illustrate the process, including the following steps 02 to 05, wherein:

[0067] Step 02: Filter from the preset query API list according to the target intent to obtain a pre-selected interface list. The target intent is determined based on the user's input data. The pre-selected interface list includes various query API interfaces associated with the target intent.

[0068] In the embodiment of the present application, when the computer device receives the input data from the user, it performs text classification on the input data to obtain the user's target intent. Specifically, the computer device performs text classification on the input data by calling a pre-trained text classification supervision model to obtain the user's target intent. The target intent includes a request function and a request parameter type. The request function is what function you want to achieve. For example, the request function can be a query function or a generation function, or it can be a query function and a generation function. The specific type of the request function is not specifically limited in the embodiment of the present application. The request parameter type is the type of data that the generation model needs to process. The specific division of the request parameter type is not specifically limited in the embodiment of the present application.

[0069] Specifically, the preset query API list includes multiple query API (Application Programming Interface) interfaces; each query API interface corresponds to a query object, which can be a database, a website, a search engine, etc. The specific type of the query object is not specifically limited in the embodiments of this application. By calling the query API interface and entering the query conditions, the query results fed back by the query API interface can be obtained. Each query API interface is associated with a functional description and the required parameter type.

[0070] After determining the user's target intent, the system filters the query APIs from the preset list based on the target intent to obtain the query API interfaces associated with the target intent, and then constructs a preselected list based on the query API interfaces associated with the target intent. The screening process is as follows: for any query API interface, the function description of the query API interface is compared with the requested function in the target intent to obtain a first comparison result; the required parameter type of the query API interface is compared with the requested parameter type in the target intent to obtain a second comparison result; and when at least one representation in the first comparison result and the second comparison result matches, the query API interface is determined to be the query API interface associated with the target intent.

[0071] Step 03: Input the input data, target intent, and pre-selected interface list into the generation model to obtain the target API interface and query conditions output by the generation model.

[0072] For the embodiment of the present application, the generation model is a pre-trained model. The user's input data, the target intent determined for the user's input data, and the pre-selected list constructed in step 02 are input into the generation model, and the generation model's understanding and analysis capabilities are used to comprehensively analyze the input content, thereby obtaining the target API interface determined from the pre-selected API list and the query conditions determined from the user's input data as output by the generation model. The target API interface is the query API interface selected by the generation model that best matches the user's actual needs, that is, the query API interface that needs to be actually queried later.

[0073] Furthermore, there can be multiple target API interfaces and multiple query conditions, and each target API interface corresponds to at least one query condition. The query condition can include at least one conditional limitation, such as a specific limitation on the request parameter type. For example, the query condition can be a conditional limitation on the time or quantity of the request parameter type; the query condition can also be a conditional limitation on the visualization of the output results finally generated by the generation model, such as organizing the data into a table or a line chart. In the embodiment of the present application, the specific content of the query condition is not specifically limited.

[0074] Step 04: Enter the query conditions into the target API interface to query and obtain the query results fed back by the target API interface.

[0075] For the embodiment of the present application, the computer device calls the target API interface and inputs the query conditions and request parameter types into the target API interface for data query. The target API interface performs data query in the corresponding query object based on the query conditions and request parameter types, and feeds back the query results to the computer device.

[0076] Step 05: Input the query results and input data into the generation model for data processing to obtain the data processing results.

[0077] In this embodiment of the present application, after obtaining the query result from the target API interface in step 04, the user's input data, the determined target intent, and the query result are again input into the generative model. The generative model uses the query result as a reference, analyzes and processes the user's input data, and generates the corresponding data processing result as the output. In this embodiment of the present application, the generative model can be an LLM (Large Language Model).

[0078] In the above data processing method, text classification is performed on the user's input data to obtain the user's target intention. By inputting the input data, target intention and pre-selected interface list into the generation model, the analysis and data processing capabilities of the generation model are used to obtain the target API interface and query conditions output by the generation model; further, the query conditions are input into the target API interface for query to obtain the query results fed back by the target API interface; the query results and input data are input into the generation model, and the analysis and data processing capabilities of the generation model are used again to enable the generation model to use the query results as a reference, analyze and process the user's input data, and generate the corresponding data processing results as the output results. In the related art, the generation model receives the user's input data and directly generates the output result; compared with the related art, in the solution of the present application, the process of the generation model receiving the user's input data and directly generating the output result is split into three steps: determining the target API interface and query conditions, obtaining the query results, and determining the output results, and the analysis and data processing capabilities of the generation model are utilized twice, so that the quality of the output results generated by the generation model is higher; and, in the related art, a direct structured query code is used to query the database, while in the present application, a generation model is used to parse the input data to obtain the query conditions, and the query conditions are parameterized data, and the target API interface is called to query the parameterized data, and the parameterized data transmission allows the data passed to the API interface to be dynamically adjusted as needed without changing the overall data structure, so that the generation model can more flexibly respond to different business scenarios and demand changes, thereby reducing the probability of request failure due to failure in structured data generation or non-standard generation, thereby improving the fault tolerance of the generation model.

[0079] In one embodiment, before step 02, a step of determining the target intention is also included; Figure 3 The step of determining the target intention may specifically include steps 011 to 014, wherein:

[0080] Step 011: Receive input data, parse the input data, and obtain the initial intent.

[0081] The user's output data includes the initial data initially entered by the user and may also include supplementary data. If the initial data entered by the user cannot be matched to the intent template, it indicates that the initial data entered by the user is incomplete and the user is required to enter supplementary data. After the user enters the supplementary data, the computer device interprets the supplementary data and the initial data as a new input data.

[0082] Specifically, the computer device performs text classification on the input data by calling a pre-trained text classification supervision model to obtain the user's initial intention.

[0083] Step 012: Match each intent template with the initial intent in turn;

[0084] Step 013: If there is an intent template corresponding to the initial intent, the initial intent is determined as the target intent;

[0085] Step 014: If there is no intent template corresponding to the initial intent, a second prompt message is generated and the second prompt message is fed back to the requesting end.

[0086] Specifically, multiple intent templates are pre-set, and each intent template includes a function sub-template and a parameter type sub-template; for each intent template, the function sub-template is matched with the initial intent in turn, and the parameter type sub-template is matched with the request parameter type, that is, when matching the initial intent based on each intent template, for the initial intent and each intent template, the requested function is matched with the function sub-template, and the requested parameter type is matched with the parameter type sub-template. Among them, the function sub-template includes at least one function that can be implemented, such as a query function; the parameter type sub-template is the parameter type required to implement the corresponding function. Among them, when the requested function is the same as at least one function in the function sub-template, it indicates that the requested function matches the function sub-template; when the requested parameter type matches at least one parameter type in the parameter type sub-template, it indicates that the requested parameter type matches the parameter type sub-template.

[0087] If there is a function sub-template of the intent template that matches the requested function of the initial intent, and the parameter type sub-template matches the requested parameter type, then the intent template is determined to match the initial template; at this time, the initial template is determined as the target intent.

[0088] If no intent template matches the initial intent, the user's input data is ambiguous. A second prompt is generated and sent back to the user. This second prompt prompts the user to enter additional data or modify the initial data. After the user completes the additional input, the new data is resent to the computer, which then re-executes the target intent determination step based on the new data.

[0089] In one embodiment, referring to Figure 4 , step 02 may specifically include step 021 and step 022, wherein:

[0090] Step 021: construct a first prompt template based on the input data, target intent, and pre-selected interface list;

[0091] Step 022: Input the first prompt template into the generation model to obtain the selection result output by the generation model, where the selection result includes the target API interface and the query condition.

[0092] Specifically, a Prompt template is generated as the first prompt template based on the user's input data, the target intention determined in steps 011 - 013 , and the pre-selected interface list. It helps users interact with the generated model more effectively to achieve the desired output. The design of prompt templates involves multiple aspects, including but not limited to clarifying instructions, providing background information, and setting roles and goals to ensure that the model can understand and execute the user's intended goals.

[0093] In another embodiment, a first API interface prompt template is constructed based on the input data, the target intent, and a pre-selected interface list; the first API interface prompt template is input into the generation model to obtain the target API interface output by the generation model. Furthermore, a first conditional prompt template is constructed based on the input data, the target intent, and the target API interface; the first conditional prompt template is input into the generation model to obtain the query condition output by the generation model.

[0094] In one example, the first API interface prompt template constructed by this application is shown in Table (1).

[0095] Table (1)

[0096]

[0097] In one example, the first condition prompt template constructed by this application is shown in Table (2).

[0098] Table (2)

[0099]

[0100] Furthermore, the output result of the generation model according to the first prompt template is the selection result, and the selection result specifically includes the target API interface and the query condition.

[0101] In the embodiments of this application, when calling a generative model, the API interface corresponding to the generative model is called, and a few-shot configuration (prompt template) is prepared for the API interface. This allows the model to self-generate few-shot examples (prompt template), thereby improving the stability and fault tolerance of the generative model. Furthermore, to reduce the reliance on generative structured data in related technologies, this application converts all query behaviors presented in SQL code into calls to the API interface using query conditions (parameters). The entire process is completed entirely through parameter passing, minimizing the impact of the generative model generating unexecutable content.

[0102] On the one hand, because the first prompt template is input into the generation model through the generation model's API interface, it must conform to the API format and data type. On the other hand, the query conditions in the selection results output by the generation model must be input into the target API interface for data query. Therefore, in step 03, the format and data type requirements for the selection results output by the model are relatively high. To determine the validity of the selection results, this embodiment of the application also includes a verification step for the selection results output by the generation model in step 03.

[0103] In one embodiment, the step of verifying the selection result output by the generation model in step 03 may specifically include: inputting the first prompt template into the generation model N times to obtain N selection results, where N>0. If the N selection results are not identical, comparing the differences in the N selection results, generating first prompt information based on the differences, and feeding the first prompt information back to the requesting end; if the N selection results are identical, determining that the selection result is a valid selection result.

[0104] Specifically, that is to say, the constructed first prompt template is input into the generation model N times respectively, and the selection result of each time output by the generation model is obtained, that is, N selection results. Then all the selection results are compared, and the validity of the selection results is determined based on the comparison results; specifically, the target API interfaces in the N selection results are compared to obtain the API comparison results of the N selection results; the query conditions in the N selection results are compared to obtain the condition comparison results of the N selection results. When the API comparison results of the N selection results indicate that the target API interfaces in each selection result are exactly the same, and the condition comparison results in the N selection results indicate that the query conditions in each selection result are exactly the same, it is considered that the N selection results are exactly the same; at this time, the selection result is a valid selection result.

[0105] If the API comparison results of the N selection results indicate that the target API interfaces in each selection result are not completely identical, and / or the condition comparison results of the N selection results indicate that the query conditions in each selection result are not completely identical, the N selection results are considered to be not completely identical; in this case, any selection result is an invalid selection result. Furthermore, based on the differences in the N selection results, a first prompt message is generated and fed back to the user to prompt the user to enter additional information; or, based on the user's selection instruction, a query condition and / or API interface list is determined from the differences to serve as a valid selection result.

[0106] In one embodiment, referring to Figure 5 In step 04, the query conditions are input into the target API interface for query, which specifically includes steps 041 and 042, wherein:

[0107] Step 041: If the N selection results are identical, input the query condition into the functional API interface to obtain the standard query condition fed back by the functional API interface. The standard query condition is data that has been processed through standard formatting.

[0108] Step 042: Input the standard query conditions into the target API interface for query, and obtain the query results fed back by the target API interface.

[0109] Specifically, multiple functional API interfaces are preconfigured, including but not limited to API interfaces for standard formatting, API interfaces for data visualization, and API interfaces for data calculation. In step 041, the functional interface is an API interface for standard formatting. The query conditions from the valid selection results are input into the API interface for standard formatting, and the functional API interface returns the standard query conditions after standard formatting.

[0110] Furthermore, the standard query condition obtained in step 041 is input into the target API interface for query, and the query result fed back by the target API interface is obtained.

[0111] In one embodiment, step 05 may specifically include: constructing a second prompt template based on the query result and the input data; and inputting the second prompt template into the generation model so that the generation model generates an output result.

[0112] Specifically, based on the query result obtained in step 04, a new Prompt template is constructed with the user's input data as the second prompt template, and the second prompt template is input into the generation model so that the generation model generates an output result. The second prompt template can facilitate the generation model to more accurately understand the user's needs, and accordingly determine the most appropriate post-processing steps and visualization processing; then the generation model calls the corresponding functional API interface to perform the post-processing steps and visualization processing, and obtains the final output result, and then returns the output result to the user. The output result can be text data, or data in the format of voice, image, video, table, etc.

[0113] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0114] Based on the same inventive concept, the present application also provides a data processing device for implementing the aforementioned data processing method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations in one or more data processing device embodiments provided below can be found in the above-mentioned limitations on the data processing method and will not be repeated here.

[0115] In another exemplary embodiment, a data processing method is provided, wherein the method is applied to Figure 1 The computer device in the example is used for explanation.

[0116] The user's potential query and request intentions are locally customized to obtain multiple intent templates; the intent templates are customized expected intents. After receiving the user's input data, the generative model assists the text classification supervision model to analyze the user's input data to determine whether it is a customized intent template (expected intent). If the input data does not match any customized intent templates, the computer device will consider the input data to be an "other" type request, that is, it does not belong to any known category. If the user's input data matches one of the intent templates, the intent template is determined to be the user's target intent, and the target intent will be routed to the subsequent processing flow by the computer device to take corresponding actions.

[0117] (There are two different types of APIs stored locally. The API in this step receives input parameters and returns them to the caller (generating a model) after formatting (standard) the parameters. The caller then passes the returned formatted parameters to the API that executes the query command).

[0118] After confirming the user's target intent, a pre-selected list of APIs that may correspond to the target intent is determined from multiple locally prepared query APIs. The pre-selected list includes each query API that may correspond to the target intent, as well as the relevant parameters, input format, and data type for each query API. Each query API is executed entirely based on the received parameters, not the query command.

[0119] A prompt template is created as the first prompt template. This template contains the user's original request (input data), the result of intent analysis (target intent), and all the API interface information mentioned above (pre-selected interface list). This first prompt template is then input into the pre-trained generative model. Based on the provided format and information, the generative model selects the most appropriate API interface (target API interface) and corresponding parameter values ​​(query conditions) from the pre-selected interface list. This process has high requirements for input and output formats: on the one hand, because the input parameters must be directly input into the API interface corresponding to the current generative model, the format and data type must meet the requirements of API interface I; on the other hand, the query conditions selected by the generative model will also be used as input parameters for querying the API, so the format and data type must also be precise.

[0120] Therefore, after obtaining the selection results (query conditions and target API interface) output by the generative model, the selection results are fed into a post-hoc process based on the generative model to check the output for correctness and consistency. Specifically, the generative model is instructed to verify the output selection results in the first prompt template. Multiple calls are made to generate multiple selection results, and the consistency of each selection result is compared. Corrections and rollbacks are made as necessary. If multiple selections are available, the user is prompted to select one. If formatted input is unavailable, incorrect or uncertain parameters are listed, and the process returns to the initial input stage, requiring the user to re-enter the selected parameters.

[0121] The parameter values ​​and target API interface output by the generated model are parsed. Based on the parsed results, the corresponding parameter values ​​and target API interface are obtained. The parameter values ​​are then input into the corresponding target API interface for query. After obtaining the query results, the query results are combined with the user's original request text (input data) to construct a new prompt template (the second prompt template). The second prompt template contains all the key information of the user's request and the feedback after the system executes the operation, so as to more accurately understand the user's actual needs and determine the most appropriate post-processing and visualization steps accordingly. Finally, these post-processing and visualization steps are executed, and the resulting output is returned to the user.

[0122] The solution in the embodiment of the present application incorporates self-checking, fallback, and skip modules based on the generative model, and prepares a few-shot configuration for the generative model's API interface. This supports the model's self-generation of few-shot examples (a first prompt template and a second prompt template), improving the stability and fault tolerance of the generative model and the accuracy of the output. When setting up the callable API interface, to minimize reliance on generative structured data, all query behaviors presented in the form of SQL code are converted into calls to the API interface. The entire process is completed entirely through parameter passing, minimizing the impact of unexecutable content generated by the generative model.

[0123] In an exemplary embodiment, Figure 7 As shown, a data processing device is provided, which includes a screening module 701, a first input module 702, a query module 703 and a second input module 704, wherein:

[0124] A screening module 701 is configured to screen a preset query API list according to a target intent to obtain a preselected interface list, wherein the target intent is determined based on user input data, and the preselected interface list includes various query API interfaces associated with the target intent;

[0125] The first input module 702 is used to input input data, target intent and pre-selected interface list into the generation model, and obtain the target API interface and query conditions output by the generation model;

[0126] Query module 703, used to input query conditions into the target API interface for query, and obtain the query results fed back by the target API interface;

[0127] The second input module 704 is used to input the query results and input data into the generation model for data processing to obtain data processing results.

[0128] In one embodiment, the first input module 702 is specifically configured to:

[0129] Building a first prompt template based on the input data, the target intent, and the pre-selected interface list;

[0130] The first prompt template is input into the generation model to obtain a selection result output by the generation model, where the selection result includes a target API interface and a query condition.

[0131] In the above-mentioned data processing device, text classification is performed on the user's input data to obtain the user's target intention. By inputting the input data, target intention and pre-selected interface list into the generation model, the analysis and data processing capabilities of the generation model are used to obtain the target API interface and query conditions output by the generation model; further, the query conditions are input into the target API interface for query to obtain the query results fed back by the target API interface; the query results and input data are input into the generation model, and the analysis and data processing capabilities of the generation model are used again to enable the generation model to use the query results as a reference, analyze and process the user's input data, and generate the corresponding data processing results as the output results. In the related art, the generation model receives the user's input data and directly generates the output result; compared with the related art, in the solution of the present application, the process of the generation model receiving the user's input data and directly generating the output result is split into three steps: determining the target API interface and query conditions, obtaining the query results, and determining the output results, and the analysis and data processing capabilities of the generation model are utilized twice, so that the quality of the output results generated by the generation model is higher; and, in the related art, a direct structured query code is used to query the database, while in the present application, a generation model is used to parse the input data to obtain the query conditions, and the query conditions are parameterized data, and the target API interface is called to query the parameterized data, and the parameterized data transmission allows the data passed to the API interface to be dynamically adjusted as needed without changing the overall data structure, so that the generation model can more flexibly respond to different business scenarios and demand changes, thereby reducing the probability of request failure due to failure in structured data generation or non-standard generation, thereby improving the fault tolerance of the generation model.

[0132] In one embodiment, the data processing device further includes a validity verification module, which is specifically configured to:

[0133] Input the first prompt template into the generation model N times to obtain N selection results, where N>0;

[0134] If the N selection results are not completely the same, the difference items in the N selection results are compared, and first prompt information is generated based on the difference items, and the first prompt information is fed back to the requesting end.

[0135] In one embodiment, the query module 703 is specifically configured to:

[0136] If the N selection results are exactly the same, the query conditions are input into the target API interface for query, and the query results fed back by the target API interface are obtained.

[0137] In one embodiment, the query module 703 is further configured to:

[0138] Input query conditions into the functional API interface to obtain standard query conditions fed back by the functional API interface. The standard query conditions are data that has been processed through standard formatting.

[0139] Enter the standard query conditions into the target API interface for query.

[0140] In one embodiment, the second input module is specifically configured to:

[0141] Building a second prompt template based on the query results and the input data;

[0142] The second prompt template is input into the generation model for data processing to obtain a data processing result.

[0143] In one embodiment, the data processing device further includes a target intention determination module, which is specifically configured to:

[0144] Receive input data, parse the input data, and get the initial intent;

[0145] Match each intent template with the initial intent in turn;

[0146] If there is an intention template corresponding to the initial intention, the initial intention is determined as the target intention;

[0147] If there is no intent template corresponding to the initial intent, a second prompt message is generated and the second prompt message is fed back to the requesting end.

[0148] In one embodiment, the target intention determination module is specifically configured to:

[0149] For each intent template, the function sub-template is matched with the initial intent in turn, and the parameter type sub-template is matched with the request parameter type.

[0150] Each module in the above-mentioned data processing device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0151] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be achieved via Wi-Fi, mobile cellular networks, NFC (near-field communication), or other technologies. When executed by the processor, the computer program implements a data processing method. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.

[0152] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0153] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0154] Filtering from a preset query API list according to the target intent to obtain a pre-selected interface list, where the target intent is determined based on the user's input data, and the pre-selected interface list includes various query API interfaces associated with the target intent;

[0155] Input the input data, target intent, and pre-selected interface list into the generation model to obtain the target API interface and query conditions output by the generation model;

[0156] Enter the query conditions into the target API interface to query and obtain the query results fed back by the target API interface;

[0157] The query results and input data are input into the generation model for data processing to obtain the data processing results.

[0158] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0159] Filtering from a preset query API list according to the target intent to obtain a pre-selected interface list, where the target intent is determined based on the user's input data, and the pre-selected interface list includes various query API interfaces associated with the target intent;

[0160] Input the input data, target intent, and pre-selected interface list into the generation model to obtain the target API interface and query conditions output by the generation model;

[0161] Enter the query conditions into the target API interface to query and obtain the query results fed back by the target API interface;

[0162] The query results and input data are input into the generation model for data processing to obtain the data processing results.

[0163] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0164] Filtering from a preset query API list according to the target intent to obtain a pre-selected interface list, where the target intent is determined based on the user's input data, and the pre-selected interface list includes various query API interfaces associated with the target intent;

[0165] Input the input data, target intent, and pre-selected interface list into the generation model to obtain the target API interface and query conditions output by the generation model;

[0166] Enter the query conditions into the target API interface to query and obtain the query results fed back by the target API interface;

[0167] The query results and input data are input into the generation model for data processing to obtain the data processing results.

[0168] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0169] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.

[0170] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0171] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A data processing method, characterized in that: The method comprises: Calling a pre-trained text classification supervision model to perform text classification on the input data to obtain the user's target intent, and filtering from a preset query API list based on the target intent to obtain a pre-selected interface list, wherein the pre-selected interface list includes various query API interfaces associated with the target intent; Constructing a first prompt template based on the input data, the target intent, and the pre-selected interface list; Input the first prompt template into the generation model N times to obtain N selection results, where N>0; the selection results include the target API interface and the query condition; If the N selection results are not completely the same, comparing the difference items in the N selection results, generating first prompt information based on the difference items, and feeding back the first prompt information to the requesting end; If the N selection results are exactly the same, the query condition is input into the target API interface for querying, and the query result fed back by the target API interface is obtained; The query result and the input data are input into the generation model for data processing to obtain a data processing result.

2. The method according to claim 1, characterized in that The target intent includes a request function and a request parameter type.

3. The method according to claim 2, characterized in that The method further comprises: Based on the user's selection instruction, a query condition and / or an API interface list is determined from the difference items as a valid selection result.

4. The method according to claim 1, wherein The first prompt template is used to clarify instructions, provide background information, and set roles and goals.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Input the query condition into the functional API interface to obtain the standard query condition fed back by the functional API interface, wherein the standard query condition is data processed by standard formatting; The standard query conditions are input into the target API interface for query.

6. The method according to any one of claims 1 to 4, characterized in that The step of inputting the query result and the input data into the generation model for data processing to obtain a data processing result includes: constructing a second prompt template based on the query result and the input data; The second prompt template is input into the generation model for data processing to obtain a data processing result.

7. The method according to any one of claims 1 to 4, characterized in that The method further comprises: receiving input data, parsing the input data, and obtaining an initial intent; Matching each intent template with the initial intent in turn; If the intention template corresponding to the initial intention exists, determining the initial intention as the target intention; If the intent template corresponding to the initial intent does not exist, a second prompt message is generated and the second prompt message is fed back to the requesting end.

8. The method according to claim 7, characterized in that The intent template includes a function sub-template and a parameter type sub-template, the initial intent includes a requested function and a requested parameter type, and sequentially matching each intent template with the initial intent includes: For each intent template, the function sub-template is matched with the requested function in turn, and the parameter type sub-template is matched with the requested parameter type.

9. A data processing device, characterized in that: The device includes a screening module, a first input module, a query module, a second input module, and a validity verification module, wherein: A screening module is used to call a pre-trained text classification supervision model to perform text classification on the input data, obtain the user's target intent, and filter from a preset query API list based on the target intent to obtain a pre-selected interface list, wherein the pre-selected interface list includes each query API interface associated with the target intent; A first input module, configured to construct a first prompt template based on the input data, the target intent, and the pre-selected interface list; a validity verification module, configured to input the first prompt template into the generation model N times to obtain N selection results, where N>0; the selection results include a target API interface and a query condition; if the N selection results are not completely identical, compare the differences among the N selection results, generate first prompt information based on the differences, and feed the first prompt information back to the requesting end; A query module, configured to input the query condition into the target API interface for query if the N selection results are identical, and obtain a query result fed back by the target API interface; The second input module is used to input the query result and the input data into the generation model for data processing to obtain a data processing result.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Question answering method and device based on business, electronic equipment and storage medium

    CN117786071A

  • Question and answer data processing method and device, electronic equipment and storage medium

    CN118113831A