Method and apparatus for intelligent selection of large model-based api and business process invocation

CN119149014BActive Publication Date: 2026-10-16ZHONGDIAN DATA IND CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411116213.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2026-10-16
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

[0003]传统的业务系统集成和API(Application Programming Interface,应用程序编程接口)调用往往依赖于硬编码和手动管理,不仅效率低下,且难以适应快速变化的业务需求

Benefits of technology

[0041] Compared with existing technologies, the technical solution provided in this disclosure has the following advantages: The API intelligent selection and business process invocation scheme based on a large model provided in this disclosure acquires multiple service resources under the target service scenario, encapsulates each service resource according to the target format application programming interface (API) to obtain an API service resource pool, acquires historical business process invocation record data, and constructs a business dataset corresponding to the API service resource pool based on the historical business process invocation record data. Based on the business dataset, the pre-trained large model is adjusted to obtain an adjusted model. Based on pre-constructed prompt words, the adjusted model is further adjusted to obtain the target model. User input question information is received, and based on the target model, the input question information is processed to obtain the target business code. Based on the 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. By adopting the above technical solution, service resources are uniformly encapsulated into target format APIs, realizing business process orchestration and unified scheduling. Furthermore, the model is adjusted by constructing a business dataset and prompt words, giving the model stronger business code implementation capabilities. Therefore, the reliability of the target business code can be enhanced, the smoothness of the business process can be improved, user needs can be met, and the user experience can be improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149014B_ABST
    Figure CN119149014B_ABST
Patent Text Reader

Abstract

The method comprises the following steps: obtaining API service resource pools by encapsulating a plurality of service resources in a target service scene according to a target format API; constructing a business data set corresponding to the API service resource pools based on historical business process calling record data; adjusting a pre-trained large model based on the business data set to obtain an adjusted model; adjusting the adjusted model based on a pre-constructed prompt word to obtain a target model; receiving input question information of a user, processing the input question information based on the target model to obtain target business code, and calling one or more API service resources in the API service resource pools based on the target business code to obtain business results and provide the business results to the user. By using the technical solution, the reliability of the target business code can be enhanced, and the smoothness of the business process can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to a method, apparatus, device, and medium for intelligent selection and business process invocation of APIs (Application Programming Interfaces) based on large models. Background Technology

[0002] In the current era of big data, facing ever-increasing data volumes and business complexity, enterprises need to respond quickly to policy changes and improve the automation and intelligence of their 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] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method, apparatus, device, and medium for intelligent API selection and business process invocation based on a large model.

[0005] This disclosure provides a method for intelligent API selection and business process invocation based on a large model, the method comprising:

[0006] Obtain multiple service resources in the target service scenario, and encapsulate each service resource according to the target format application programming interface (API) to obtain an API service resource pool;

[0007] Obtain historical business process call record data, and construct a business dataset corresponding to the API service resource pool based on the historical business process call record data;

[0008] The pre-trained large model is adjusted based on the aforementioned business dataset to obtain an adjusted model;

[0009] The adjustment model is then adjusted based on pre-built prompts to obtain the target model;

[0010] The system receives user input question information, processes the input question information based on the target model to obtain 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.

[0011] In some alternative approaches, the encapsulation of each service resource according to a target format application programming interface (API) to obtain an API service resource pool includes:

[0012] Obtain the identifier, communication method, and request or response format of each of the service resources;

[0013] The identifier, communication method, request or response format of each service resource are encapsulated into an API to obtain the API service resource pool.

[0014] In some alternative approaches, constructing a business dataset corresponding to the API service resource pool based on the historical business process call record data includes:

[0015] Based on the historical business process call record data, obtain information on multiple business processes;

[0016] Based on each of the business process information and the API service resource pool, obtain the business code corresponding to each of the business process information;

[0017] The business dataset is obtained by constructing a mapping relationship between the business process information and the corresponding business code based on a programmatic thinking method.

[0018] In some alternative approaches, adjusting the pre-trained large model based on the business dataset to obtain an adjusted model includes:

[0019] A text processing model is obtained based on the objective function, and the business process information in the business dataset is processed 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 dataset is read based on the supervised data class.

[0021] The pre-trained large model is adjusted based on the business process vector and the business code to obtain the adjusted model.

