API (Application Program Interface) prediction model training method, API interface prediction method and related device

By fine-tuning and optimizing the API classification model and API parameter prediction model, and utilizing a pre-defined domain training set and API prior knowledge base, the problems of high cost and low accuracy of large language models in API prediction tasks are solved, achieving efficient and accurate API parameter prediction in a specific domain.

CN121765446APending Publication Date: 2026-03-31SANGFOR TECH INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411393461.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing large language models are costly and inaccurate in API prediction tasks, making them difficult to apply efficiently in specific domains.

Method used

The API classification model and API parameter prediction model are fine-tuned using a training set from a predefined domain. The model is trained using a language representation model such as BERT, and the model parameters are optimized by combining the API prior knowledge base and differential API prediction parameter labels.

Benefits of technology

It reduces the cost of using the model and improves the accuracy and convenience of API parameter prediction in specific domains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121765446A_ABST
    Figure CN121765446A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a training method of an API (Application Program Interface) prediction model and a related device, which are used for improving the accuracy of API prediction. The method comprises the steps that a training set is obtained, and the training set comprises user questions in a preset field and API parameters called in response to the user questions; inputting the user question into the API classification model to obtain a predicted API type; according to the predicted API type and the user problem, a prompt needed by API parameter prediction is constructed; inputting the prompt into an API parameter prediction model to obtain a predicted API parameter; calculating a first loss between the API type tag and the predicted API type and a second loss between the API predicted parameter tag and the predicted API parameter by using a preset loss function; and finely adjusting the parameters of the API classification model and the parameters of the API parameter prediction model by using a back propagation algorithm, the first loss and the second loss until the API classification model and the API parameter prediction model converge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to model training methods, and more particularly to a training method for an API prediction model, an API interface prediction method, and related apparatus. Background Technology

[0002] Large language models (such as ChatGPT) typically refer to deep learning models with billions or more parameters. Large language models generally use self-supervised or semi-supervised learning to pre-train on a large amount of unlabeled text. The pre-trained large language models have general language understanding capabilities and perform well on a wide range of natural language tasks.

[0003] Existing technologies, when using existing large language models to process API prediction tasks, rely on powerful general-purpose large language models to achieve good prediction accuracy. However, such large language models have high initial training costs, resulting in high commercial costs when the models are commercially available. Summary of the Invention

[0004] This invention provides a training method and related apparatus for an API prediction model. The method trains an API classification model and an API parameter prediction model using a language representation model on a training set from a preset domain. During training, the model parameters of the API classification model and the API parameter prediction model are fine-tuned to obtain the trained API classification model and API parameter prediction model. When used, the trained API classification model and API parameter prediction model have lower costs compared to existing commercial models, and the output API parameters are more accurate in the same API prediction domain as the training set.

[0005] The first aspect of this application provides a method for training an API prediction model, wherein the API prediction model includes an API classification model and an API parameter prediction model, and the API classification model and the API parameter prediction model include a language representation model. The method includes:

[0006] Obtain a training set, wherein the training set includes user questions in a preset domain and API parameters invoked in response to the user questions, and the API parameters include at least API type labels and API prediction parameter labels;

[0007] The user question is input into the API classification model to obtain the predicted API type output by the API classification model;

[0008] Based on the predicted API type and user question, construct the prompts needed for API parameter prediction;

[0009] The prompt is input into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0010] The first loss between the API type label and the predicted API type, and the second loss between the API prediction parameter label and the predicted API parameter are calculated using a preset loss function.

[0011] The parameters of the API classification model are fine-tuned using the backpropagation algorithm and the first loss until the API classification model converges.

[0012] The parameters of the API parameter prediction model are fine-tuned using the backpropagation algorithm and the second loss until the API parameter prediction model converges.

[0013] or,

[0014] Using the sum of the first loss and the second loss, and the backpropagation algorithm, the parameters of the API classification model and the API parameter prediction model are fine-tuned until they converge.

[0015] As an optional embodiment, after obtaining the predicted API type output by the API classification model, the method further includes:

[0016] The predicted API type is input into the API prior knowledge base to query API details associated with the predicted API type. The API details include the API's functional description, API parameter template, and field descriptions in the API parameter template. The API prior knowledge base stores a large number of APIs and their details.

[0017] Based on the predicted API type and the user question, construct the prompts required for API parameter prediction, including:

[0018] Based on the user question and the API details associated with the prediction API type, a prompt is constructed to indicate the API parameter prediction task. The prompt includes system instructions describing the API parameter prediction task, an API parameter template, field descriptions in the API parameter template, and the user question.

[0019] As an optional embodiment, the API prediction parameter label includes differential API prediction parameter label;

[0020] Obtaining the differential API prediction parameter labels includes:

[0021] The difference between the original labeled API prediction parameter label and the API parameter template in the API details information associated with the predicted API type is obtained;

[0022] The calculation of the second loss between the API prediction parameter label and the predicted API parameter using a preset loss function includes:

[0023] A second loss is calculated between the difference API prediction parameter label and the prediction API parameter using a preset loss function.

[0024] The second aspect of this application provides a method for predicting API interfaces, applied to the API prediction model provided in the first aspect of this application. The method includes:

[0025] Input user questions from a preset domain into the API classification model to obtain the predicted API type output by the API classification model;

[0026] Based on the API type and the user question, construct the prompts needed for API parameter prediction;

[0027] The prompt is input into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0028] The prediction API type and the prediction API parameters are determined as the API prediction result.

[0029] As an optional embodiment, after obtaining the predicted API type output by the API classification model, the method further includes:

[0030] The predicted API type is input into the API prior knowledge base to query API details associated with the predicted API type. The API details include the API's functional description, API parameter template, and field descriptions in the API parameter template. The API prior knowledge base stores a large number of APIs and their details.

[0031] Based on the predicted API type and the user question, construct the prompts required for API parameter prediction, including:

