Model calling method, system and equipment based on API engine and storage medium

Parameter conversion and permission verification are performed when the API interface is called through the API task engine through the API task engine, which solves the problem of lack of permission control in the existing technology and improves the information security and reliability during the API call process.

CN119513843APending Publication Date: 2025-02-25CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411664237.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The prior art lacks permission control over the calling process and interactive data when calling API interfaces in large models, resulting in low information security and reliability, and may have problems such as overprivileged access, sensitive data leakage and circular calls.

Method used

Receive request parameters of the big model through the API task engine, convert and verify, ensure that the parameter format meets the API reception requirements, and authenticate identity and data through encapsulated access rights to prevent unauthorized access and data leakage.

Benefits of technology

It realizes verification and interception of access permissions and data permissions during API calls, prevents overprivileged access and sensitive data leakage, and improves the reliability of information security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513843A_ABST
    Figure CN119513843A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of artificial intelligence and financial science and technology, and relates to a model calling method, system and device based on an API engine and a storage medium, and the method comprises the steps: transmitting a request parameter to an API task engine through a large model, and converting the request parameter based on a conversion rule to obtain a first target request parameter; packaging the access authority based on an API task engine to verify the first target request parameter; and if verification succeeds, calling a target API through an API task engine to obtain target data according to the first target request parameter, and returning the target data to the large model after conversion based on a conversion rule. In addition, the invention also relates to a block chain technology, and the called data can be stored in a block chain. The method can be applied to an API interface calling scene in the financial field, and the API task engine is used for converting and verifying the request parameters, so that the safety and reliability of data calling and the interface calling efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of artificial intelligence and financial technology, and in particular to a model calling method, system, device and storage medium based on an API engine. Background Art

[0002] With the rise of artificial intelligence technology, there are more and more scenarios where big models call API interfaces to enhance the capabilities of big models. For example, in the field of financial technology, various business information can be learned based on artificial intelligence models, so that the model can obtain relevant information in the business field; when applied in human-computer interaction, it can provide comprehensive and detailed target data to staff. However, although there are many ways for big models to call API capabilities, none of them can solve the information security issues generated during the API call process.

[0003] In the current method of calling API interfaces by large models, the calling end API operating environment is usually generated first, and then the API call request and the calling end API operating environment are sent to the API processing end, so that the API processing end processes the API call request through the calling end API operating environment, obtains the API call response corresponding to the API call request, and receives the API call response corresponding to the API call request sent by the API processing end. However, such an API interface calling method does not take into account issues such as data access rights and sensitivity. There may be a situation where the large model calls the core business, resulting in unauthorized access, thereby causing traffic impact on the core business and causing downtime, or obtaining sensitive data, and there may even be a situation where the large model is induced to make circular calls, resulting in low information security and reliability during the calling process. Summary of the invention

[0004] The purpose of the embodiments of the present application is to propose a model calling method based on an API engine to solve the problem that the prior art lacks permission control over the calling process and interactive data, resulting in low information security and reliability of the calling process.

[0005] In order to solve the above technical problems, the embodiment of the present application provides a model calling method based on an API engine, which adopts the following technical solution:

[0006] Passing the request parameters to the API task engine through the big model, converting the request parameters based on the conversion rules in the API task engine to obtain the first target request parameters;

[0007] Encapsulating the access rights based on the API task engine, and verifying the first target request parameter according to the encapsulated access rights;

[0008] If the verification is successful, based on the first target request parameter, the target API is called by the API task engine to obtain the target data;

[0009] The target data is converted based on the conversion rule to obtain target response data, and the target response data is returned to the large model.

[0010] Furthermore, the request parameters are passed to the API task engine through the big model, and the request parameters are converted based on the conversion rules in the API task engine, including:

[0011] Presetting a first key field based on the call requirement, and comparing the request parameter with the first key field;

[0012] If the comparison is successful, the API task engine is used to check the data type of each parameter in the request parameter;

[0013] If the data type of each parameter in the request parameter satisfies the data type of the target API, converting the request parameter based on the conversion rule in the API task engine to obtain the first target request parameter;

[0014] If the comparison fails or there are parameters in the request parameters that do not meet the preset conditions of the data type of the target API, an error prompt message is responded.

[0015] Further, the access rights include user access authentication, and the verifying the first target request parameter according to the encapsulated access rights includes:

[0016] Based on the encapsulated user access authentication, identity authentication is performed according to the user identity identifier in the first target request parameter;