[0022] In some alternative approaches, adjusting the model based on pre-built prompts to obtain the target model includes:

[0023] Multiple prompt word templates are obtained based on the prompt words; wherein each prompt word template includes a category prompt word, a model output format, and output information;

[0024] The user's request for retrieval and the corresponding prompt word template are input into the adjustment model for adjustment to obtain the target model.

[0025] In some alternative approaches, the API intelligent selection and business process invocation method based on large models also includes:

[0026] The target business code is syntax-validated using the target tool.

[0027] In some alternative approaches, the API intelligent selection and business process invocation method based on large models also includes:

[0028] Collect user feedback data regarding the target business code;

[0029] A feedback model is constructed based on the feedback data, and positive and negative samples are determined based on the data generated by the feedback model to adjust the target model.

[0030] This disclosure also provides an API intelligent selection and business process invocation device based on a large model, the device comprising:

[0031] The first acquisition module is used to acquire multiple service resources in the target service scenario;

[0032] The encapsulation module 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.

[0033] The second acquisition module is used to acquire historical business process call record data;

[0034] The construction module is used to construct a business dataset corresponding to the API service resource pool based on the historical business process call record data;

[0035] The first adjustment module is used to adjust the pre-trained large model based on the business dataset to obtain an adjusted model;

[0036] The second adjustment module is used to adjust the adjustment model based on pre-built prompt words to obtain the target model;

[0037] The receiving and processing module is used to receive user input question information, process the input question information based on the target model to obtain 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] This disclosure also provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the API intelligent selection and business process invocation method based on a large model as provided in this disclosure.

[0039] This disclosure also provides a computer-readable storage medium storing a computer program for executing the API intelligent selection and business process invocation method based on a large model as provided in this disclosure.

[0040] This application also provides a computer program product, including a computer program, wherein the computer program is executed by a processor as the API intelligent selection and business process invocation method based on a large model provided in this application.

[0041] Compared with existing technologies, the technical solution provided in this disclosure has the following advantages: The API intelligent selection and business process invocation scheme based on a large model provided in this disclosure acquires multiple service resources under the target service scenario, encapsulates each service resource according to the target format application programming interface (API) to obtain an API service resource pool, acquires historical business process invocation record data, and constructs a business dataset corresponding to the API service resource pool based on the historical business process invocation record data. Based on the business dataset, the pre-trained large model is adjusted to obtain an adjusted model. Based on pre-constructed prompt words, the adjusted model is further adjusted to obtain the target model. User input question information is received, and based on the target model, the input question information is processed to obtain the target business code. Based on the 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. By adopting the above technical solution, service resources are uniformly encapsulated into target format APIs, realizing business process orchestration and unified scheduling. Furthermore, the model is adjusted by constructing a business dataset and prompt words, giving the model stronger business code implementation capabilities. Therefore, the reliability of the target business code can be enhanced, the smoothness of the business process can be improved, user needs can be met, and the user experience can be improved. Attached Figure Description

[0042] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote 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 illustrating an API intelligent selection and business process invocation method based on a large model, provided in an embodiment of this disclosure;

[0044] Figure 2 A flowchart illustrating another method for intelligent API selection and business process invocation based on a large model provided in this disclosure embodiment;

[0045] Figure 3 Example diagram of the API intelligent selection and business process invocation method based on a large model provided in the embodiments of this disclosure;

[0046] Figure 4 A schematic diagram of the structure of an API intelligent selection and business process invocation device based on a large model provided in this disclosure embodiment;

[0047] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0048] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0049] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0050] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.

[0051] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0052] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0053] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0054] With the rapid development of AI technologies such as large-scale modeling, technologies for automating business API calls have emerged. These technologies leverage the capabilities of large pre-trained language models to understand and process natural language requests. Trained on massive amounts of data, these models can identify patterns in language, structure specific steps in business processes, and translate them into step-by-step API call operations. However, as these large-scale models, trained on vast amounts of natural language, become increasingly intelligent, they may produce results incomprehensible to humans when faced with business scenarios. Therefore, alignment mechanisms are needed to enable the models to generate answers that humans can understand.

[0055] Specifically, existing technologies typically rely on existing processes for invocation and cannot generate processes through the capabilities of the large model itself; the large model's Chain-of-Thought (CoT) capabilities have certain limitations and cannot generate processes that meet the needs of actual business processes; it cannot directly generate executable code, and the generated code has a low accuracy rate and contains logical problems.