[0032] Based on the user question and the API details associated with the prediction API type, a prompt is constructed to indicate the API parameter prediction task. The prompt includes system instructions describing the API parameter prediction task, an API parameter template, field descriptions in the API parameter template, and the user question.

[0033] As an optional embodiment, after obtaining the prediction API parameters, the method further includes:

[0034] The predicted API parameters are fused with the API parameter template to obtain fused predicted API parameters. The fusion process includes:

[0035] The parameter fields in the predicted API parameters are compared one by one with the parameter fields in the API parameter template. If the field value of the predicted API parameter field is different from the default value of the parameter field in the API parameter template, the default value of the parameter field in the API parameter template is replaced with the field value of the predicted API parameter field, and the API parameter template after the parameter replacement is determined as the fused predicted API parameters.

[0036] A third aspect of this application provides a training apparatus for an API prediction model, wherein the API prediction model includes an API classification model and an API parameter prediction model, the API classification model and the API parameter prediction model including a large language model, and the apparatus includes:

[0037] An acquisition unit is used to acquire a training set, wherein the training set includes user questions and API parameters invoked in response to the user questions, and the API parameters include at least API type labels and API prediction parameter labels;

[0038] An input unit is used to input the user question into the API classification model to obtain the predicted API type output by the API classification model;

[0039] A construction unit is used to construct the prompts required for API parameter prediction based on the predicted API type and user question;

[0040] The input unit is also used to input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0041] The calculation unit is used to calculate the first loss between the API type label and the predicted API type, and the second loss between the API prediction parameter label and the predicted API parameter, using a preset loss function;

[0042] The fine-tuning unit is used to fine-tune the parameters of the API classification model using the backpropagation algorithm and the first loss until the API classification model converges, and is also used to fine-tune the parameters of the API parameter prediction model using the backpropagation algorithm and the second loss until the API parameter prediction model converges.

[0043] or,

[0044] The fine-tuning unit is used to fine-tune the parameters of the API classification model and the API parameter prediction model using the sum of the first loss and the second loss, along with the backpropagation algorithm, until the API classification model and the API parameter prediction model converge.

[0045] A fourth aspect of this application provides an API interface prediction apparatus, characterized in that it is applied to the API prediction model provided in the third aspect of this application, the apparatus comprising:

[0046] The input unit is used to input user questions into the API classification model to obtain the predicted API type output by the API classification model.

[0047] A construction unit is used to construct the prompts required for API parameter prediction based on the API type and the user question;

[0048] The input unit is also used to input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model.

[0049] The determining unit is used to determine the prediction API type and the prediction API parameters as the API prediction result.

[0050] A fifth aspect of this application provides a computer device including a processor. When the processor executes a computer program stored in a memory, it is used to implement a training method for an API prediction model provided in the first aspect of this application, or a prediction method for an API interface provided in the second aspect of this application.

[0051] A sixth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it is used to implement the training method of the API prediction model provided in the first aspect of this application, or the prediction method of the API interface provided in the second aspect of this application.

[0052] A seventh aspect of this application provides a computer program product having a computer program stored thereon. When the computer program is executed by a processor, it is used to implement the training method of the API prediction model provided in the first aspect of this application, or the prediction method of the API interface provided in the second aspect of this application.

[0053] As can be seen from the above technical solutions, the embodiments of the present invention have the following advantages:

[0054] In this embodiment, user questions in a preset domain and API parameters invoked in response to user questions in the preset domain are used as training sets to fine-tune the API classification model and the API parameter prediction model. This reduces the amount of training and improves the convenience of obtaining the trained API classification model and the trained API parameter prediction model. It also improves the accuracy of the API parameters output by the trained API model when outputting API parameters in the corresponding domain. Attached Figure Description

[0055] Figure 1 This is a schematic diagram of an embodiment of the training method for the API prediction model in this application.

[0056] Figure 2 This is a schematic diagram of another embodiment of the training method for the API prediction model in this application.

[0057] Figure 3 This is a schematic diagram of an embodiment of the prediction method for the API interface in this application.

[0058] Figure 4 This is a schematic diagram of another embodiment of the prediction method for the API interface in this application;

[0059] Figure 5 This is a schematic diagram of one embodiment of the training device for the API prediction model in this application.

[0060] Figure 6 This is a schematic diagram of one embodiment of the prediction device for the API interface in this application.

[0061] Figure 7 This is a schematic diagram of the architecture of the computer device in the embodiments of this application. Detailed Implementation

[0062] This invention provides a training method for an API prediction model, a prediction method for API interfaces, and related apparatus, which can reduce the cost of using the model and improve the accuracy of API parameters output in professional fields.

[0063] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0064] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0065] For ease of understanding, the training method of the API prediction model in the embodiments of this application is described in detail below. Please refer to [link / reference]. Figure 1 One embodiment of the training method for the API prediction model in this application includes:

[0066] 101. Obtain a training set, wherein the training set includes user questions in a preset domain and API parameters called in response to the user questions, and the API parameters include at least API type labels and API prediction parameter labels;

[0067] In real-world scenarios, if a user poses a question to the model and the model does not know the answer, it can call an API interface to obtain the answer. In this embodiment, the API prediction model is used in a scenario where, when a question is posed to the API prediction model, the model directly outputs the API interface that can be called to answer the question, allowing the system to obtain the answer by calling the API interface.

[0068] Unlike existing technologies that directly use large language models (such as ChatGPT) to predict API parameters, resulting in high usage costs and low prediction accuracy, this application embodiment can train the API prediction model using a training set to obtain a trained API prediction model. This reduces the cost of using the model. Furthermore, this application embodiment uses a training set from a preset domain (such as the field of network security technology or the field of network communication technology) to train the API prediction model, resulting in higher accuracy in outputting API parameters for the corresponding domain (such as the field of network security technology or the field of network communication technology).