[0017] If the verification fails, respond with an error message;

[0018] If the verification is successful, the target data is acquired by calling the target API through the API task engine based on the first target request parameter.

[0019] Furthermore, the access permission also includes data authentication, and the acquiring of target data by calling the target API through the API task engine based on the first target request parameter includes:

[0020] If the verification is successful, then judging whether the request parameters contain sensitive data based on the encapsulated data authentication;

[0021] If the sensitive data is included, determining whether the user has the right to access the sensitive data based on the user's permission information in the request parameter;

[0022] If the user has the right to access the sensitive data, the sensitive data is encrypted based on the desensitizing filter encapsulated by the API task engine to obtain the first target request parameter, and the target data is obtained by calling the target API through the API task engine.

[0023] Further, the target data is converted based on the conversion rule to obtain target response data, and the target response data is returned to the large model, including:

[0024] Presetting a second key field based on the response requirement, and performing field matching between the target data and the second key field;

[0025] If the field match is successful, the target data is converted based on the conversion rule to obtain target response data, and the target response data is returned to the large model.

[0026] Further, after matching the target data with the second key field, the method further includes:

[0027] If the field matching fails, an error report is generated based on the API task engine and returned to the target API;

[0028] Calling the API task engine based on the target API to obtain the calling frequency of the target API, and determining whether to perform current limiting processing according to the calling frequency;

[0029] If current limiting processing is performed, the current limiting mechanism is triggered, and based on the current limiting mechanism, the target API is called by the API task engine to obtain the target data.

[0030] Further, the step of acquiring the calling frequency of the target API by calling the API task engine based on the target API, and determining whether to perform current limiting processing according to the calling frequency, includes:

[0031] Based on the API task engine monitoring and counting the user's access requests, obtaining the calling frequency of the target API;

[0032] If the calling frequency exceeds the access frequency threshold, current limiting processing is performed.

[0033] In order to solve the above technical problems, the embodiment of the present application further provides a model calling system based on an API engine, the system comprising:

[0034] A conversion module, used to pass the request parameters to the API task engine through the big model, and convert the request parameters based on the conversion rules in the API task engine to obtain the first target request parameters;

[0035] A verification module, used to encapsulate access rights based on the API task engine, and verify the first target request parameter according to the encapsulated access rights;

[0036] A calling module, configured to, if the verification is successful, call the target API through the API task engine based on the first target request parameter to obtain target data;

[0037] The sending module is used to convert the target data based on the conversion rule to obtain target response data, and return the target response data to the large model.

[0038] In order to solve the above technical problems, an embodiment of the present application also provides an electronic device, including a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, the memory and the processor communicate through the communication bus and the communication interface, and the processor implements the steps of the API engine-based model calling method when executing the computer program.

[0039] In order to solve the above technical problems, an embodiment of the present application also provides a storage medium having a non-volatile program code executable by a processor, wherein the program code enables the processor to execute the steps of the model calling method based on the API engine.

[0040] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0041] This application receives the request parameters of the big model through the API task engine, and converts it through the conversion rules to obtain the first target request parameters, ensuring that the parameter format meets the API reception requirements and avoiding API call failures caused by data type mismatch; converting the request parameters to the format required by the target API to ensure the compatibility of the request parameters with the target API; encapsulating the access rights through the API task engine, and verifying the first target request parameters according to the encapsulated access rights, to implement access rights and data authority verification interception during the API call process, to prevent the big model from calling the core business to achieve unauthorized access, to prevent the big model from obtaining sensitive data, and to obtain the original text of sensitive data; based on the verified first target request parameter, calling the target API to obtain the target data, and again converting the target data through the conversion rules and returning it to the big model, to ensure that the returned data meets the call requirements. It can be seen that this application can improve the security and reliability of data during the call process. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are 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.

[0043] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0044] Figure 2 A flowchart of an embodiment of a model calling method based on an API engine according to the present application;

[0045] Figure 3 is a flowchart of another embodiment of the model calling method based on the API engine of the present application;

[0046] Figure 4 It is a structural diagram of an embodiment of a model calling system based on an API engine according to the present application;

[0047] Figure 5 It is a schematic structural diagram of an embodiment of an electronic device according to the present application. DETAILED DESCRIPTION

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

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

[0050] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0051] like Figure 1As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0052] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0053] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.