[0056] To address the aforementioned issues, this disclosure proposes a method for intelligent API selection and business process invocation based on a large model. It combines CoT (Cooperation of Technology) and PoT (Program-of-Thoughts) to optimize the model and automate API construction by building prompts within business scenarios. By combining prompt (prompt word) optimization with instruction (business dataset) optimization, it gains an understanding of the service business domain, overcoming the limitations of relying solely on existing processes and requiring manual management. Simultaneously, it achieves value alignment with the large model, ensuring that the generated business processes closely resemble human thought and remain aligned with business objectives. Combining CoT and PoT methods optimizes the large model's logical thinking in code generation and its understanding of business APIs, significantly improving the usability of automatically constructed business processes. Furthermore, by optimizing instructions (business dataset) and combining them with reinforcement learning methods for value alignment, it ensures that AI-generated content aligns with human intent and purpose, enhancing the reliability of business code. Post-processing and recompiling the business code further streamlines the entire business process. Finally, it improves the reinforcement learning method by using a feedback model for fine-grained feedback, continuously optimizing the performance of the large model.

[0057] Among them, CoT stands for Large Model Thinking Chain, which, based on the large model's understanding of the problem, uses prompts to break down the problem into specific steps, helping artificial intelligence (i.e., the large model) understand the essence of the problem and quickly build a solution. PoT stands for Large Model Programming Thinking, which, under the premise of decomposing reasoning into sequential steps, associates semantics and variables to create 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 large model (large language model) in a supervised manner on a dataset composed of (instruction, output) pairs, and can narrow the gap between model predictions and human predictions based on preset instructions. Prompt tuning can be understood as guiding the model to generate specific types of responses through prompts, and controlling the model to generate content in a specific format.

[0058] Specifically, Figure 1 This is a flowchart illustrating a method for intelligent API selection and business process invocation based on a large model, provided in an embodiment of this disclosure. This method can be executed by a device for intelligent API selection and business process invocation based on a large model, wherein the device can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:

[0059] Step 101: Obtain multiple service resources under the target service scenario, and encapsulate each service resource according to the target format application programming interface (API) to obtain the API service resource pool.

[0060] 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 in the target service scenario. The user's problem can be processed by calling one or more service resources and the business results can be provided to the user. The service resources can be the usage status of a meeting room, the phone number of a department, etc.

[0061] In this embodiment of the disclosure, in order to achieve 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. The target format can be selected and set according to the actual application scenario. In this embodiment of the disclosure, the target format can be RESTful (Representational State Transfer) format. That is to say, multiple service resources can be encapsulated in the form of RESTful API and standardized into a format that can be called externally to form an API service resource pool.

[0062] Step 102: Obtain historical business process call record data, and construct a business dataset 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 information on historical business processes stored in the historical system, including user requirement descriptions, business process descriptions, and other content.

[0064] In this embodiment of the disclosure, constructing a business dataset 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, converting the operation method of calling which service resources in the API service resource pool into business code, and finally constructing the mapping relationship between each business process and business code to obtain the business dataset.

[0065] Step 103: Adjust the pre-trained large model based on the business dataset to obtain the adjusted model.

[0066] In this embodiment, the pre-trained large model refers to a large language model, which can be trained on a large amount of text data to learn language patterns and results, i.e., to understand and generate human language for effective dialogue and answering various questions. In other words, the pre-trained large model can answer user questions. To improve the large model's ability to orchestrate and generate processes for target service scenarios and meet actual business process requirements, this embodiment adjusts the pre-trained large model using a business dataset to obtain an adjusted model.

[0067] Specifically, the business process information in the business dataset is converted into business process vectors. These business process vectors are then used as input to a pre-trained large model, with the corresponding business codes in the business dataset serving as outputs to fine-tune the pre-trained large model. During the pre-trained large model's processing of the business process vectors, the model parameters are continuously adjusted to output the corresponding business codes, thereby obtaining an adjusted model.

[0068] Step 104: Adjust the model based on the pre-built prompts to obtain the target model.

[0069] In this embodiment of the disclosure, the prompt words can be pre-built. Specifically, based on the business task classification tags, each tag is used by the user to build a type of prompt words, including the output format of the specified model and necessary information.