[0069] Specifically, the API prediction model in this application embodiment includes an API classification model and an API parameter prediction model. The initialized API prediction model (i.e., the initialized API classification model and the initialized API parameter prediction model) can use an open-source language representation model, such as the BERT (Bidirectional Encoder Representation from Transformers) model. The BERT model is a pre-trained language representation model used to extract language representations and can be fine-tuned for specific downstream tasks to achieve excellent task processing performance.

[0070] In order to better train the API prediction model, this application uses the user question and the API parameters called in response to the user question as training sets to train the API classification model and the API parameter prediction model respectively. It is easy to understand that the API parameters called in response to the user question include at least the API type label and the API prediction parameter label. That is, this application uses supervised learning to train the API prediction model.

[0071] To make it easier to understand, here is an example of the API parameters called for user questions and responses:

[0072] User Question: What alerts have been issued regarding XSS vulnerability attacks in the last 7 days?

[0073] API type: {Alarm API interface};

[0074] API parameters: {"time":{"timeField":"lastTime","begin":{"type":"relative","unit":"D","value":7},"end":null},

[0075] "condition":{"dstIp":"","name":"XSS"},

[0076] "size":10}

[0077] 102. Input the user question into the API classification model to obtain the predicted API type output by the API classification model;

[0078] After obtaining the training set, the user questions in the training set are input into the API classification model, and the API classification model will output the predicted API type.

[0079] In the example above, if the user's question is what alerts are related to an XSS vulnerability attack, then when querying alerts, the predicted API type will be the API type for querying alerts.

[0080] 103. Based on the predicted API type and user question, construct the prompts required for API parameter prediction;

[0081] In order to obtain the predicted API parameters output by the API parameter prediction model, this application embodiment needs to first construct a prompt and input the prompt into the API parameter prediction model. Specifically, the prompt constructed in this application embodiment is mainly to enable the model to accurately output the API prediction parameters based on the prompt.

[0082] Furthermore, when constructing API prompts, the prompts required for the API parameters can be constructed based on the API type and user question. These prompts include the API for querying alarms and the user question.

[0083] 104. Input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0084] Once the prompt is received, it is input into the API parameter prediction model, and the predicted API parameters output by the API parameter prediction model can be obtained.

[0085] The BERT model can also be used for the initial API parameter prediction model.

[0086] 105. Calculate the first loss between the API type label and the predicted API type, and the second loss between the API prediction parameter label and the predicted API parameter using a preset loss function;

[0087] In order to train the API classification model and the API parameter prediction model separately, embodiments of this application can use a preset loss function to calculate the first loss between the API type label and the predicted API type, and the second loss between the API prediction parameter label and the predicted API parameter.

[0088] The preset loss functions include the Mean Squared Error (MSE) function, the Cross-Entropy Loss (CE) function, or the Log Likelihood Loss function, etc. There are no specific restrictions on the type of loss function here.

[0089] 106. Fine-tune the parameters of the API classification model using the backpropagation algorithm and the first loss until the API classification model converges;

[0090] After obtaining the first loss, the parameters of the API classification model are fine-tuned using the backpropagation algorithm and the first loss until the API classification model converges.

[0091] The backpropagation algorithm is similar to that described in existing technologies, and will not be repeated here.

[0092] 107. Fine-tune the parameters of the API parameter prediction model using the backpropagation algorithm and the second loss until the API parameter prediction model converges.

[0093] After obtaining the second loss, the parameters of the API parameter prediction model are fine-tuned using the backpropagation algorithm and the second loss until the API classification model converges.

[0094] 108. Using the sum of the first loss and the second loss, and the backpropagation algorithm, fine-tune the parameters of the API classification model and the API parameter prediction model until the API classification model and the API parameter prediction model converge.

[0095] Furthermore, in order to improve the training speed of the API classification model and the API parameter prediction model during training, the embodiments of this application may first calculate the sum of the first loss and the second loss, and then use the sum of the first loss and the second loss to train the API classification model and the API parameter prediction model simultaneously, so as to improve the timeliness of training the API classification model and the API parameter prediction model.

[0096] Unlike existing technologies that build models from scratch, this application uses a language representation model, such as BERT, as the initial API classification model and the initial API parameter prediction model. The API classification model and the API parameter prediction model are fine-tuned using a training set, thereby reducing the amount of training and improving the convenience of obtaining the trained API classification model and the trained API parameter prediction model.

[0097] In this embodiment, user questions in a preset domain and API parameters invoked in response to user questions in the preset domain are used as training sets to fine-tune the API classification model and the API parameter prediction model. This reduces the amount of training and improves the convenience of obtaining the trained API classification model and the trained API parameter prediction model. It also improves the accuracy of the API parameters output by the trained API model when outputting API parameters in the corresponding domain.

[0098] based on Figure 1In the embodiments described above, to further improve the accuracy of the API parameters output by the API parameter prediction model, before executing step 103, that is, before constructing the prompts required for API parameter prediction based on the predicted API type and user question, the following steps may also be performed. Please refer to [link to relevant documentation]. Figure 2 , Figure 2 Another embodiment of the training method for API prediction models:

[0099] 201. Obtain a training set, wherein the training set includes user questions in a preset domain and API parameters invoked in response to the user questions, and the API parameters include at least API type labels and API prediction parameter labels;

[0100] 202. Input the user question into the API classification model to obtain the predicted API type output by the API classification model;

[0101] The descriptions of steps 201 to 202 are consistent with... Figure 1 The steps 101 to 102 in the embodiments are described similarly and will not be repeated here.

[0102] 203. Input the predicted API type into the API prior knowledge base to query API details associated with the predicted API type. The API details include the API's functional description, API parameter template, and field descriptions in the API parameter template. The API prior knowledge base stores a large number of APIs and their details.

[0103] Different from Figure 1 In the embodiments described herein, to further improve the accuracy of the API parameters output by the API prediction model, the predicted API type output by the API classification model is input into the API prior knowledge base to query the API details associated with the predicted API type from the API prior knowledge base. The API details include the API's functional description, the API's parameter template, and the field descriptions in the API parameter template.