[0054] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0055] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0056] It should be noted that the model calling method based on the API engine provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the data query device based on multi-level media is generally set in the server / terminal device.

[0057] Continue to refer Figure 2 , shows a flowchart of an embodiment of the model calling method based on the API engine according to the present application. According to different requirements, the order of the steps in the flowchart can be changed. The model calling method based on the API engine provided in the embodiment of the present application can be applied to any scenario where an API interface call is required to obtain target data.

[0058] like Figure 2As shown, the model calling method based on the API engine includes the following steps:

[0059] Step S201: pass the request parameters to the API task engine through the big model, convert the request parameters based on the conversion rules in the API task engine, and obtain the first target request parameters.

[0060] In this embodiment, there may be inconsistencies in parameter formats between the big model and the target API. Through the conversion rules in the API task engine, the parameter format used by the big model can be converted into a format that the target API can understand and accept, and the first target request parameter is obtained. This ensures the compatibility and accuracy of data during the transmission process. The existence of the conversion rules makes it unnecessary for the big model to directly understand the specific parameter format requirements of the target API, thereby simplifying the complexity of the API call.

[0061] In one possible implementation, the method provided in the present application can be used in the financial field, and the API interface called by the large model calling method can be various program interfaces in the financial platform, such as banking software, securities software, tax rate program and other interfaces.

[0062] Step S202: Encapsulate the access rights based on the API task engine, and verify the first target request parameters according to the encapsulated access rights.

[0063] In this embodiment, by encapsulating access rights, the API task engine can perform strict identity authentication on the first target request parameter, ensuring that only users with legitimate identities can access the API, thereby effectively preventing unauthorized access and data leakage.

[0064] In some examples, encapsulated access rights can be flexibly configured and adjusted according to actual needs. For example, different access rights can be assigned to different users or user groups to meet security requirements in different scenarios. When authentication fails, the API task engine can immediately respond to error messages, which helps the large model to detect problems in time and take corresponding measures to avoid invalid requests from continuing to be processed or leading to more serious consequences.

[0065] Step S203: If the verification is successful, based on the first target request parameter, the target API is called by the API task engine to obtain the target data.

[0066] In this embodiment, the API task engine further executes the call to the target API to obtain the target data only after the first target request parameter is verified in the encapsulated access rights. Since not all the data of the target API is open to the external interface, and the data has distinguishing features such as level and sensitivity, it is necessary to verify the relevant data access rights of the first target request parameter of the large model before calling the target API to ensure that only users with legal identities can access the API, thereby effectively preventing unauthorized access and data leakage.

[0067] Step S204: transform the target data based on the transformation rule to obtain target response data, and return the target response data to the large model.

[0068] In this embodiment, the parameter format of the data provided by the target API is converted into a format that can be recognized and processed by the big model through the conversion rules in the API task engine, solving the problem of inconsistent parameter formats between the big model and the target API. This ensures the compatibility and accuracy of the data during the transmission process, avoids the inability of the big model to obtain the target data due to incompatible data formats, and further ensures that the API task engine successfully completes the call to the target API, so as to feedback an effective response to the big model, and improves the flexibility and adaptability of the API task engine.

[0069] In an embodiment of the present invention, the request parameters of the big model are received through the API task engine, and converted through conversion rules to obtain the first target request parameters, ensuring that the parameter format meets the reception requirements of the API, avoiding API call failures caused by data type mismatch; converting the request parameters to the format required by the target API, ensuring the compatibility of the request parameters with the target API; encapsulating the access rights through the API task engine, verifying the first target request parameters according to the encapsulated access rights, and implementing access rights and data authority verification interception during the API call process, preventing the big model from calling the core business to achieve unauthorized access, preventing the big model from obtaining sensitive data, and obtaining the original text of sensitive data; calling the target API based on the verified first target request parameter to obtain the target data, and converting the target data again through the conversion rules and returning it to the big model, ensuring that the returned data meets the calling requirements. In summary, the present application can improve the security and reliability of data during the calling process.

[0070] In some optional embodiments, combined with Figure 3 As shown, the above step S201 includes:

[0071] Presetting a first key field based on the call requirement, and comparing the request parameter with the first key field;

[0072] If the comparison is successful, use the API task engine to check the data type of each parameter in the request parameters;

[0073] If the data type of each parameter in the request parameters meets the data type of the target API, convert the request parameters based on the conversion rules in the API task engine to obtain the first target request parameters;