[0070] In this embodiment of the disclosure, the user request retrieval (sample) and the corresponding prompt word template are input into the adjustment model. The adjustment model continuously adjusts its parameters in order to output content corresponding to the prompt word template, thereby obtaining the target model.

[0071] Step 105: Receive the user's input question information, process the input question information based on the target model to 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.

[0072] In this embodiment of the 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 invocation scheme based on a large model provided in this disclosure acquires multiple service resources in a target service scenario, encapsulates each service resource according to a target format application programming interface (API), and obtains an API service resource pool. It acquires historical business process invocation record data and constructs a business dataset corresponding to the API service resource pool based on this data. The pre-trained large model is adjusted based on the business dataset to obtain an adjusted model. The adjusted model is further adjusted based on pre-constructed prompts to obtain a target model. User input question information is received, processed based on the target model, and the target business code is obtained. One or more API service resources in the API service resource pool are then invoked based on the target business code to obtain business results and provide them to the user. By adopting the above technical solution, service resources are uniformly encapsulated into target format APIs, enabling business process orchestration and unified scheduling. Furthermore, the construction of a business dataset and prompts to adjust the model enhances the model's business code implementation capabilities. This improves the reliability of the target business code, enhances the smoothness of the business process, meets user needs, and improves the user experience.

[0074] Based on the description of the foregoing embodiments, the embodiments of this 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, as detailed in [link to relevant documentation]. Figure 2 Detailed description.

[0075] Specifically, Figure 2 This is a flowchart illustrating another method for intelligent API selection and business process invocation based on a large model, provided in this embodiment of the present disclosure. This embodiment further optimizes the aforementioned method for intelligent API selection and business process invocation based on a large model, building upon the previous 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 to obtain an API service resource pool.

[0077] As an example scenario, this disclosure provides a method for automating the orchestration and driving of business APIs in government affairs scenarios. It can achieve business process orchestration and code compilation and invocation at the business API level through a large model.

[0078] In this embodiment of the disclosure, a pool of service resources in a target format, such as a RESTful API, is constructed. A RESTful-style interface is designed for each service resource, including the service resource identifier (e.g., URIs), communication method (i.e., HTTP (request and response between client and server) method (e.g., GET, POST, PUT, DELETE, etc.), and request / response format (e.g., JSON, XML).

[0079] The identifier of a service resource uniquely identifies a service resource and can be understood as the address or name of the service resource. In some embodiments, the efficiency of service resource invocation can be improved by including a target identifier in the service resource identifier. More specifically, the service resource identifier includes a first target identifier to improve readability, a second target identifier to indicate the hierarchical relationship of the service resources, a third target identifier to filter service resources, and a fourth target identifier to indicate the relationship of peer service resources, thereby further improving the efficiency and effectiveness of subsequent service resource processing.

[0080] Furthermore, the communication method can be determined based on the identifier of the service resource, thereby further improving the efficiency of service resource invocation.

[0081] As an example, various service resources in government service scenarios are encapsulated in the form of RESTful APIs, standardized into a unified and publicly callable format, forming an API service resource pool. The RESTful APIs use standard HTTP methods, making the interfaces easy to understand and use, while also facilitating horizontal scaling and improving the system's scalability and reliability.

[0082] Step 202: Obtain historical business process call record data, and obtain information on multiple business processes based on the historical business process call record data.

[0083] Step 203: Based on each business process information and API service resource pool, obtain the business code corresponding to each business process information, and construct the mapping relationship between the business process information and the corresponding business code based on the programming thinking method to obtain the business dataset.

[0084] Specifically, a business dataset is constructed. More specifically, historical business process call records are collected from the historical system. The corresponding business process information, including user requirement descriptions and business process descriptions, is mapped to the API service resource pool. Based on the PoT (Programmatical Thinking) method, an input-output relationship (business process description, API call order) is constructed, enabling the large model to learn the mapping relationship between the natural language description of the business process and the business code logic. This business dataset is constructed either through large model generation or manually, and serves as the training dataset for the large model.

[0085] Step 204: Obtain a text processing model based on the objective function, process the business process information in the business dataset based on the text processing model to obtain a business process vector, train the large model based on the model training parameters defined by the objective class to obtain a pre-trained large model, and read the business code in the business dataset based on the supervised data class.

[0086] Step 205: Adjust the pre-trained large model based on the business process vector and business code to obtain the adjusted model.

[0087] In this embodiment, a supervised data class "Supervised_Dataset" is defined to read the business dataset. The training classes define 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 numerical vectors). The tokenizer converts text into numerical vectors for standardized, unified representation, mapping similar semantic terms to similar vector spaces. Text vectorization reduces data dimensionality, model complexity, and learning efficiency.