[0104] For ease of explanation, the following example uses the alarm API interface to illustrate the content of the API details:

[0105] If the corresponding alarm API interface is used, the API details include:

[0106] {"time":{"timeField":"lastTime","begin":{"type":"relative","unit":"Mon","value":1},"end":null}, / / This query retrieves data for the last month. 'unit' represents the time unit, with values ​​ranging from ["H": hour, "D": day / day, "W": week, "Mon": month]; 'value' represents the numerical value of the time.

[0107] "condition":{"hostIp":"","srcIp":"","dstIp":"","name":"","severity":[],"originProductType":[],"attackResult":"","accessDirection":[],"stage":"","asset_name":"","asset_manager":"","asset_branch":"","asset_business":"","dealStatus":[],"uuId":""}, / / condition represents the supported query condition fields, which only include hostIp (host IP), srcIp (source IP), dstIp (destination IP), name (attack alert name), and severity (alert name). Level: 2 <Low Risk>, 3 <Medium Risk>, 4 <High Risk>, 5 <Severe>), originProductType (refers to the products from which alarms were detected: EDR, EPP, CWPP, QingTeng HIDS, SIP, AF, STA), attackResult (attack result: success, failure, attempt, compromised), accessDirection (attack direction, integer array: 0 <None>, 1 <Inside to Outside>, 2 <Outside to Inside>, 3 <Inside to Inside>), stage (attack stage), asset_name: asset name; asset_manager: asset manager; asset_branch: asset group; asset_business: asset business group; dealStatus: disposal status (1: pending disposal, 2: in disposal, 3: disposal completed); uuId: unique ID. Do not add these fields yourself.

[0108] "size": 10 / / Indicates the number of results to retrieve. If not specified, the default value is 10.

[0109] }

[0110] It should be noted that the API prior knowledge base pre-stores a large number of different types of APIs and detailed information about each API.

[0111] 204. Based on the user question and the API details associated with the predicted API type, construct the prompts required for API parameter prediction, wherein the prompts include system instructions describing the API parameter prediction task, API parameter templates, field descriptions in the API parameter templates, and the user question;

[0112] In this embodiment of the application, after obtaining the API details information associated with the predicted API type, the prompt is constructed based on the user question and the API details information associated with the predicted API type. The prompt includes system instructions describing the API parameter prediction task, API parameter template, field descriptions in the API parameter template, and the user question.

[0113] To make it easier to understand, here is an example of a prompt:

[0114] System instructions describing API parameter prediction tasks:

[0115] If you are an expert in filling in API parameters, you need to refer to the following parameter filling examples, fill in the user questions and corresponding API parameter templates, and fill in the corresponding API parameters. If the question does not mention relevant parameter information, fill in the default value.

[0116] API parameter model and field descriptions within the API parameter model:

[0117] The API parameter templates and field explanations that you need to fill in now are as follows:

[0118] {

[0119] "time":{"timeField":"lastTime","begin":{"type":"relative","unit":"Mon","value":1},"end":null}, / / This query retrieves data for the last month. 'unit' represents the time unit, with values ​​ranging from ["H": hour, "D": day / day, "W": week, "Mon": month]; 'value' represents the numerical value of the time.

[0120] "condition":{"hostIp":"","srcIp":"","dstIp":"","name":"","severity":[],"originProductType":[],"attackResult":"","accessDirection":[],"stage":"","asset_nam e":"","asset_manager":"","asset_branch":"","asset_business":"","dealStatus":[],"uuId":""},

[0121] / / condition indicates the supported query condition fields, which only include hostIp (host IP), srcIp (source IP), dstIp (destination IP), name (attack alarm name), severity (alarm level: 2 <low risk>, 3 <medium risk>, 4 <high ​​risk>, 5 <critical>), originProductType (referring to the products from which the alarm was detected: EDR, EPP, CWPP, QingTeng HIDS, SIP, AF, STA), and attackResult (attack result: successful). (Attack direction, integer array: 0 <None>, 1 <Inside to Outside>, 2 <Outside to Inside>, 3 <Inside to Inside>), stage (attack stage), asset_name: asset name; asset_manager: asset manager; asset_branch: asset group; asset_business: asset business group; dealStatus: disposal status (1: pending disposal, 2: in disposal, 3: disposal completed); uuId: unique ID. Do not add these fields yourself.

[0122] "size": 10 / / Indicates the number of results to retrieve. If not specified, the default value is 10.

[0123] }

[0124] User Question: What alerts have been issued regarding XSS vulnerability attacks in the last 7 days?

[0125] 205. Input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0126] 206. Calculate the first loss between the API type label and the predicted API type, and the second loss between the API prediction parameter label and the predicted API parameter using a preset loss function;

[0127] 207. Fine-tune the parameters of the API classification model using the backpropagation algorithm and the first loss until the API classification model converges;

[0128] 208. Fine-tune the parameters of the API parameter prediction model using the backpropagation algorithm and the second loss until the API parameter prediction model converges.

[0129] The descriptions of steps 205 and 208 are as follows: Figure 1 The descriptions of steps 104 to 107 in the embodiments are similar and will not be repeated here.

[0130] As another optional embodiment, in order to improve the training speed of the API classification model and the API parameter prediction model during training, this embodiment of the application may first calculate the sum of the first loss and the second loss, and then use the sum of the first loss and the second loss, as well as the backpropagation algorithm, to train the API classification model and the API parameter prediction model simultaneously, so as to improve the timeliness of training the API classification model and the API parameter prediction model.

[0131] Different from Figure 1 In the embodiments of this application, when constructing prompts, the predicted API type is first input into the API prior knowledge base, thereby making full use of the existing knowledge in the API prior knowledge base and using the existing knowledge to construct more prompts. This allows the API parameter prediction model to have more reference content when outputting predicted API parameters. In other words, the prompts inform the API parameter prediction model of more parameter hints, thereby reducing the difficulty of the task and further improving the accuracy of the API parameters output by the API parameter preset model.