[0074] If the comparison fails or there are parameters in the request parameters that do not meet the preset conditions of the data type of the target API, an error prompt message is responded.

[0075] In this embodiment, the large model only needs to provide request parameters according to its own habits or standards, and the conversion work is automatically completed by the API task engine. When the parameter format of the target API changes, only the conversion rules in the API task engine need to be updated, without modifying the code or logic of the large model, enhancing the flexibility and scalability of the interface call process.

[0076] Specifically, when this application is used in the banking and insurance industries, before using the API task engine to call the API business interface to obtain banking and insurance-related business data, the request parameters are compared through a preset first keyword field to ensure the integrity and correctness of the request parameters. If the comparison fails, an error prompt message is immediately responded to avoid continued processing of invalid requests.

[0077] In this embodiment, by checking the data type of each parameter in the request parameters, ensuring that the parameter format meets the receiving requirements of the API helps to avoid API call failures caused by data type mismatches. According to the conversion rules in the API task engine, the request parameters are converted into the format required by the target API, ensuring the compatibility between the request parameters and the target API. Since the large model needs to obtain different data based on different business scenarios, there are cases where multiple different target API interfaces are called to obtain data, and the data attributes responded by different API interfaces are different. Therefore, necessary formatting of the request parameters can be performed through the conversion rules to ensure that they meet the input requirements of the target API, enabling the large model to more conveniently call different APIs without caring about the specific implementation details of each API, which helps to improve the quality of data and the success rate of API calls.

[0078] Furthermore, the response messages of many interfaces are various. In this embodiment, the response messages are uniformly standardized, that is, only the results of the call are processed with a unified message, and the results themselves will not change. For example, if the original interface returns {"xingming":"张三","xiebie":"男"}, after unified conversion, it becomes: {"name":"张三","sex":"男"}.

[0079] In this embodiment, by converting the response data into the format required by the big model, it can be ensured that the response data meets the calling requirements of the big model; the response data is normalized through the conversion rules in the API task engine, so that the big model can be compatible with the request responses of different API interfaces, and different APIs can be called more conveniently and flexibly without changing the data conversion method. When the parameter format of the target API changes, it is only necessary to update the conversion rules in the API task engine without modifying the code or logic of the big model, thereby enhancing the flexibility and scalability of the interface calling process.

[0080] In some optional embodiments, before step S201, the method further includes:

[0081] Based on the request parameters, determine whether the API dependency is defined based on the call requirements. If so, return the target response data to the big model based on the API dependency; if not, execute the step S201.

[0082] Furthermore, if yes, the target response data is returned to the big model based on the API dependency, including:

[0083] Based on the API dependency, executing the step S202 and the step S203 to obtain the target data;

[0084] Determine whether the target data meets the parameter format in the API dependency. If so, execute step S204; if not, use the target data as the first target request parameter, and continue to determine whether the target data meets the parameter format in the API dependency after executing step S203.

[0085] In this embodiment, by analyzing the request parameters, it is possible to dynamically determine whether it is necessary to define API dependencies based on the calling requirements, thereby allowing the use of the API to be adjusted according to actual needs without having to fix it during the development phase, thereby improving the flexibility of API interface selection; after obtaining the target data, if the target data does not meet the preset requirements, the target data can be used as the first target request parameter for verification to ensure that it meets the preset requirements in the API dependency, thereby ensuring the accuracy and consistency of the data.

[0086] In some optional embodiments, the access rights include user access authentication, combined with Figure 3 As shown, in the above step S202, the verification of the first target request parameter according to the encapsulated access rights includes:

[0087] Based on the encapsulated user access authentication, identity authentication is performed according to the user identity identifier in the first target request parameter;

[0088] If the verification fails, respond with an error message;

[0089] If the verification is successful, the target data is acquired by calling the target API through the API task engine based on the first target request parameter.

[0090] In this embodiment, by encapsulating access rights, the API task engine can perform strict identity authentication on the first target request parameter, ensuring that only users with legitimate identities can access the API, thereby effectively preventing unauthorized access and data leakage. As an intermediate layer, the API task engine can uniformly manage and maintain user access authentication logic, making authority management more centralized and efficient, and reducing security risks and maintenance costs caused by decentralized management. By encapsulating access rights in the API task engine, rapid verification of request parameters can be achieved, reducing delays in the verification process, and improving the response speed and overall efficiency of API calls. For large models, there is no need to directly process complex identity authentication logic. Instead, the request parameters only need to be passed to the API task engine, which will perform verification based on the encapsulated access rights, simplifying the calling logic of the large model and allowing it to focus more on the implementation of core functions.