[0088] In this embodiment, the text processing model is obtained through the objective function "transformer.Autotokenizer.from_pretrained()" to convert 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 to convert the training text into numerical vectors. Then, the parameters for training the large model are defined through the objective class "transformer.TrainingArguments", such as the output directory, optimizer, learning rate scheduler, etc. Finally, the above parameters are passed to the trainer to initiate the training of the large model and perform model tuning based on the business dataset.

[0089] Step 206: Obtain multiple prompt word templates based on the prompt words; each prompt word template includes categorized prompt words, model output format, and output information. Input the user request retrieval and the corresponding prompt word template into the adjustment model for adjustment to obtain the target model.

[0090] In this embodiment, when the trained model is invoked, a clear and specific prompt word can be provided, containing all necessary information and guidance. Therefore, by using a few-example prompt, the model can be guided to generalize from a small number of samples and quickly adapt to new tasks. Specifically, based on task classification labels, each label is used by technical personnel to construct a set of prompt words, specifying the model's output format and necessary information. The corresponding prompt word template is retrieved and applied according to the user's request, enabling the adjusted model to output standardized content based on the task type. The output code template (business code) of the adjusted model, after prompt optimization, 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 and negative samples based on the data generated by the feedback model to adjust the target model.

[0092] In this embodiment of the disclosure, user feedback is collected and supervised learning is performed. Based on the Direct Preference Optimization (DPO) method, user feedback data on business code is first collected, such as user ratings of business code or similarity data between business code and final process. A fine-grained feedback model is established directly based on user preference rating data, and the detailed feedback knowledge provided by the feedback model is used to correct the response of the target model.

[0093] Specifically, using responses and evaluation scores generated by the feedback model, high-scoring responses are selected as positive examples and low-scoring data as negative examples to construct a positive and negative dataset, which is then used to fine-tune the large model. User feedback is continuously collected for iterative training; each iteration generates better responses and corrections, improving model performance.

[0094] Step 208: Receive user input question information, process the input question information based on the target model to obtain the target business code, perform syntax validation on the target business code using the target tool, 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.

[0095] In this embodiment of the disclosure, the business code generated by the target model can be used to perform syntax correctness verification and post-processing on the script using tools such as shell. For example, for Python code, syntax verification can be performed using pyflakes. The correct code that passes the verification can be compiled to complete the interface call process.

[0096] Further, based on the verified target business code, call one or more API service resources from the API service resource pool to obtain business results and provide them to the user.

[0097] The API intelligent selection and business process invocation scheme based on a large model provided in this disclosure combines CoT and PoT to fine-tune the large model, giving it stronger business code implementation capabilities. By encapsulating business resources into a unified RESTful API, it achieves business process orchestration and unified scheduling. By processing the template content output by the model through scripts, it improves the system's compilation success rate. Through reinforcement learning using the DPO approach, it iteratively improves model performance.

[0098] As an example of a scenario, such as Figure 3 As shown, step 3.1 collects service resources, uniformly encapsulates them into a RESTful API style, and builds an API service resource pool; step 3.2 converts the APIs in the API service resource pool into JSON format business datasets and establishes a mapping relationship with business process information; step 3.3 performs model optimization based on the business dataset, fine-tuning the pre-trained large model; step 3.4 constructs prompt words to guide the model in generating standardized content and deploys the model to the online environment; step 3.5 when receiving user questions, processes the template content generated by the model through a script, converting it into compilable code, and implements the business process based on code editing; step 3.6 performs iterative reinforcement learning, providing fine-grained feedback through the feedback model to guide the performance optimization of the large model.