[0132] based on Figure 1 or Figure 2 In the embodiments described above, to further reduce the difficulty of API parameter prediction and improve its accuracy, when training the API parameter prediction model, in order to reduce the number of API parameters output by the model and improve its accuracy, differential API prediction parameter labels can be used to train the API parameter prediction model, thereby reducing the number of output parameters. Specifically, the process of obtaining differential API prediction parameter labels in this embodiment is as follows:

[0133] The difference between the original labeled API prediction parameter label and the API parameter template in the API details information associated with the predicted API type is used to obtain the difference API prediction parameter label.

[0134] When using the differential API prediction parameter labels as training labels, the loss between the differential API prediction parameter labels and the prediction API parameters is calculated using a preset loss function when calculating the second loss.

[0135] For ease of understanding, let's assume the original API prediction parameter labels are as follows:

[0136] {

[0137] "time":{"timeField":"lastTime","begin":{"type":"relative","unit":"D","value":7},"end":null},

[0138] "condition":{"dstIp":"","name":"XSS"},

[0139] "size":10

[0140] }

[0141] The API details associated with the prediction API type are as follows:

[0142] {

[0143] "time":{"timeField":"lastTime","begin":{"type":"relative","unit":"Mon","value":1},"end":null}, / / This query retrieves data for the last month. 'unit' represents the time unit, with values ​​ranging from ["H": hour, "D": day / day, "W": week, "Mon": month]; 'value' represents the numerical value of the time.

[0144] "condition":{"hostIp":"","srcIp":"","dstIp":"","name":"","severity":[],"originProductType":[],"attackResult":"","accessDirection":[],"stage":"","asset_nam e":"","asset_manager":"","asset_branch":"","asset_business":"","dealStatus":[],"uuId":""},

[0145] / / condition indicates the supported query condition fields, which only include hostIp (host IP), srcIp (source IP), dstIp (destination IP), name (attack alarm name), severity (alarm level: 2 <low risk>, 3 <medium risk>, 4 <high ​​risk>, 5 <critical>), originProductType (referring to the products from which the alarm was detected: EDR, EPP, CWPP, QingTeng HIDS, SIP, AF, STA), and attackResult (attack result: successful). (Attack direction, integer array: 0 <None>, 1 <Inside to Outside>, 2 <Outside to Inside>, 3 <Inside to Inside>), stage (attack stage), asset_name: asset name; asset_manager: asset manager; asset_branch: asset group; asset_business: asset business group; dealStatus: disposal status (1: pending disposal, 2: in disposal, 3: disposal completed); uuId: unique ID. Do not add these fields yourself.

[0146] "size": 10 / / Indicates the number of results to retrieve. If not specified, the default value is 10.

[0147] }

[0148] The difference between the original labeled API predicted parameter labels and the API parameter template in the API details information associated with the predicted API type is then calculated, and the resulting difference API predicted parameter labels are as follows:

[0149] {

[0150] "time":{"begin":{"unit":"D","value":7}},

[0151] "condition":{"name":"XSS"}

[0152] }

[0153] This application embodiment uses differential API prediction parameter labels to train the API parameter prediction model, thereby reducing the number of API parameters output by the API parameter prediction model and improving the accuracy of the API parameters output by the API parameter prediction model.

[0154] The training method for the API prediction model has been described in detail above. The prediction method for the API interface in the embodiments of this application will be described below. Please refer to [link / reference needed]. Figure 3 One embodiment of the prediction method for the API interface in this application includes:

[0155] 301. Input the user question from the preset domain into the API classification model to obtain the predicted API type output by the API classification model;

[0156] After training the API classification model and API parameter prediction model in the API prediction model in the above embodiments, the API classification model and API parameter prediction model can be directly used to predict API parameters.

[0157] Specifically, in this embodiment of the application, the user question is first input into the API classification model, and then the predicted API type output by the API classification model can be obtained.

[0158] 302. Based on the API type and the user question, construct the prompts required for API parameter prediction;

[0159] Once the API type is obtained, the necessary prompts for API parameter prediction are constructed based on the API type and the user question. These prompts include both the API type and the user question.

[0160] For example, if a user asks: What alerts have been issued regarding the XSS vulnerability attack in the last 7 days?

[0161] API type: {Alarm API interface};

[0162] The prompt here consists of the user question and API type mentioned above.

[0163] 303. Input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0164] After receiving the prompt, the user is prompted to input the API parameter prediction model trained in the above training method embodiment, and then the predicted API parameters output by the API parameter prediction model can be obtained.

[0165] It should be noted that in the above-described embodiment of the prediction model training method, if the differential API prediction parameter labels are used to train the API parameter prediction model, then the output of the API parameter prediction model is the predicted differential API parameter.

[0166] If the API parameter prediction model is trained using the full set of API prediction parameter labels in the above-mentioned prediction model training method embodiment, then the API parameter prediction model outputs the predicted full set of API parameters.

[0167] 304. The prediction API type and the prediction API parameters are determined as the API prediction result.

[0168] After obtaining the predicted API type output in step 302 and the predicted API parameters output in step 303, the predicted API type and the predicted API parameters are combined into the final API prediction result.

[0169] This application describes in detail the method of predicting API interfaces using an API prediction model. This application uses a pre-trained API prediction model to output the predicted API type and predicted API parameters. Because the pre-trained API prediction model is trained using a training set of a preset domain, the API parameters output by the API prediction model are more accurate when inputting user questions from the preset domain.

[0170] based on Figure 3 In the embodiments described above, to further reduce the difficulty of the prediction task and improve the accuracy of the API parameters output by the API parameter prediction model, this application may also perform the following steps, please refer to [link to relevant documentation]. Figure 4 Another embodiment of the API interface prediction method in this application includes:

[0171] 401. Input the user question from the preset domain into the API classification model to obtain the predicted API type output by the API classification model;

[0172] After training the API classification model and API parameter prediction model in the API prediction model in the above embodiments, the API classification model and API parameter prediction model can be directly used to predict API parameters.

[0173] Specifically, in this embodiment of the application, the user question is first input into the API classification model, and then the predicted API type output by the API classification model can be obtained.

[0174] 402. Input the predicted API type into the API prior knowledge base to query API details associated with the predicted API type, wherein the API details include the API's functional description, API parameter template, and field descriptions in the API parameter template, and the API prior knowledge base stores a large number of APIs and their details;

[0175] Specifically, the description of step 402 is similar to that of step 203, and will not be repeated here.

[0176] 403. Based on the user question and the API details associated with the predicted API type, construct the prompts required for API parameter prediction, wherein the prompts include system instructions describing the API parameter prediction task, API parameter templates, field descriptions in the API parameter templates, and the user question;

[0177] Specifically, the description of step 403 is similar to that of step 204, and will not be repeated here.

[0178] 404. Input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model;

[0179] 405. The prediction API type and the prediction API parameters are determined as the API prediction result.

[0180] Steps 404 to 405 are similar to those described in steps 303 to 304, and will not be repeated here.

[0181] In this embodiment, after obtaining the predicted API type, the predicted API type is further input into the API prior knowledge base, thereby making full use of the existing knowledge in the API prior knowledge base and using the existing knowledge to construct more hints. This allows the API parameter prediction model to have more reference content when outputting predicted API parameters. In other words, the hints provide the API parameter prediction model with more parameter suggestions, thereby reducing the difficulty of the prediction task and further improving the accuracy of the API parameters output by the API parameter prediction model.

[0182] based on Figure 4 In the aforementioned embodiment, after obtaining the predicted API parameters output by the API parameter prediction model, regardless of whether the predicted API parameters are differential or full API parameters, in order to further improve the accuracy of the predicted API parameters, it is necessary to fuse the predicted API parameters with the API parameter template to obtain the fused predicted API parameters. The fusion process is as follows:

[0183] The parameter fields in the predicted API parameters are compared one by one with the parameter fields in the API parameter template. If the field value of the predicted API parameter field is different from the default value of the parameter field in the API parameter template, the default value of the parameter field in the API parameter template is replaced with the field value of the predicted API parameter field, and the API parameter template after the parameter replacement is determined as the fused predicted API parameters.

[0184] This involves comparing each parameter field in the predicted API parameters with the parameter fields in the API parameter model. If the field value of the predicted API parameter field differs from the default value of the parameter field in the API parameter template, then the field value of the predicted API parameter field is used to replace the default value of the parameter field in the API parameter template, and the API parameter template with the replaced field value is determined as the fused predicted API parameters.

[0185] The above fusion process can obtain complete and standardized API parameters on the one hand, and help to eliminate redundant parameter fields on the other hand, thereby improving the accuracy of API parameters.

[0186] To make it easier to understand, the following example is provided:

[0187] Assume the predicted API parameters are:

[0188] {

[0189] "time":{"begin":{"unit":"D","value":7}},

[0190] "condition":{"name":"XSS"}

[0191] }

[0192] The parameters of the API parameter template are as follows:

[0193] {

[0194] "time":{"timeField":"lastTime","begin":{"type":"relative","unit":"Mon","value":1},"end":null},

[0195] "condition":{"hostIp":"","srcIp":"","dstIp":"","name":"","severity":[],"originProductType":[],"attackResult":"","accessDirection":[],"stage":"","asset_nam e":"","asset_manager":"","asset_branch":"","asset_business":"","dealStatus":[],"uuId":""},

[0196] "size":10

[0197] }

[0198] The merged API parameters are as follows:

[0199] {

[0200] "time":{"timeField":"lastTime","begin":{"type":"relative","unit":"D","value":7},"end":null},

[0201] "condition":{"hostIp":"","srcIp":"","dstIp":"","name":"XSS","severity":[],"originProductType":[],"attackResult":"","accessDirection":[],"stage":"","asset_nam e":"","asset_manager":"","asset_branch":"","asset_business":"","dealStatus":[],"uuId":""},

[0202] "size":10

[0203] }

[0204] After obtaining the API prediction parameters, this application further integrates the API prediction parameters with the API parameter template. This not only yields complete and standardized API parameters but also helps to eliminate redundant parameter fields, thereby improving the accuracy of the API parameters.

[0205] It is understood that, in various embodiments of the present invention, the order of the steps does not imply the order of execution. The execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0206] The training method for the API prediction model has been described in detail above. The training apparatus for the API prediction model will be described below. Please refer to [link / reference needed]. Figure 5 One embodiment of the training apparatus for the API prediction model in this application includes:

[0207] The acquisition unit 501 is used to acquire a training set, wherein the training set includes user questions and API parameters called in response to the user questions, and the API parameters include at least API type labels and API prediction parameter labels;

[0208] The input unit 502 is used to input the user question into the API classification model to obtain the predicted API type output by the API classification model;

[0209] Construction unit 503 is used to construct the prompts required for API parameter prediction based on the predicted API type and user question;

[0210] The input unit 502 is also used to input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model.

[0211] The calculation unit 504 is used to calculate the first loss between the API type label and the predicted API type, and the second loss between the API prediction parameter label and the predicted API parameter using a preset loss function;

[0212] The fine-tuning unit 505 is used to fine-tune the parameters of the API classification model using the backpropagation algorithm and the first loss until the API classification model converges, and is also used to fine-tune the parameters of the API parameter prediction model using the backpropagation algorithm and the second loss until the API parameter prediction model converges.

[0213] or,

[0214] The fine-tuning unit 505 is used to fine-tune the parameters of the API classification model and the API parameter prediction model using the sum of the first loss and the second loss and the backpropagation algorithm, until the API classification model and the API parameter prediction model converge.

