API intelligent selection and business process calling method and device based on large model
Through the intelligent selection of APIs and business process calling methods based on big models, the problems of low efficiency of traditional API calls and low code generation accuracy are solved, and the automation and unified scheduling of business processes are realized, and the reliability and user experience of business code are improved. .
Patent Information
- Application Number
- CN202411116213.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-14
AI Technical Summary
Traditional business system integration and API calls rely on hard coding and manual management, which is inefficient and difficult to adapt to rapidly changing business needs. Large models have logical problems and low accuracy in process orchestration and code generation.
Using the API intelligent selection and business process call method based on big models, we can obtain service resources, build business data sets, adjust models, and combine CoT and PoT methods to optimize code generation using prompt words and feedback models to realize business Automation and unified scheduling of processes.
It improves the reliability and fluency of business code, enhances the application ability of large models in business processes, meets user needs, and improves user experience and system stability.
Smart Images

Figure CN119149014A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method, device, equipment and medium for intelligently selecting and calling a business process using an API (Application Programming Interface) based on a large model. Background Art
[0002] At present, in the era of big data, facing the ever-increasing amount of data and business complexity, enterprises need to respond quickly to policy changes and improve the automation and intelligence level of business processes.
[0003] Traditional business system integration and API (Application Programming Interface) calls often rely on hard coding and manual management, which is not only inefficient but also difficult to adapt to rapidly changing business needs. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, device, equipment and medium for intelligent API selection and business process calling based on a large model.
[0005] The present disclosure provides a method for intelligently selecting an API and calling a business process based on a large model, the method comprising:
[0006] Acquire multiple service resources in a target service scenario, and encapsulate each of the service resources according to a target format application programming interface API to obtain an API service resource pool;
[0007] Acquire historical business process call record data, and construct a business data set corresponding to the API service resource pool based on the historical business process call record data;
[0008] Adjusting the pre-trained large model based on the business data set to obtain an adjusted model;
[0009] Adjusting the adjustment model based on the pre-constructed prompt words to obtain a target model;
[0010] Receive user input question information, process the input question information based on the target model to obtain a target business code, and call one or more API service resources in the API service resource pool based on the target business code to obtain a business result and provide it to the user.
[0011] In some optional manners, encapsulating each of the service resources according to a target format application programming interface API to obtain an API service resource pool includes:
[0012] Obtaining an identifier, a communication method, and a request or response format of each of the service resources;
[0013] The identifier, communication method, and request or response format of each of the service resources are API-encapsulated to obtain the API service resource pool.
[0014] In some optional embodiments, the constructing a business data set corresponding to the API service resource pool based on the historical business process call record data includes:
[0015] Acquire multiple business process information based on the historical business process call record data;
[0016] Based on each of the business process information and the API service resource pool, obtaining a business code corresponding to each of the business process information;
[0017] A mapping relationship between the business process information and the corresponding business code is constructed based on a program thinking method to obtain the business data set.
[0018] In some optional embodiments, adjusting the pre-trained large model based on the business data set to obtain the adjusted model includes:
[0019] Acquire a text processing model based on the objective function, and process the business process information in the business data set based on the text processing model to obtain a business process vector;
[0020] The large model is trained based on the model training parameters defined by the target class to obtain a pre-trained large model, and the business code in the business data set is read based on the supervision data class;
[0021] The pre-trained large model is adjusted based on the business process vector and the business code to obtain an adjusted model.
[0022] In some optional embodiments, adjusting the adjustment model based on the pre-built prompt words to obtain the target model includes:
[0023] Acquire multiple prompt word templates based on the prompt word; wherein each of the prompt word templates includes a classification prompt word, a model output format and output information;
[0024] The user request retrieval and the corresponding prompt word template are input into the adjustment model for adjustment to obtain the target model.
[0025] In some optional embodiments, the API intelligent selection and business process calling method based on a large model further includes:
[0026] The target service code is syntax-checked by a target tool.
[0027] In some optional embodiments, the API intelligent selection and business process calling method based on a large model further includes:
[0028] Collecting feedback data from the user on the target service code;
[0029] A feedback model is constructed based on the feedback data, and positive samples and negative samples are determined based on the generated data of the feedback model to adjust the target model.
[0030] The embodiment of the present disclosure also provides an API intelligent selection and business process calling device based on a large model, the device comprising:
[0031] A first acquisition module is used to acquire multiple service resources in a target service scenario;
[0032] A packaging module, used to package each of the service resources according to a target format application programming interface API to obtain an API service resource pool;
[0033] The second acquisition module is used to obtain historical business process call record data;
[0034] A construction module, used to construct a business data set corresponding to the API service resource pool based on the historical business process call record data;
[0035] A first adjustment module, used to adjust the pre-trained large model based on the business data set to obtain an adjusted model;
[0036] A second adjustment module, used for adjusting the adjustment model based on the pre-built prompt words to obtain a target model;
[0037] A receiving and processing module is used to receive user input question information, process the input question information based on the target model, obtain a target business code, and call one or more API service resources in the API service resource pool based on the target business code to obtain business results and provide them to the user.
[0038] An embodiment of the present disclosure also provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the large model-based API intelligent selection and business process calling method provided in the embodiment of the present disclosure.
[0039] The embodiments of the present disclosure also provide a computer-readable storage medium, which stores a computer program for executing the large model-based API intelligent selection and business process calling method provided in the embodiments of the present disclosure.
[0040] An embodiment of the present application also provides a computer program product, including a computer program, wherein the computer program is executed by a processor as the large model-based API intelligent selection and business process calling method provided in the embodiment of the present application.
[0041] Compared with the prior art, the technical solution provided by the embodiment of the present disclosure has the following advantages: the API intelligent selection and business process calling solution based on the big model provided by the embodiment of the present disclosure obtains multiple service resources in the target service scenario, and encapsulates each service resource according to the target format application programming interface API to obtain an API service resource pool, obtains historical business process call record data, and builds a business data set corresponding to the API service resource pool based on the historical business process call record data, adjusts the pre-trained big model based on the business data set to obtain an adjustment model, adjusts the adjustment model based on the pre-built prompt words to obtain a target model, receives the user's input question information, processes the input question information based on the target model, obtains the target business code, and calls one or more API service resources in the API service resource pool based on the target business code to obtain the business result and provide it to the user. By adopting the above technical solution, the service resources are uniformly encapsulated into the target format API, the business process orchestration and unified scheduling are realized, and the business data set and prompt words are constructed to adjust the model, so that the model has a stronger business code implementation capability, thereby enhancing the reliability of the target business code, improving the fluency of the business process, meeting the user's use needs, and improving the user's use experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0043] Figure 1 A flowchart of a method for intelligently selecting an API and calling a business process based on a large model provided in an embodiment of the present disclosure;
[0044] Figure 2 A flowchart of another API intelligent selection and business process calling method based on a large model provided in an embodiment of the present disclosure;
[0045] Figure 3 An example diagram of a method for intelligently selecting an API and calling a business process based on a large model provided in an embodiment of the present disclosure;
[0046] Figure 4 A schematic diagram of the structure of a large model-based API intelligent selection and business process calling device provided in an embodiment of the present disclosure;
[0047] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0048] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0049] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0050] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0051] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0052] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0053] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0054] With the rapid development of artificial intelligence technologies such as big models, the technology of using automated business API calls has emerged, based on the ability of large pre-trained language models to understand and process natural language requests. These models are trained with a large amount of data and can recognize patterns in language, structure specific steps in business processes, and convert them into step-by-step API call operations. At the same time, as the big models trained with massive amounts of natural language become increasingly intelligent, they may produce results that humans cannot understand when facing business, so some means need to be taken to align them so that the models can generate answers that humans can understand.
[0055] Specifically, existing technologies are usually called based on existing processes and are unable to generate process orchestration through the big model's own capabilities; the big model's Chain-of-Thought (CoT) capabilities have certain limitations and are unable to generate processes that meet the needs of actual business processes; they are unable to directly generate executable code, and the accuracy of the generated code is low, and there are logical problems.
[0056] In view of the above problems, the present invention proposes a method for intelligent selection of API and calling of business processes based on a large model. By combining CoT and PoT (Program-of-Thoughts, program thinking), the model is tuned and the automated process API construction is realized by constructing prompt words in business scenarios; the understanding of the service business field is obtained by combining prompt (prompt word) tuning and instruction (business data set) tuning, overcoming the problem that it can only be called through existing processes and needs manual management, and realizing the value alignment of the large model at the same time, so that the business process generation results generated by the large model are as close to human thinking as possible, without deviating from the business purpose; combined with CoT and PoT methods, the logical thinking of the large model in code generation and the understanding of the business API are optimized, and the availability of automatically building business is significantly improved. In addition, by means of instruction (business data set) tuning, the value alignment is combined with the reinforcement learning method to ensure that the content generated by artificial intelligence is consistent with human intentions and purposes, and the reliability of the business code is enhanced. At the same time, the business code is post-processed and recompiled to make the entire business process smoother. At the same time, the reinforcement learning method is improved, and the feedback model is used for fine-grained feedback to continuously optimize the performance of the large model.
[0057] Among them, CoT is the thinking chain of the big model. Based on the big model's understanding of the problem, it uses prompt words to decompose the problem into specific steps, helping artificial intelligence (i.e., the big model) understand the essence of the problem and quickly build a solution; PoT is the program thinking of the big model. On the premise of decomposing the reasoning into sequential steps, it associates semantics with variables and creates executable program code, which can be used to solve logical problems such as numerical calculations. Instruction tuning can be understood as a supervised learning method, which further trains the big model (big language model) on a data set consisting of (instruction, output) pairs in a supervised manner, and can narrow the gap between model prediction and human prediction based on preset instructions; prompt tuning can be understood as guiding the model to generate a specific type of response through prompt words, and controlling the model to generate content in a specific format.
[0058] Specifically, Figure 1 The present invention provides a flow chart of a method for intelligently selecting and calling a business process based on a big model. The method can be performed by a device for intelligently selecting and calling a business process based on a big model, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:
[0059] Step 101: Acquire multiple service resources in a target service scenario, and encapsulate each service resource according to a target format application programming interface API to obtain an API service resource pool.
[0060] Among them, the target service scenario can be a government service scenario, an enterprise service scenario, etc. It can be understood that there are multiple service resources under the target service scenario, and business processing of user problems can be performed by calling one or more service resources, and business results can be provided to users; among them, the service resources can be the usage of a certain conference room, the telephone number of a certain department, etc.
[0061] In the disclosed embodiment, in order to realize business process orchestration and unified scheduling, each service resource is first encapsulated according to the target format API to obtain an API service resource pool; wherein the target format can be selected and set according to the needs of the actual application scenario. In the disclosed embodiment, the target format can be a RESTful (Representational State Transfer) format, that is, multiple service resources can be encapsulated in the form of a RESTful API and standardized into a format that can be called externally to form an API service resource pool.
[0062] Step 102: Acquire historical business process call record data, and construct a business data set corresponding to the API service resource pool based on the historical business process call record data.
[0063] Among them, historical business process call record data refers to the historical business process information stored in the historical system, including user demand description, business process description and other contents.
[0064] In the embodiment of the present disclosure, constructing a business data set corresponding to the API service resource pool based on historical business process call record data can be understood as obtaining which service resources in the API service resource pool need to be called for each business process information, and converting the operation method of calling the service resources in the API service resource pool into business codes, and finally constructing a mapping relationship between each business process and the business code to obtain the business data set.
[0065] Step 103: adjust the pre-trained large model based on the business data set to obtain an adjusted model.
[0066] In the embodiments of the present disclosure, the pre-trained big model refers to a big language model, which can be trained on a large amount of text data to learn the patterns and results of language, that is, trained to understand and generate human language for effective dialogue and answer various questions. In other words, the pre-trained big model can answer the user's questions. In order to improve the ability of the big model to perform process orchestration generation and meet the actual business process processing in the target service scenario, the embodiments of the present disclosure adjust the pre-trained big model through the business data set to obtain an adjusted model.
[0067] Specifically, the business process information in the business data set is converted into a business process vector, and the business process vector is used as the input of the pre-trained big model. The corresponding business code in the business data set is used as the output to tune the pre-trained big model. In the process of the pre-trained big model processing the business process vector, the model parameters of the pre-trained big model are continuously adjusted in order to output the corresponding business code, thereby obtaining an adjusted model.
[0068] Step 104: adjust the adjustment model based on the pre-built prompt words to obtain a target model.
[0069] In the embodiment of the present disclosure, prompt words can be pre-constructed. Specifically, according to the business task classification labels, each label is constructed by the user into a type of prompt words, including the output format and necessary information of the specified model.
[0070] In the disclosed embodiment, the user request retrieval (sample) and the corresponding prompt word template are input into the adjustment model, and the adjustment model continuously adjusts the model parameters to output the content corresponding to the prompt word template, thereby obtaining the target model.
[0071] Step 105, receiving the user's input question information, processing the input question information based on the target model, obtaining the target business code, and calling one or more API service resources in the API service resource pool based on the target business code to obtain the business result and provide it to the user.
[0072] In the embodiments of the present disclosure, after obtaining the target model, the user's input question information can be processed in real time. Specifically, the input question information is processed based on the target model to obtain the target business code, and one or more API service resources in the API service resource pool are called according to the target business code to obtain the business results and provide them to the user.
[0073] The API intelligent selection and business process calling scheme based on a large model provided by the embodiment of the present disclosure obtains multiple service resources in a target service scenario, and encapsulates each service resource according to the target format application programming interface API to obtain an API service resource pool, obtains historical business process call record data, and constructs a business data set corresponding to the API service resource pool based on the historical business process call record data, adjusts the pre-trained large model based on the business data set to obtain an adjustment model, adjusts the adjustment model based on the pre-built prompt words to obtain a target model, receives user input question information, processes the input question information based on the target model, obtains a target business code, and calls one or more API service resources in the API service resource pool based on the target business code to obtain business results and provide them to the user. By adopting the above technical scheme, the service resources are uniformly encapsulated into a target format API, business process orchestration and unified scheduling are realized, and a business data set and prompt words are constructed to adjust the model, so that the model has a stronger business code implementation capability, thereby enhancing the reliability of the target business code, improving the fluency of the business process, meeting user usage needs, and improving user usage experience.
[0074] Based on the description of the above embodiments, the embodiments of the present disclosure can also perform syntax verification on the target business code, and can further improve the accuracy of the model through reinforcement learning and alignment. For details, see Figure 2 Specific description.
[0075] Specifically, Figure 2 This is a flow chart of another method for intelligently selecting and calling a business process based on a big model provided by the present disclosure. This embodiment further optimizes the method for intelligently selecting and calling a business process based on a big model on the basis of the above embodiment. Figure 2 As shown, the method includes:
[0076] Step 201: obtain multiple service resources in the target service scenario, and obtain the identifier, communication method, request or response format of each service resource, encapsulate the identifier, communication method, request or response format of each service resource into an API, and obtain an API service resource pool.
[0077] As an example of a scenario, the embodiments of the present disclosure can automatically orchestrate and drive business APIs in government scenarios to implement business scenario methods, and can implement business process orchestration and code compilation calls at the business API level through a large model.
[0078] In the disclosed embodiment, a target format such as a RESTful API service resource pool is constructed. A RESTful style interface is designed for each service resource, including an identifier of the service resource (such as URIs), a communication method, i.e., HTTP (request response between client and server) method (such as GET, POST, PUT, DELETE, etc.) and a request / response format (such as JSON, XML).
[0079] Among them, the identifier of the service resource can uniquely identify a service resource, which can be understood as the address of the service resource or the name of the service resource; in some embodiments, the service resource identifier can be set to include a target identifier to improve the calling efficiency of the service resource. More specifically, the service resource identifier includes a first target identifier to make the service resource identifier more readable, the service resource identifier includes a second target identifier to indicate the hierarchical relationship of the service resource, the service resource identifier includes a third target identifier to filter the service resource, and the service resource identifier includes a fourth target identifier to indicate the relationship between service resources at the same level, thereby further improving the subsequent service resource processing efficiency and effect.
[0080] The communication mode may also be determined according to the identifier of the service resource, thereby further improving the service resource calling efficiency.
[0081] As an example, various service resources in the government service scenario are encapsulated in the form of RESTful API, standardized into a format that can be called externally, and an API service resource pool is formed. Among them, RESTful API uses standard HTTP methods to make the interface easy to understand and use, while facilitating horizontal expansion and improving the scalability and reliability of the system.
[0082] Step 202: Acquire historical business process call record data, and acquire multiple business process information based on the historical business process call record data.
[0083] Step 203, based on each business process information and the API service resource pool, obtain the business code corresponding to each business process information, build a mapping relationship between the business process information and the corresponding business code based on the program thinking method, and obtain the business data set.
[0084] Specifically, build a business data set. More specifically, collect historical business process call record data in the historical system, map the corresponding business process information, including user demand description, business process description, etc., with the API service resource pool, and build the input and output relationship (business process description, API call sequence) based on the program thinking (PoT) method, so that the big model can learn the mapping relationship between the natural language description of the business process and the business code logic. Build a business data set through big model generation or manual methods as the data set for big model training.
[0085] Step 204, obtain a text processing model based on the objective function, and process the business process information in the business data set based on the text processing model to obtain a business process vector, train the big model based on the model training parameters defined by the target class to obtain a pre-trained big model, and read the business code in the business data set based on the supervised data class.
[0086] Step 205: Adjust the pre-trained large model based on the business process vector and the business code to obtain an adjusted model.
[0087] In the disclosed embodiment, a supervised data class "Supervised_Dataset" is defined to read the business data set, and the text (input content, i.e., business process information), label (output content, i.e., business code) and tokenizer (preprocessor, i.e., preprocessing model, which can convert text into digital vectors) in training are defined; wherein, the tokenizer converts the text into a digital vector for standardized unified representation, maps similar semantic words to similar vector spaces, reduces the dimension of the data through text vectorization, reduces the complexity of the model, and improves learning efficiency.
[0088] In the embodiment of the present disclosure, the text processing model is obtained through the objective function "transformer.Autotokenizer.from_pretrained()" to convert the text data into an input format acceptable to the model, that is, the tokenizer to be used by the pre-trained large model is obtained, the text processing model is loaded through the objective function, the training text is converted into a digital vector, and then the parameters of the large model training are defined through the target class "transformer.TrainingArguments", such as the output directory, optimizer, learning rate scheduler, etc., and finally the above parameters are passed into the trainer to initiate the large model training, and the model is tuned based on the business data set.
[0089] Step 206, obtaining multiple prompt word templates based on the prompt word; wherein each prompt word template includes a classification prompt word, a model output format and output information, and inputting the user request retrieval and the corresponding prompt word template into the adjustment model for adjustment to obtain a target model.
[0090] In the disclosed embodiment, when the trained model is called, a clear and specific prompt word (prompt) can be provided, which contains all the necessary information and guidance. Therefore, the adjustment model can be guided to generalize and learn from a small number of samples and quickly adapt to new tasks by means of a few-sample prompts. Specifically, according to the task classification labels, a class of prompt words is constructed by the technicians for each label, and the output format and necessary information of the model are specified. The corresponding prompt word template is retrieved and applied according to the user's request, so that the adjustment model can output standardized content according to the task type. The output code template (business code) of the adjustment model that has been optimized by the prompt has higher accuracy and business reliability.
[0091] Step 207: Collect user feedback data on the target business code, build a feedback model based on the feedback data, and determine positive samples and negative samples based on the generated data of the feedback model to adjust the target model.
[0092] In the disclosed embodiments, user feedback is collected and supervised learning is performed. Based on the direct preference optimization (DPO) method, user feedback data on business codes is first collected, such as user ratings of business codes or the similarity between business codes and final processes. A fine-grained feedback model is established directly based on user preference scoring data, and the detailed feedback provided by the feedback model is used to correct the response of the target model.
[0093] Specifically, we use the responses and evaluation scores generated by the feedback model, select high-scoring responses as positive samples and low-scoring data as negative samples, build positive and negative data sets, and fine-tune the large model. We continue to collect user feedback for iterative training, and each iteration can generate better responses and corrections to improve model performance.
[0094] Step 208, receiving the user's input question information, processing the input question information based on the target model, obtaining the target business code, performing syntax check on the target business code through the target tool, and calling one or more API service resources in the API service resource pool based on the target business code to obtain the business result and provide it to the user.
[0095] In the disclosed embodiment, for the business code generated by the target model, the script can be verified for grammatical correctness and post-processed through tools such as shell. For example, for Python code, syntax verification can be performed through pyflakes, and the verified correct code can be compiled to complete the interface calling process.
[0096] Further, based on the verified target business code, one or more API service resources in the API service resource pool are called to obtain business results and provide them to the user.
[0097] The API intelligent selection and business process calling solution based on a large model provided by the embodiment of the present disclosure fine-tunes the large model by combining CoT and PoT, has stronger business code implementation capabilities, and realizes business process orchestration and unified scheduling by uniformly encapsulating business resources into a RESTful API. It improves the system compilation success rate by processing the template content output by the model through scripts, and it iteratively improves the model performance through reinforcement learning in the DPO way.
[0098] As an example scenario, Figure 3 As shown, step 3.1 collects service resources, uniformly encapsulates them into RESTful API style, and builds an API service resource pool; step 3.2 converts the API in the API service resource pool into a JSON format business data set, and establishes a mapping relationship with the business process information; step 3.3 performs model tuning based on the business data set and fine-tunes the pre-trained large model; step 3.4 builds prompt words to guide the model to generate standardized content and deploy the model to the online environment; step 3.5 when receiving user questions, the template content generated by the model is processed by scripts, processed into compilable code, and the business process is implemented based on code editing; step 3.6 performs iterative reinforcement learning, and performs fine-grained feedback through the feedback model to guide the performance optimization of the large model.
[0099] Compared with the prior art, the present disclosure provides a standardized interface style by building a unified RESTful API style, and realizes the unification of service resource formats. By combining CoT and PoT, the coding and reasoning capabilities of the large model are enhanced on the basis of the thinking chain. The method of using manually written scripts to control the output content of the model enhances the controllability of the model generation content and the stability of the system, while optimizing the steps of reinforcement learning, and can perform more fine-grained model tuning and iterative performance improvement.
[0100] Figure 4 The present invention provides a schematic diagram of a large model-based API intelligent selection and business process calling device, which can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 4 As shown, the device comprises:
[0101] The first acquisition module 301 is used to acquire multiple service resources in a target service scenario.
[0102] The encapsulation module 302 is used to encapsulate each of the service resources according to the target format application programming interface API to obtain an API service resource pool.
[0103] The second acquisition module 303 is used to acquire historical business process call record data.
[0104] The construction module 304 is used to construct a business data set corresponding to the API service resource pool based on the historical business process call record data.
[0105] The first adjustment module 305 is used to adjust the pre-trained large model based on the business data set to obtain an adjusted model.
[0106] The second adjustment module 306 is used to adjust the adjustment model based on the pre-built prompt words to obtain a target model.
[0107] The receiving and processing module 307 is used to receive the user's input question information, process the input question information based on the target model, obtain the target business code, and call one or more API service resources in the API service resource pool based on the target business code to obtain the business result and provide it to the user.
[0108] In some optional embodiments, the encapsulation module 302 is specifically used to:
[0109] Obtaining an identifier, a communication method, and a request or response format of each of the service resources;
[0110] The identifier, communication method, and request or response format of each of the service resources are API-encapsulated to obtain the API service resource pool.
[0111] In some optional embodiments, the construction module 304 is specifically used to:
[0112] Acquire multiple business process information based on the historical business process call record data;
[0113] Based on each of the business process information and the API service resource pool, obtaining a business code corresponding to each of the business process information;
[0114] A mapping relationship between the business process information and the corresponding business code is constructed based on a program thinking method to obtain the business data set.
[0115] In some optional embodiments, the first adjustment module 305 is specifically configured to:
[0116] Acquire a text processing model based on the objective function, and process the business process information in the business data set based on the text processing model to obtain a business process vector;
[0117] The large model is trained based on the model training parameters defined by the target class to obtain a pre-trained large model, and the business code in the business data set is read based on the supervision data class;
[0118] The pre-trained large model is adjusted based on the business process vector and the business code to obtain an adjusted model.
[0119] In some optional embodiments, the second adjustment module 306 is specifically configured to:
[0120] Acquire multiple prompt word templates based on the prompt word; wherein each of the prompt word templates includes a classification prompt word, a model output format and output information;
[0121] The user request retrieval and the corresponding prompt word template are input into the adjustment model for adjustment to obtain the target model.
[0122] In some optional embodiments, the large model-based API intelligent selection and business process calling device further includes:
[0123] The verification module is used to perform syntax verification on the target business code through a target tool.
[0124] In some optional embodiments, the large model-based API intelligent selection and business process calling device further includes:
[0125] A collection module, used to collect feedback data of the user on the target service code;
[0126] The third adjustment module is used to build a feedback model based on the feedback data, and determine positive samples and negative samples based on the generated data of the feedback model to adjust the target model.
[0127] The big model-based API intelligent selection and business process calling device provided in the embodiments of the present disclosure can execute the big model-based API intelligent selection and business process calling method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0128] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the big model-based API intelligent selection and business process calling method provided by any embodiment of the present disclosure.
[0129] Figure 5 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 5 , which shows a schematic diagram of the structure of an electronic device 400 suitable for implementing the embodiment of the present disclosure. The electronic device 400 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0130] like Figure 5 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0131] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0132] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the large model-based API intelligent selection and business process calling method of the embodiment of the present disclosure are executed.
[0133] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0134] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0135] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0136] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains multiple service resources in the target service scenario, encapsulates each service resource according to the target format API to obtain an API service resource pool; obtains historical business process call record data, and constructs a business data set corresponding to the API service resource pool based on the historical business process call record data; adjusts the pre-trained large model based on the business data set to obtain an adjustment model; adjusts the adjustment model based on the pre-built prompt words to obtain a target model; receives user input question information, processes the input question information based on the target model to obtain a target business code, and calls one or more API service resources in the API service resource pool based on the target business code to obtain business results and provide them to the user.
[0137] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0138] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0139] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0140] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0141] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0142] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0143] processor;
[0144] a memory for storing instructions executable by the processor;
[0145] The processor is used to read the executable instructions from the memory and execute the instructions to implement any of the large model-based API intelligent selection and business process calling methods provided in the present disclosure.
[0146] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program is used to execute any of the large model-based API intelligent selection and business process calling methods provided by the present disclosure.
[0147] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0148] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0149] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for intelligent API selection and business process calling based on a large model, characterized in that: include: Acquire multiple service resources in a target service scenario, and encapsulate each of the service resources according to a target format application programming interface API to obtain an API service resource pool; Acquire historical business process call record data, and construct a business data set corresponding to the API service resource pool based on the historical business process call record data; Adjusting the pre-trained large model based on the business data set to obtain an adjusted model; Adjusting the adjustment model based on the pre-constructed prompt words to obtain a target model; Receive user input question information, process the input question information based on the target model to obtain a target business code, and call one or more API service resources in the API service resource pool based on the target business code to obtain a business result and provide it to the user.
2. The API intelligent selection and business process calling method based on a large model according to claim 1 is characterized in that: The step of encapsulating each of the service resources according to the target format application programming interface API to obtain an API service resource pool includes: Obtaining an identifier, a communication method, and a request or response format of each of the service resources; The identifier, communication method, and request or response format of each of the service resources are API-encapsulated to obtain the API service resource pool.
3. The API intelligent selection and business process calling method based on a large model according to claim 1 is characterized in that: The constructing a business data set corresponding to the API service resource pool based on the historical business process call record data includes: Acquire multiple business process information based on the historical business process call record data; Based on each of the business process information and the API service resource pool, obtaining a business code corresponding to each of the business process information; A mapping relationship between the business process information and the corresponding business code is constructed based on a program thinking method to obtain the business data set.
4. The API intelligent selection and business process calling method based on a large model according to claim 1 is characterized in that: The step of adjusting the pre-trained large model based on the business data set to obtain an adjusted model includes: Acquire a text processing model based on the objective function, and process the business process information in the business data set based on the text processing model to obtain a business process vector; The large model is trained based on the model training parameters defined by the target class to obtain a pre-trained large model, and the business code in the business data set is read based on the supervision data class; The pre-trained large model is adjusted based on the business process vector and the business code to obtain an adjusted model.
5. The API intelligent selection and business process calling method based on a large model according to claim 1 is characterized in that: The adjustment model is adjusted based on the pre-built prompt words to obtain a target model, including: Acquire multiple prompt word templates based on the prompt word; wherein each of the prompt word templates includes a classification prompt word, a model output format and output information; The user request retrieval and the corresponding prompt word template are input into the adjustment model for adjustment to obtain the target model.
6. The API intelligent selection and business process calling method based on a large model according to claim 1 is characterized in that: Also includes: The target service code is syntax-checked by a target tool.
7. The API intelligent selection and business process calling method based on a large model according to claim 1 is characterized in that: Also includes: Collecting feedback data from the user on the target service code; A feedback model is constructed based on the feedback data, and positive samples and negative samples are determined based on the generated data of the feedback model to adjust the target model.
8. A device for intelligent API selection and business process calling based on a large model, characterized in that: include: A first acquisition module is used to acquire multiple service resources in a target service scenario; A packaging module, used to package each of the service resources according to a target format application programming interface API to obtain an API service resource pool; The second acquisition module is used to obtain historical business process call record data; A construction module, used to construct a business data set corresponding to the API service resource pool based on the historical business process call record data; A first adjustment module, used to adjust the pre-trained large model based on the business data set to obtain an adjusted model; A second adjustment module, used to adjust the adjustment model based on the pre-built prompt words to obtain a target model; A receiving and processing module is used to receive user input question information, process the input question information based on the target model, obtain a target business code, and call one or more API service resources in the API service resource pool based on the target business code to obtain business results and provide them to the user.
9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the large model-based API intelligent selection and business process calling method described in any one of claims 1-7 above.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the API intelligent selection and business process calling method based on a large model as described in any one of claims 1 to 7 above.
Citation Information
Patent Citations
Service logic code automatic generation method, device and server
CN110515615A
Code resource management method and device, electronic equipment and medium
CN112181376A
Power failure arrangement micro-service development method and device and computer equipment
CN112667205A
Platform construction method and device based on low code, medium and electronic equipment
CN116414370A
Automatic service generation method and device, computer equipment and storage medium
CN116976640A
Cited By
Method and device for constructing business model, equipment and storage medium
CN120560620A
Data processing method and device, electronic equipment, storage medium and program product
CN122132466A
Power grid analytical tool invoking method and system based on large language model
WO2026130481A1