[0099] Compared to existing technologies, this disclosure provides a standardized interface style by constructing a unified RESTful API style, achieving a unified service resource format. It employs a combination of CoT and PoT, enhancing the coding and reasoning capabilities of large models based on their thought processes. The use of manually written scripts to control model output enhances the controllability of model-generated content and system stability, while optimizing reinforcement learning steps, enabling finer-grained model tuning and iterative performance improvements.

[0100] Figure 4 This is a schematic diagram of a device for intelligent API selection and business process invocation based on a large model, provided as an embodiment of this disclosure. This device can be implemented by software and / or hardware and is generally integrated into an electronic device. Figure 4 As shown, the device includes:

[0101] The first acquisition module 301 is used to acquire multiple service resources in the 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 dataset 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 dataset to obtain an adjusted model.

[0106] The second adjustment module 306 is used to adjust the adjustment model based on pre-built prompt words to obtain the target model.

[0107] The receiving and processing module 307 is used to receive user input question information, process the input question information based on the target model to obtain 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.

[0108] In some alternative embodiments, the encapsulation module 302 is specifically used for:

[0109] Obtain the identifier, communication method, and request or response format of each of the service resources;

[0110] The identifier, communication method, request or response format of each service resource are encapsulated into an API to obtain the API service resource pool.

[0111] In some alternative embodiments, the building module 304 is specifically used for:

[0112] Based on the historical business process call record data, obtain information on multiple business processes;

[0113] Based on each of the business process information and the API service resource pool, obtain the business code corresponding to each of the business process information;

[0114] The business dataset is obtained by constructing a mapping relationship between the business process information and the corresponding business code based on a programmatic thinking method.

[0115] In some alternative embodiments, the first adjustment module 305 is specifically used for:

[0116] A text processing model is obtained based on the objective function, and the business process information in the business dataset is processed 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 dataset is read based on the supervised data class.

[0118] The pre-trained large model is adjusted based on the business process vector and the business code to obtain the adjusted model.

[0119] In some alternative configurations, the second adjustment module 306 is specifically used for:

[0120] Multiple prompt word templates are obtained based on the prompt words; wherein each prompt word template includes a category prompt word, a model output format, and output information;

[0121] The user's request for retrieval and the corresponding prompt word template are input into the adjustment model for adjustment to obtain the target model.

[0122] In some alternative embodiments, the API intelligent selection and business process invocation device based on a large model further includes:

[0123] The verification module is used to perform syntax verification on the target business code using the target tool.

[0124] In some alternative embodiments, the API intelligent selection and business process invocation device based on a large model further includes:

[0125] A collection module is used to collect feedback data from the user regarding the target business code;

[0126] The third adjustment module is used to construct a feedback model based on the feedback data, and to determine positive and negative samples based on the generated data of the feedback model to adjust the target model.

[0127] The API intelligent selection and business process invocation device based on a large model provided in this disclosure can execute the API intelligent selection and business process invocation method based on a large model provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0128] This disclosure also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the API intelligent selection and business process invocation method based on a large model provided in any embodiment of this disclosure.

[0129] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. See below for details. Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device 400 in the embodiments of this disclosure. The electronic device 400 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0130] like Figure 5 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.

[0131] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0132] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the large-model-based API intelligent selection and business process invocation method of embodiments of this disclosure.

[0133] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0134] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0135] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0136] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes the aforementioned one or more programs, the electronic device causes the following to occur: acquire multiple service resources in a target service scenario, encapsulate each service resource according to a target format API to obtain an API service resource pool; acquire historical business process call record data, construct a business dataset corresponding to the API service resource pool based on the historical business process call record data; adjust a pre-trained large model based on the business dataset to obtain an adjusted model; adjust the adjusted model based on 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 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.

[0137] Computer program code for performing the operations of this disclosure can 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, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone 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 remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0139] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0140] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0141] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0142] According to one or more embodiments of this disclosure, this disclosure provides an electronic device, including:

[0143] processor;

[0144] Memory used to store the processor's executable instructions;

[0145] The processor is configured to read the executable instructions from the memory and execute the instructions to implement the API intelligent selection and business process invocation method based on any of the methods provided in this disclosure.

[0146] According to one or more embodiments of this disclosure, this disclosure provides a computer-readable storage medium storing a computer program for executing the API intelligent selection and business process invocation method based on any of the large models provided in this disclosure.