[0215] Preferably, the input unit 502 is further configured to:

[0216] The predicted API type is input into the API prior knowledge base to query API details associated with the predicted API type. The API details include the API's functional description, API parameter template, and field descriptions in the API parameter template. The API prior knowledge base stores a large number of APIs and their details.

[0217] Preferably, the construction unit 503 is specifically used for:

[0218] Based on the user question and the API details associated with the prediction API type, a prompt is constructed to indicate the API parameter prediction task. The prompt includes system instructions describing the API parameter prediction task, an API parameter template, field descriptions in the API parameter template, and the user question.

[0219] Preferably, the API prediction parameter labels include differential API prediction parameter labels;

[0220] Acquisition unit 501 is specifically used for:

[0221] The difference between the original labeled API prediction parameter label and the API parameter template in the API details information associated with the predicted API type is obtained;

[0222] Preferably, the calculation unit 504 is specifically used for:

[0223] A second loss is calculated between the difference API prediction parameter label and the prediction API parameter using a preset loss function.

[0224] The functions of the above-mentioned units are similar to those described in the training method embodiment, and will not be repeated here.

[0225] In this embodiment, user questions in a preset domain and API parameters invoked in response to user questions in the preset domain are used as training sets to fine-tune the API classification model and the API parameter prediction model. This reduces the amount of training and improves the convenience of obtaining the trained API classification model and the trained API parameter prediction model. It also improves the accuracy of the API parameters output by the trained API model when outputting API parameters in the corresponding domain.

[0226] The prediction device for the API interface is described below; please refer to [link / reference]. Figure 6 One embodiment of the prediction device for the API interface in this application includes:

[0227] The input unit 601 is used to input user questions into the API classification model to obtain the predicted API type output by the API classification model;

[0228] Construction unit 602 is used to construct the prompts required for API parameter prediction based on the API type and the user question;

[0229] The input unit 601 is also used to input the prompt into the API parameter prediction model to obtain the predicted API parameters output by the API parameter prediction model.

[0230] The determining unit 603 is used to determine the prediction API type and the prediction API parameters as the API prediction result.

[0231] Preferably, the input unit 601 is further used for:

[0232] The predicted API type is input into the API prior knowledge base to query API details associated with the predicted API type. The API details include the API's functional description, API parameter template, and field descriptions in the API parameter template. The API prior knowledge base stores a large number of APIs and their details.

[0233] Construction unit 602 is specifically used for:

[0234] Based on the user question and the API details associated with the prediction API type, a prompt is constructed to indicate the API parameter prediction task. The prompt includes system instructions describing the API parameter prediction task, an API parameter template, field descriptions in the API parameter template, and the user question.

[0235] Preferably, the device further includes:

[0236] The fusion unit 604 is used to fuse the predicted API parameters with the API parameter template to obtain fused predicted API parameters. The fusion process includes:

[0237] The parameter fields in the predicted API parameters are compared one by one with the parameter fields in the API parameter template. If the field value of the predicted API parameter field is different from the default value of the parameter field in the API parameter template, the default value of the parameter field in the API parameter template is replaced with the field value of the predicted API parameter field, and the API parameter template after the parameter replacement is determined as the fused predicted API parameters.

[0238] This application provides a detailed description of the API interface prediction device. Furthermore, this application utilizes a pre-trained API prediction model to output the predicted API type and predicted API parameters. Since the pre-trained API prediction model is trained using a training set from a preset domain, the accuracy of the API parameters output by the API prediction model is higher when a user question from the preset domain is input.

[0239] This application also provides a computer program product having a computer program stored thereon. When the computer program is executed by a processor, it is used to implement the method described in the above-described API prediction model training method embodiment, or to implement the method described in the above-described API interface prediction method embodiment.

[0240] The training device for the API prediction model and the prediction device for the API interface in this embodiment of the invention have been described above from the perspective of modular functional entities. The computer device in this embodiment of the invention is described below from the perspective of hardware processing. Please refer to [link / reference]. Figure 7 The computer device 700 in this application embodiment includes:

[0241] One or more central processing units (CPUs) 701 and memory 705, wherein one or more application programs or data are stored in memory 705.

[0242] The memory 705 can be volatile or persistent storage. The program stored in the memory 705 can include one or more modules, each module including a series of instruction operations on the server. Furthermore, the central processing unit 701 can be configured to communicate with the memory 705 and execute the series of instruction operations stored in the memory 705 on the computer device 700.

[0243] The computer device 700 may also include one or more power supplies 702, one or more wired or wireless network interfaces 703, one or more input / output interfaces 704, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0244] The central processing unit 701 can execute the training method described in the above-described API prediction model training method embodiment, or it can be used to implement the prediction method described in the above-described API interface prediction method embodiment.

[0245] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the processor and memory are merely examples of a computer device and do not constitute a limitation on the computer device. It may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.

[0246] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting various parts of the computer device via various interfaces and lines.

[0247] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0248] The present invention also provides a computer-readable storage medium for implementing the functions of a training device for an API prediction model or a prediction device for an API interface. The computer program is stored thereon. When the computer program is executed by a processor, the processor can be used to execute the training method described in the above-described API prediction model training method embodiment, or to implement the prediction method described in the above-described API interface prediction method embodiment.

[0249] It is understood that if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a corresponding computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above-described method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0250] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0251] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0252] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0253] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A training method for an API prediction model, characterized in that, The API prediction model comprises an API classification model and an API parameter prediction model, the API classification model and the API parameter prediction model comprise a language representation model, and the method comprises: obtaining a training set, wherein the training set comprises user questions in a preset field and API parameters called in response to the user questions, and the API parameters at least comprise API type labels and API prediction parameter labels; inputting the user question into the API classification model to obtain a predicted API type output by the API classification model; constructing a prompt required for API parameter prediction according to the predicted API type and the user question; inputting the prompt into the API parameter prediction model to obtain a predicted API parameter output by the API parameter prediction model; calculating a first loss between the API type label and the predicted API type and a second loss between the API prediction parameter label and the predicted API parameter by using a preset loss function; fine-tuning parameters of the API classification model by using a back propagation algorithm and the first loss until the API classification model converges; fine-tuning parameters of the API parameter prediction model by using a back propagation algorithm and the second loss until the API parameter prediction model converges; or, fine-tuning the parameters of the API classification model and the parameters of the API parameter prediction model by using a sum of the first loss and the second loss and a back propagation algorithm until the API classification model and the API parameter prediction model converge.