[0091] In some optional embodiments, the access permission also includes data authentication, combined with Figure 3 As shown, the above step S203 includes:

[0092] If the verification is successful, then judging whether the request parameters contain sensitive data based on the encapsulated data authentication;

[0093] If the sensitive data is included, determining whether the user has the right to access the sensitive data based on the user's permission information in the request parameter;

[0094] If the user has the right to access the sensitive data, the sensitive data is encrypted based on the desensitizing filter encapsulated by the API task engine to obtain the first target request parameter, and the target data is obtained by calling the target API through the API task engine.

[0095] In this embodiment, through access authentication and data authentication, the API task engine can determine whether the request parameters contain sensitive data, and further determine whether the big model has the right to access these data based on the user's permission information, ensuring that only those with corresponding permissions can access sensitive data, thereby effectively preventing data leakage and abuse, preventing the big model from calling core businesses to achieve unauthorized access, and preventing the big model from arbitrarily obtaining sensitive data; encrypting sensitive data through desensitizing filters can ensure the security of these data during transmission and storage. By encapsulating desensitizing filters in the API task engine, unified processing and management of sensitive data can be achieved to prevent the big model from obtaining the original sensitive data.

[0096] In some optional embodiments, combined with Figure 3 As shown, the above step S204 includes:

[0097] Presetting a second key field based on the response requirement, and performing field matching between the target data and the second key field;

[0098] If the field match is successful, the target data is converted based on the conversion rule to obtain target response data, and the target response data is returned to the large model.

[0099] In this embodiment, the second key field is a parameter attribute of the response data that can be recognized by the large model, and the second key field at least includes data length, data type, and data unique identifier. If the target data fails to match the second key field, a data response exception may occur, responding to wrong data information, for example, the data unique identifier is different.

[0100] In this embodiment, by presetting the second key field for comparison with the target data, it can be ensured that the target data meets specific response requirements, avoiding erroneous responses due to data errors or non-compliance with expectations, and improving the timeliness of API interface responses and the effectiveness of data responses.

[0101] In some optional embodiments, combined with Figure 3 As shown, after the target data is matched with the second key field, the method further includes:

[0102] If the field matching fails, an error report is generated based on the API task engine and returned to the target API;

[0103] Calling the API task engine based on the target API to obtain the calling frequency of the target API, and determining whether to perform current limiting processing according to the calling frequency;

[0104] If current limiting processing is performed, the current limiting mechanism is triggered, and based on the current limiting mechanism, the target API is called by the API task engine to obtain the target data.

[0105] Further, the step of acquiring the calling frequency of the target API by calling the API task engine based on the target API, and determining whether to perform current limiting processing according to the calling frequency, includes:

[0106] Based on the API task engine monitoring and counting the user's access requests, obtaining the calling frequency of the target API;

[0107] If the calling frequency exceeds the access frequency threshold, current limiting processing is performed.

[0108] In this embodiment, when the comparison fails, the API task engine can generate an error report and obtain the call frequency through the target API, and then determine whether to perform current limiting processing to prevent the large model from being induced to make circular calls, thereby ensuring that no traffic impact is caused to the core business.

[0109] In this embodiment, by monitoring and counting the user's access requests, the frequency of the large model calling the target API through the API task engine can be obtained. If the call frequency exceeds the access frequency threshold, the subsequent access to the large model should be restricted or even prohibited to ensure that the large model does not have abnormal access and does not cause data anomalies and data security issues. Therefore, when the call frequency exceeds the access frequency threshold, the current limiting mechanism is triggered. The current limiting mechanism includes but is not limited to delaying access requests, rejecting access requests, and generating access lower limits to limit the number of accesses, thereby limiting the frequent sending of errors or invalid requests for the large model. This mechanism can effectively solve the problem of induced circular calls of large models, resulting in traffic impact on core businesses and causing downtime.

[0110] In some examples, the current limiting threshold and current limiting mechanism can be adjusted according to actual conditions to meet the needs of different scenarios.

[0111] As a possible implementation method, a counter is maintained to record the number of accesses of each client or application within a period of time. When the counter reaches a threshold, a current limiting mechanism is triggered to reject the client or application's request, delay the client or application's request, or return error request information, etc. Among them, according to the time of the client or application access, including a natural month, a natural day, or a certain time interval, the access time is divided into peak period, off-peak period and off-peak period, and different access thresholds are set according to different peak periods. For example, the peak access threshold is the largest, and the access thresholds of the off-peak period and the off-peak period decrease in turn. This is to control the rationality of the access flow and avoid causing load.