[0147] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0148] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0149] Although the subject matter has been described using language specific to structural features and / or methodological logic, 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. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for intelligent API selection and business process invocation based on a large model, characterized in that, include: Multiple service resources under the target service scenario are acquired, and each service resource is encapsulated according to the target format application programming interface (API) to obtain an API service resource pool. Each service resource's API includes an identifier, communication method, and request or response format. The identifier uniquely identifies a service resource, includes a first target identifier to improve readability, a second target identifier to indicate the hierarchical relationship of the service resources, a third target identifier to filter service resources, and a fourth target identifier to indicate the relationship between peer service resources. Obtain historical business process call record data, and construct a business dataset corresponding to the API service resource pool based on the historical business process call record data; wherein, the mapping relationship between each business process and business code is constructed based on the programming thinking method to obtain the business dataset; The pre-trained large model is adjusted based on the aforementioned business dataset to obtain an adjusted model; The adjustment model is then adjusted based on pre-built prompts to obtain the target model; The system receives user input question information, processes the input question information based on the target model to obtain 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.

2. The method for intelligent API selection and business process invocation based on a large model according to claim 1, characterized in that, The process of encapsulating each service resource according to a target format application programming interface (API) to obtain an API service resource pool includes: Obtain the identifier, communication method, and request or response format of each of the service resources; The identifier, communication method, request or response format of each service resource are encapsulated into an API to obtain the API service resource pool.

3. The method for intelligent API selection and business process invocation based on a large model according to claim 1, characterized in that, The construction of the business dataset corresponding to the API service resource pool based on the historical business process call record data includes: Based on the historical business process call record data, obtain information on multiple business processes; Based on each of the business process information and the API service resource pool, obtain the business code corresponding to each of the business process information; The business dataset is obtained by constructing a mapping relationship between the business process information and the corresponding business code based on a programmatic thinking method.

4. The method for intelligent API selection and business process invocation based on a large model according to claim 1, characterized in that, The process of adjusting the pre-trained large model based on the business dataset to obtain the adjusted model includes: A text processing model is obtained based on the objective function, and the business process information in the business dataset is processed 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 dataset is read based on the supervised data class. The pre-trained large model is adjusted based on the business process vector and the business code to obtain the adjusted model.

5. The method for intelligent API selection and business process invocation based on a large model according to claim 1, characterized in that, The adjustment model is adjusted based on pre-built prompts to obtain the target model, including: Multiple prompt word templates are obtained based on the prompt words; wherein each prompt word template includes a category prompt word, a model output format, and output information; The user's request for retrieval and the corresponding prompt word template are input into the adjustment model for adjustment to obtain the target model.

6. The method for intelligent API selection and business process invocation based on a large model according to claim 1, characterized in that, Also includes: The target business code is syntax-validated using the target tool.

7. The method for intelligent API selection and business process invocation based on a large model according to claim 1, characterized in that, Also includes: Collect user feedback data regarding the target business code; A feedback model is constructed based on the feedback data, and positive and negative samples are determined based on the data generated by the feedback model to adjust the target model.

8. A device for intelligent API selection and business process invocation based on a large model, characterized in that, include: The first acquisition module is used to acquire multiple service resources in the target service scenario; An encapsulation module is used to encapsulate each of the service resources according to a target format application programming interface (API) to obtain an API service resource pool. Each service resource, according to the target format API, includes a service resource identifier, communication method, and request or response format. The service resource identifier uniquely identifies a service resource, includes a first target identifier to improve readability, a second target identifier to indicate the hierarchical relationship of the service resources, a third target identifier to filter service resources, and a fourth target identifier to indicate the relationship between peer service resources. The second acquisition module is used to acquire historical business process call record data; The construction module is used to construct a business dataset corresponding to the API service resource pool based on the historical business process call record data; wherein, the mapping relationship between each business process and business code is constructed based on the programming thinking method to obtain the business dataset; The first adjustment module is used to adjust the pre-trained large model based on the business dataset to obtain an adjusted model; The second adjustment module is used to adjust the adjustment model based on pre-built prompt words to obtain the target model; The receiving and processing module is used to receive user input question information, process the input question information based on the target model to obtain 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 includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the API intelligent selection and business process invocation method based on a large model as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the API intelligent selection and business process invocation method based on a large model as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Service scene intelligent arrangement and dynamic scheduling method and device, equipment and medium

    CN117472552A