2. The method of claim 1, wherein, After obtaining the predicted API type output by the API classification model, the method further comprises: inputting the predicted API type into an API priori knowledge base to query API detail information associated with the predicted API type, wherein the API detail information comprises a function description of an API, a parameter template of the API, and field descriptions in the API parameter template, and a large number of APIs and the API detail information are stored in the API priori knowledge base; constructing a prompt required for API parameter prediction according to the predicted API type and the user question, comprising: constructing a prompt required for API parameter prediction according to the user question and the API detail information associated with the predicted API type, wherein the prompt comprises a system instruction describing an API parameter prediction task, an API parameter template, field descriptions in the API parameter template, and the user question.

3. The method according to claim 1 or 2, characterized in that, The API prediction parameter label comprises a differential API prediction parameter label; obtaining the differential API prediction parameter label, comprising: differencing an originally labeled API prediction parameter label and an API parameter template in API detail information associated with the predicted API type to obtain the differential API prediction parameter label; the method for calculating the second loss between the API prediction parameter label and the predicted API parameter by using a preset loss function, comprising: calculating, by using a preset loss function, a second loss between the difference API prediction parameter label and the predicted API parameter.

4. A method of predicting an API interface, characterized by, The method is applied to the API prediction model of claim 1, and the method comprises: inputting a user question in a preset field into an API classification model to obtain a predicted API type output by the API classification model; constructing a prompt required for API parameter prediction according to the API type and the user question; inputting the prompt into an API parameter prediction model to obtain a predicted API parameter output by the API parameter prediction model; determining the predicted API type and the predicted API parameter as an API prediction result.

5. The prediction method of claim 4, wherein, The method is applied to the API prediction model of claim 2 or 3, and after obtaining the predicted API type output by the API classification model, the method further comprises: inputting the predicted API type into an API priori knowledge base to query API detail information associated with the predicted API type, wherein the API detail information comprises a function description of an API, a parameter template of the API, and field description in the API parameter template, and the API priori knowledge base stores a large number of APIs and the API detail information; constructing a prompt required for API parameter prediction according to the predicted API type and the user question, comprising: constructing a prompt required for API parameter prediction according to the user question and the API detail information associated with the predicted API type, wherein the prompt comprises a system instruction describing an API parameter prediction task, an API parameter template, field description in the API parameter template, and the user question.

6. The prediction method of claim 4 or 5, characterized in that, After obtaining the predicted API parameter, the method further comprises: fusing the predicted API parameter with an API parameter template to obtain a fused predicted API parameter, wherein the fusion process comprises: comparing parameter fields in the predicted API parameter with parameter fields in the API parameter template one by one, if a field value of a predicted API parameter field is different from a default value of a parameter field in the API parameter template, replacing the default value of the parameter field in the API parameter template with the field value of the predicted API parameter field, and determining the API parameter template after the replacement of the parameter as the fused predicted API parameter. 7.A device for training an API prediction model, comprising: The API prediction model comprises an API classification model and an API parameter prediction model, and the API classification model and the API parameter prediction model comprise a large language model, and the device comprises: an acquisition unit configured to acquire a training set, wherein the training set comprises a user question and an API parameter called in response to the user question, and the API parameter at least comprises an API type label and an API prediction parameter label; an input unit configured to input the user question into the API classification model to obtain a predicted API type output by the API classification model; a construction unit configured to construct a prompt required for API parameter prediction according to the predicted API type and the user question; and an input unit configured to input the prompt into an API parameter prediction model to obtain a predicted API parameter output by the API parameter prediction model. The input unit is further configured to input the prompt into the API parameter prediction model to obtain a predicted API parameter output by the API parameter prediction model. The computing unit is configured to calculate a first loss between the API type label and the predicted API type and a second loss between the API parameter prediction label and the predicted API parameter by using a preset loss function. The fine-tuning unit is configured to fine-tune parameters of the API classification model by using a back propagation algorithm and the first loss until the API classification model converges, and fine-tune parameters of the API parameter prediction model by using the back propagation algorithm and the second loss until the API parameter prediction model converges. Or, The fine-tuning unit is configured to fine-tune the parameters of the API classification model and the parameters of the API parameter prediction model by using a sum of the first loss and the second loss and a back propagation algorithm until the API classification model and the API parameter prediction model converge.

8. A prediction apparatus of an API interface, characterized by, The device of claim 7, the device comprises: The input unit is configured to input a user question into an API classification model to obtain a predicted API type output by the API classification model. The constructing unit is configured to construct a prompt required for API parameter prediction according to the API type and the user question. The input unit is further configured to input the prompt into an API parameter prediction model to obtain a predicted API parameter output by the API parameter prediction model. The determining unit is configured to determine the predicted API type and the predicted API parameter as an API prediction result.

9. A computer apparatus comprising a processor, characterised in that, The processor, when executing a computer program stored on the memory, is configured to implement the training method of the API prediction model according to any one of claims 1 to 3, or implement the prediction method of the API interface according to any one of claims 4 to 6.

10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, is configured to implement the training method of the API prediction model according to any one of claims 1 to 3, or implement the prediction method of the API interface according to any one of claims 4 to 6.

11. A computer program product having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, is configured to implement the training method of the API prediction model according to any one of claims 1 to 3, or implement the prediction method of the API interface according to any one of claims 4 to 6.