[0112] As another possible implementation, the access time is divided into multiple time windows, and the number of accesses in each window is counted respectively. The access frequency can be controlled more finely through the sliding window algorithm.

[0113] In this embodiment, current limiting not only helps control server overload, but also improves the overall service quality. Through a reasonable current limiting mechanism, it can ensure that each request can be processed promptly and effectively, avoiding problems such as response delays and request losses caused by server overload. At the same time, current limiting can also effectively prevent malicious attacks and crawler behaviors, and protect the security and integrity of business data.

[0114] As a specific implementation, the configuration rules of the API task engine include:

[0115] (1) Configure the target API basic connection information, including: the target API ID, business type, model code, large model robot name, API service code, API request method, API function description, request parameter shaping template, response parameter shaping template, etc. Among them, the business type can be configured for the business field, and the business field configuration is used to isolate different businesses, such as C-end and employee-end; the model code can determine which large model robot is developed for; the response parameter shaping template is used to shape non-standard response messages into a unified response message mode;

[0116] (2) Configure the API request parameter list, including: parameter ID, API corresponding to the parameter, parameter code, parameter name, parameter type, parameter source location, etc.;

[0117] (3) Configure the API response parameter list, including: parameter ID, API corresponding to the parameter, parameter code, parameter name, parameter type, parameter source location, expression for extracting parameters, etc.

[0118] In an embodiment of the present invention, the request parameter of the big model is received by the API task engine, and is converted through the conversion rule to obtain the first target request parameter, ensuring that the parameter format meets the reception requirements of the API, avoiding API call failure caused by data type mismatch, and converting the request parameter into the format required by the target API, ensuring the compatibility of the request parameter with the target API; the access rights are encapsulated by the API task engine, and the first target request parameter is verified according to the encapsulated access rights, so as to implement access rights and data authority verification interception during the API call process, prevent the big model from calling the core business to achieve unauthorized access, prevent the big model from obtaining sensitive data, and prevent the big model from obtaining the original text of sensitive data; based on the verified first target request parameter, the target API is called to obtain the target data, and the target data is converted again through the conversion rule and returned to the big model, ensuring that the returned data meets the call requirements; at the same time, the flow limiting and degradation processing are implemented during the API call process, so as to avoid the big model from making circular calls, thereby avoiding the flow impact on the core business and causing downtime. It simplifies the security complexity, traffic control complexity, and message specification complexity in the API calling process, solves the problem of insecure calling process information and uncontrollable traffic due to the lack of permission control over the calling process and interactive data, and significantly improves the security, reliability, and efficiency of API interface calls.

[0119] It should be emphasized that in order to further ensure the privacy and security of the data retrieved by the above request, it can also be stored in a node of a blockchain. The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain (Block chain) is essentially a decentralized database. It is a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0120] The embodiments of the present application can call and process the relevant target API based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0121] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0122] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0123] Further references Figure 4 , as a response to the above Figure 2 The present application provides an embodiment of a model calling system based on an API engine, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices. Figure 4 As shown, the model calling system 400 based on the API engine described in this embodiment includes:

[0124] A conversion module 401 is used to pass the request parameters to the API task engine through the big model, and convert the request parameters based on the conversion rules in the API task engine to obtain the first target request parameters;

[0125] A verification module 402, configured to encapsulate access rights based on the API task engine, and verify the first target request parameter according to the encapsulated access rights;

[0126] A calling module 403 is configured to, if the verification is successful, call the target API through the API task engine based on the first target request parameter to obtain target data;

[0127] The sending module 404 is used to convert the target data based on the conversion rule to obtain target response data, and return the target response data to the large model.

[0128] In this embodiment, the operations performed by the above modules respectively correspond one-to-one to the steps of the model calling method based on the API engine in the aforementioned implementation mode, and will not be repeated here.

[0129] In some optional implementations of this embodiment, the conversion module includes:

[0130] A first comparison submodule is used to preset a first key field based on the call requirement and compare the request parameter with the first key field; a first pre-check submodule is used to use the API task engine to check the data type of each parameter in the request parameter if the comparison is successful; a first parameter conversion submodule is used to convert the request parameter based on the conversion rules in the API task engine to obtain the first target request parameter if the data type of each parameter in the request parameter meets the data type of the target API; a first error reporting submodule is used to respond with an error prompt message if the comparison fails or there are parameters in the request parameter that do not meet the preset conditions of the data type of the target API.

[0131] In some optional implementations of this embodiment, the verification module includes:

[0132] The access authentication submodule is used to perform identity authentication based on the encapsulated user access authentication and the user identity in the first target request parameter; the second error reporting submodule is used to respond with an error prompt message if the verification fails.

[0133] In some optional implementations of this embodiment, the verification module further includes:

[0134] A data authentication submodule is used to call the target API through the API task engine to obtain target data based on the first target request parameter; an analysis submodule is used to determine whether the request parameter contains sensitive data based on the encapsulated data authentication if the verification is successful; and an access submodule is used to determine whether the user has the right to access the sensitive data based on the user's permission information in the request parameter if the sensitive data is contained.

[0135] In some optional implementations of this embodiment, the calling module includes:

[0136] The first engine calls a submodule, which is used to, if the verification is successful, call the target API through the API task engine based on the first target request parameter to obtain the target data; the second engine calls a submodule, which is used to, if the user has the right to access the sensitive data, encrypt the sensitive data based on the desensitizing filter encapsulated by the API task engine to obtain the first target request parameter, and call the target API through the API task engine to obtain the target data.

[0137] In some optional implementations of this embodiment, the sending module includes:

[0138] The field matching submodule is used to preset a second key field based on the response requirements and perform field matching between the target data and the second key field; the second parameter conversion submodule is used to convert the target data based on the conversion rules if the field matching is successful, obtain target response data, and return the target response data to the large model.

[0139] In some optional implementations of this embodiment, the sending module further includes:

[0140] A current limiting analysis submodule, for generating an error report based on the API task engine and returning it to the target API if the field matching fails;

[0141] Based on the target API, the API task engine is called to obtain the calling frequency of the target API, and whether to perform current limiting processing is determined according to the calling frequency; the current limiting processing submodule is used to trigger the current limiting mechanism if current limiting processing is performed, and based on the current limiting mechanism, the target data is obtained by calling the target API through the API task engine.

[0142] In some optional implementations of this embodiment, the current limiting processing submodule includes:

[0143] A frequency calling unit is used to monitor and count user access requests based on the API task engine to obtain the calling frequency of the target API; a current limiting processing unit is used to perform current limiting processing if the calling frequency exceeds the access frequency threshold.

[0144] In the above optional embodiments, the operations performed by the above sub-modules, units or sub-units respectively correspond one-to-one to the steps of the model calling method based on the API engine in the aforementioned implementation method, and will not be repeated here.

[0145] To solve the above technical problems, the present application also provides an electronic device. Figure 5 , Figure 5It is a basic structural block diagram of the electronic device of this embodiment. The electronic device 5 includes a memory 51, a processor 52, and a network interface 53 that are interconnected through a system bus. It should be pointed out that the figure only shows an electronic device 5 with components 51-53, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the electronic device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0146] The electronic device 5 may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The electronic device 5 may interact with the user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0147] The memory 51 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 51 can be an internal storage unit of the electronic device 5, such as a hard disk or memory of the electronic device 5. In other embodiments, the memory 51 can also be an external storage device of the electronic device 5, such as a plug-in hard disk equipped on the electronic device 5, a smart memory card (Smart Media Card, SMC), etc. Of course, the memory 51 can also include both the internal storage unit of the electronic device 5 and its external storage device. In this embodiment, the memory 51 is generally used to store the operating system and various application software installed on the electronic device 5, such as computer-readable instructions of the model calling method based on the API engine, etc.

[0148] The processor 52 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 52 is generally used to control the overall operation of the electronic device 5. In this embodiment, the processor 52 is used to run computer-readable instructions stored in the memory 51 or process data, such as computer-readable instructions for running the model calling method based on the API engine.

[0149] The network interface 53 may include a wireless network interface or a wired network interface. The network interface 53 is generally used to establish a communication connection between the electronic device 5 and other electronic devices.

[0150] The present application also provides another implementation, namely, providing a storage medium having a non-volatile program code executable by a processor, wherein the storage medium stores computer-readable instructions, and the program code enables the processor to execute the steps of the model calling method based on the API engine as described above.

[0151] The non-Company software tools or components appearing in the embodiments of this application are merely examples and do not represent actual use.

[0152] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), including a number of instructions for a terminal device to execute the method steps described in each embodiment of the present application.

[0153] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. The model calling method based on API engine is characterized by: The steps include: Passing the request parameters to the API task engine through the big model, converting the request parameters based on the conversion rules in the API task engine to obtain the first target request parameters; Encapsulating the access rights based on the API task engine, and verifying the first target request parameter according to the encapsulated access rights; If the verification is successful, based on the first target request parameter, the target API is called by the API task engine to obtain the target data; The target data is converted based on the conversion rule to obtain target response data, and the target response data is returned to the large model.

2. The model calling method based on the API engine according to claim 1, characterized in that: The step of passing the request parameters to the API task engine through the large model and converting the request parameters based on the conversion rules in the API task engine includes: Presetting a first key field based on the call requirement, and comparing the request parameter with the first key field; If the comparison is successful, the API task engine is used to check the data type of each parameter in the request parameter; If the data type of each parameter in the request parameter satisfies the data type of the target API, converting the request parameter based on the conversion rule in the API task engine to obtain the first target request parameter; If the comparison fails or there are parameters in the request parameters that do not meet the preset conditions of the data type of the target API, an error prompt message is responded.

3. The model calling method based on the API engine according to claim 1, characterized in that: The access permission includes user access authentication, and the verifying the first target request parameter according to the encapsulated access permission includes: Based on the encapsulated user access authentication, identity authentication is performed according to the user identity identifier in the first target request parameter; If the verification fails, respond with an error message; If the verification is successful, the target data is acquired by calling the target API through the API task engine based on the first target request parameter.

4. The model calling method based on the API engine according to claim 1, characterized in that: The access permission also includes data authentication, and the acquiring of target data by calling the target API through the API task engine based on the first target request parameter includes: If the verification is successful, then judging whether the request parameters contain sensitive data based on the encapsulated data authentication; If the sensitive data is included, determining whether the user has the right to access the sensitive data based on the user's permission information in the request parameter; If the user has the right to access the sensitive data, the sensitive data is encrypted based on the desensitizing filter encapsulated by the API task engine to obtain the first target request parameter, and the target data is obtained by calling the target API through the API task engine.

5. The model calling method based on the API engine according to any one of claims 1 to 4, characterized in that: The step of converting the target data based on the conversion rule to obtain target response data, and returning the target response data to the large model includes: Presetting a second key field based on the response requirement, and performing field matching between the target data and the second key field; If the field match is successful, the target data is converted based on the conversion rule to obtain target response data, and the target response data is returned to the large model.

6. The model calling method based on the API engine according to claim 5, characterized in that: After the target data is field matched with the second key field, the method further includes: If the field matching fails, an error report is generated based on the API task engine and returned to the target API; Calling the API task engine based on the target API to obtain the calling frequency of the target API, and determining whether to perform current limiting processing according to the calling frequency; If current limiting processing is performed, the current limiting mechanism is triggered, and based on the current limiting mechanism, the target API is called by the API task engine to obtain the target data.

7. The model calling method based on the API engine according to claim 6, characterized in that: The step of calling the API task engine based on the target API to obtain a calling frequency of the target API, and determining whether to perform current limiting processing according to the calling frequency, includes: Based on the API task engine monitoring and counting the user's access requests, obtaining the calling frequency of the target API; If the calling frequency exceeds the access frequency threshold, current limiting processing is performed.

8. The model calling system based on API engine is characterized by: The system comprises: A conversion module, used to pass the request parameters to the API task engine through the big model, and convert the request parameters based on the conversion rules in the API task engine to obtain the first target request parameters; A verification module, used to encapsulate access rights based on the API task engine, and verify the first target request parameter according to the encapsulated access rights; A calling module, configured to, if the verification is successful, call the target API through the API task engine based on the first target request parameter to obtain target data; The sending module is used to convert the target data based on the conversion rule to obtain target response data, and return the target response data to the large model.

9. An electronic device, comprising a memory, a processor, a communication interface and a communication bus, wherein the memory stores a computer program that can be run on the processor, and the memory and the processor communicate through the communication bus and the communication interface, characterized in that: When the processor executes the computer program, the model calling method based on the API engine is implemented as described in any one of claims 1 to 7.

10. A storage medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the model calling method based on the API engine as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Tool calling method and device, equipment, medium and program product

    CN120915580A