Code generation method, system, device, storage medium and program product

CN122985171APending Publication Date: 2026-10-27ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510537026.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

目前,传统的SDK开发,需要人工手动编写代码来对接OpenAPI,存在SDK开发效率低小、易出错等的问题

Benefits of technology

[0043]本申请各实施例提供的技术方案,基于用户输入的功能开发需求,利用预设的接口定位模型定位出相关所需使用的编程接口之后,会获取编程接口的多种元数据,进而基于编程接口的多种元数据来生成用于调用所述编程接口的目标代码(为SDK代码)。本申请方案只需用户输入相关的功能开发需求即可,后续代码生成全是自动化的,无需用户参与,这有利于提高代码开发效率。其中,在利用接口定位模型定位出相关所需使用的编程接口后,本申请方案会对编程接口的真实存在性进行检查,并在检查出有不存在的编程接口时会向接口定位模型进行反馈,以触发接口定位模型进行编程接口重新输出,本方案通过这种检查与返回机制,可以确定获取的编辑接口是真实存在的,进而也有利于能确保获取到有效地编程接口的特征信息,以提升代码生成的精确性。上述中,编程接口的多种元数据如包括编程接口的参数信息、端点(Endpoint)、编程语言和自签名文档等,通过元数据的获取,可确保编程接口相关信息获取的全面性,这也有利于提升后续代码生成的精确性。此外,在定位出相关所需使用的编程接口为多个情况下,进一步地还会基于多个编程接口的依赖关系来生成目标代码,这有助于提升目标代码逻辑生成精确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122985171A_ABST
    Figure CN122985171A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a code generation method, system, device, storage medium and program product. In the present application scheme, based on the function development requirement input by the user, after the relevant required programming interface is located by using the preset interface positioning model, the plurality of metadata of the programming interface is obtained through reasoning, and then the target code (which is SDK code) is generated based on the plurality of metadata of the programming interface. The present application scheme only needs to input the related function development requirement, and the subsequent code generation is fully automated and does not require user participation, which is conducive to improving the code development efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a code generation method, system, device, storage medium, and program product. Background Technology

[0002] With the rapid development of cloud services, more and more users are relying on the Open Application Programming Interfaces (OpenAPIs) provided by cloud service platforms to build efficient and flexible applications. Software Development Kits (SDKs) are sets of tools designed to simplify users' calls to OpenAPIs. Currently, traditional SDK development requires manual coding to interface with OpenAPIs, resulting in low development efficiency and a high risk of errors. Therefore, there is an urgent need to provide an automated SDK code generation solution. Summary of the Invention

[0003] Several embodiments of this application provide a code generation method, system, device, storage medium, and program product for connecting programming interfaces, so as to realize automated SDK code generation.

[0004] In a first embodiment, this application provides a code generation method for link code generation. The method includes:

[0005] The development requirement is to respond to input operations and obtain input functionality.

[0006] The aforementioned functional development requirements are used as input to a pre-defined interface positioning model, and at least one programming interface is output.

[0007] Various metadata of the programming interface are obtained through reasoning;

[0008] Based on various metadata of the programming interface, target code is generated; the target code is used to call the programming interface.

[0009] In a second embodiment, this application also provides a code generation method for connecting a programming interface. The method includes:

[0010] Based on the input functional development requirements, determine the programming interface to be used;

[0011] If multiple programming interfaces are identified, the feature information of each programming interface and the dependency relationship between the multiple editing interfaces are obtained.

[0012] Based on the feature information and the dependency relationships, target code for calling the multiple programming interfaces is generated.

[0013] In a third embodiment, this application also provides a code generation method for connecting to a programming interface. The method includes:

[0014] Obtain feature development requirements;

[0015] Input the aforementioned functional development requirements into a preset interface positioning model, and output at least one programming interface;

[0016] When a non-existent programming interface is detected in at least one of the programming interfaces, feedback is sent to the interface location model, triggering the interface location model to re-output.

[0017] Based on the metadata of the at least one programming interface, generate target code for calling the at least one programming interface.

[0018] In a fourth embodiment, this application also provides a code generation method for connecting a programming interface. The method includes:

[0019] Based on the functional development requirements of the input, the agent is triggered to output at least one programming interface required to meet the requirements.

[0020] Obtain various metadata from the at least one programming interface;

[0021] Based on various metadata of the at least one programming interface, generate target code for calling the at least one programming interface.

[0022] In a fifth embodiment, this application also provides a code generation method for connecting a programming interface. The method includes:

[0023] Provides an intelligent interactive interface;

[0024] Based on the functional development requirements input on the intelligent interactive interface, the intelligent agent is triggered to output the programming interface required to meet the functional development requirements.

[0025] Obtain the feature information of the programming interface;

[0026] Based on the feature information of the programming interface, determine the target code used to call the programming interface;

[0027] The target code is displayed on the intelligent interactive interface;

[0028] The intelligent interactive interface includes a human-computer interaction interface provided by an intelligent assistant.

[0029] In a sixth embodiment, this application also provides a code generation method for connecting a programming interface. The method includes:

[0030] Display the client interface;

[0031] The function development requirements for responding to input operations on the client interface and obtaining the input are as follows:

[0032] Send the aforementioned functional development requirements to the server;

[0033] The target code returned by the server is displayed on the client interface;

[0034] The target code is generated based on various metadata of the programming interface after the required programming interface is determined based on the functional development requirements.

[0035] In a seventh embodiment, this application also provides a code generation system, the system comprising:

[0036] The client is used to implement the steps in the method provided in the sixth embodiment above;

[0037] The server is used to implement the steps in the methods provided in the first to fifth embodiments described above.

[0038] Eighth embodiment: This application provides an electronic device, including: a memory and a processor; wherein,

[0039] The memory is used to store programs;

[0040] The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the various method embodiments provided in this application.

[0041] In a ninth embodiment, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement the steps in the various method embodiments provided in this application described above.

[0042] In a tenth embodiment, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the various method embodiments provided in this application described above.

[0043] The technical solutions provided in the embodiments of this application, based on user-inputted functional development requirements, locate the relevant required programming interface using a preset interface location model, acquire various metadata of the programming interface, and then generate target code (SDK code) for calling the programming interface based on the various metadata of the programming interface. This application's solution only requires the user to input the relevant functional development requirements; subsequent code generation is fully automated and requires no user intervention, which improves code development efficiency. Specifically, after locating the relevant required programming interface using the interface location model, this application's solution checks the actual existence of the programming interface. If a non-existent programming interface is detected, feedback is sent to the interface location model to trigger the interface location model to re-output the programming interface. Through this checking and return mechanism, this solution can determine that the acquired editing interface is real, thus ensuring the acquisition of valid programming interface feature information and improving the accuracy of code generation. The various metadata of the programming interface mentioned above, such as the programming interface's parameter information, endpoints, programming language, and self-signed documents, ensure the comprehensiveness of the programming interface's related information by acquiring the metadata, which also helps improve the accuracy of subsequent code generation. Furthermore, when multiple programming interfaces are identified as required, target code is generated based on the dependencies between these interfaces, which helps improve the accuracy of the generated target code logic. Attached Figure Description

[0044] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0045] Figure 1 A schematic diagram of a code generation method provided for an exemplary embodiment of this application;

[0046] Figure 2 A schematic diagram illustrating the principle of functional development requirement input provided for an exemplary embodiment of this application;

[0047] Figure 3 A flowchart illustrating a code generation method provided as another exemplary embodiment of this application;

[0048] Figure 4 A schematic diagram of the structure of an electronic device provided for an exemplary embodiment of this application. Detailed Implementation

[0049] Currently, service platforms (such as cloud service platforms) provide corresponding OpenAPIs, allowing users to integrate various services (such as cloud services) on the platform during application development. SDKs, on the other hand, are toolsets designed to simplify user calls to OpenAPIs. With an SDK, users can avoid directly handling complex communication protocols, parameter passing specifications, and secure signatures when building applications. However, traditional SDK development requires manually writing code to interface with OpenAPIs, which not only results in low development efficiency but is also prone to errors. For example, users need to spend a significant amount of time reading OpenAPI documentation and manually filling in request parameters and parsing returned data, which is prone to omissions or errors.

[0050] To address the aforementioned issues, this application provides an intelligent SDK code generation solution. Intelligent SDK code generation aims to provide users (such as developers) with an efficient and convenient OpenAPI consumption experience through automation. The basic idea behind this solution is to automatically generate SDK code that meets user needs based on OpenAPI metadata and various downstream tools, leveraging the understanding and reasoning capabilities of a pre-defined model.

[0051] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse. In addition, the various models involved in this application (including but not limited to language models or large models) comply with relevant laws and standards.

[0053] Additionally, it should be noted that when user interaction operations (such as input operations) or trigger operations are involved in the embodiments of this application, the user interaction operations or trigger operations involved in the embodiments of this application include, but are not limited to, various interaction operations such as touch operations, gesture operations, voice operations, head movement operations, and eye movement operations; among them, touch operations include, but are not limited to, click operations, double-click operations, long-press operations, swipe operations, pinch operations, or mouse hover operations. Swipe operations include, but are not limited to, straight-line swipes and curved-line swipes.

[0054] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0055] First, the terminology used in the embodiments of this application will be explained. It should be understood that this explanation is for the purpose of making the embodiments of this application clearer and does not necessarily constitute a limitation on the embodiments of this application.

[0056] OpenAPI is a standardized, open interface service provided by a service platform (such as a cloud service platform) to help users (such as developers and enterprise users) access and manage various products and services on the platform programmatically. Through OpenAPI, users can automate operations on resources (such as cloud resources), integrate third-party systems, and build custom solutions. In short, OpenAPI is a standardized interface service provided by the service platform.

[0057] An OpenAPI portal (OpenAPI Explorer) is a one-stop online tool and platform provided by a service platform (such as a cloud service platform) to help users quickly explore, debug, and use the platform's open APIs. Through the OpenAPI portal, users can directly call various OpenAPIs of the service platform without writing code and view real-time request and response results. It greatly lowers the barrier to entry for users to learn and use the service platform's OpenAPIs. In other words, the OpenAPI portal serves as a key entry point for users to integrate various services provided by the service platform during program development; providing information about OpenAPIs is only the foundation.

[0058] API Assistants: In the OpenAPI portal, API assistants typically refer to a suite of tools and services provided to users (such as developers) to simplify and accelerate the interaction with OpenAPI.

[0059] SDK: An SDK is a collection of tools provided to users, typically including a series of OpenAPIs. Its primary purpose is to simplify the interaction with the OpenAPIs of a service platform. Through an SDK, users can quickly invoke various services on the platform using familiar programming languages, without manually handling complex operations such as HTTP requests and signature verification. In other words, an SDK is a pre-packaged program dependency for calling OpenAPIs.

[0060] Intelligent Agent: This is an important concept in the field of artificial intelligence. It is often referred to as an AI Agent. The term "Agent" is translated as "intelligent agent," "agent," or "intelligent subject," among other translations. An intelligent agent provides intelligent solutions for various complex tasks through perception, reasoning, decision-making, and action.

[0061] The agent can be constructed based on a pre-set model. The pre-set model is a pre-trained interface localization model used to locate one or more required OpenAPIs based on user input. This application does not limit the number of model parameters supported by the pre-set model, aiming to meet application requirements. If the pre-set model has relatively many model parameters, its size will be relatively large, its performance relatively better, but it will consume more time and resources during inference and training. If the pre-set model has relatively few model parameters, its size will be relatively small, and while meeting performance requirements, it will be more lightweight, consuming less time and resources during inference and training. In specific implementations, the aforementioned pre-set model can be, for example, a RAG (Retrieval-Augmented Generation) model or a model based on the ReAct (Reasoning and Acting) paradigm. The RAG model is a retrieval-augmented generative model that retrieves document fragments related to the input from an external knowledge base, concatenates the retrieved fragments with the input, and inputs them into a generative model (such as GPT-3) to generate the final answer. Models based on the ReAct (Reasoning and Acting) paradigm are reasoning-action models that combine reasoning and action. The model first performs reasoning when processing a task, and then executes actions based on the reasoning results. The agent built based on the RAG model mentioned above is actually a very basic version of an agent, and it struggles to handle complex task discrimination and targeted data extraction in various scenarios. The ReAct-based agent architecture is a common solution for question answering in vertical scenarios. The core of this type of question answering architecture is to provide a series of callable functions to the large model for the corresponding scenario. Whether the user's question can be effectively solved depends on the strength of the model's reasoning ability.

[0062] Agentic workflow is a workflow orchestration method based on agents. It aims to achieve complex goals in a systematic way through automated processes formed by task decomposition, information exchange, and coordinated decision-making.

[0063] The reasons for adopting the intelligent agent workflow orchestration method in this application include the following:

[0064] (1) Due to its simplicity and lack of flexibility, the RAG-based agent architecture struggles to accurately and effectively acquire the various prerequisites required for code generation. This solution, through deep adaptation to the code generation scenario and the AgenticWorkflow orchestration method, ensures that each stage can effectively acquire the relevant information.

[0065] (2) Although the agent architecture based on the ReAct paradigm can flexibly obtain relevant information by calling tools, it is difficult to ensure that accurate and comprehensive information is obtained due to the limited reasoning ability of the model and the limitation of the context window. This solution obtains various information through scenario-oriented orchestration of Agentic Workflow, which can ensure the effective execution and verification of each stage, and thus effectively ensure that the prompt information used to answer user questions is accurate and complete.

[0066] In practical implementation, this application abstracts the various information required for the code generation scenario (user questions, OpenAPI-related feature information (parameters, endpoints, programming languages, and self-signed documentation metadata, etc.) and their sequential dependencies (this refers to analyzing the dependencies between multiple OpenAPIs in scenarios involving multiple OpenAPIs), and then compiles a workflow that can be effectively used to generate code that meets the user's functional development needs. It is understandable that the aforementioned abstract code generation scenario refers to transforming the code generation task into a general workflow pattern that can automatically generate code through abstraction and modeling. For example, the general workflow pattern for code generation abstracted in this application... The process can be as follows: User question (i.e., user input of functional development requirements) -> Locate relevant OpenAPIs through an intelligent agent -> Detect the existence of the OpenAPI and provide feedback on the detection results -> Reason and obtain various information about the OpenAPI (such as parameter information, related endpoints, programming languages, and self-signed documentation). If multiple OpenAPIs are involved, the dependencies between them also need to be analyzed -> Determine the code generation category -> Generate corresponding official SDK code based on the official SDK example code, or generate self-signed code -> Output the code answer. Subsequently, following the above general workflow pattern, the system can automatically execute code generation to answer user questions.

[0067] The various method embodiments provided in this application are implemented using corresponding devices. These devices can be deployed on corresponding electronic devices. The electronic devices include server-side and client-side components. The server-side can be a physical server (such as a single server or a server cluster consisting of one or more servers), a virtual server, the cloud, etc. The client-side can be a smartphone, personal computer, smart wearable device, etc. Personal computers include laptops, all-in-one computers (which directly mount computing units, storage devices, and other hardware behind or at the bottom of the display), and discrete desktop computers, etc. Specifically, for some method embodiments (such as those described in this application...), Figure 1 The described method embodiments are mainly deployed on the corresponding server. Of course, in some other embodiments, the corresponding device may be deployed partly on the server and partly on the client (for example, the part involving user interaction is deployed on the client); or, when the client integrates server functions, the device may be deployed entirely on the client, for example, when the client is an all-in-one computer, the device may be deployed entirely on the client.

[0068] Figure 1This is a flowchart illustrating a code generation method for connecting a programming interface, provided as an exemplary embodiment of this application. This method is primarily applied to the server side, specifically to a smart assistant (such as a programming interface assistant, or API assistant for short) deployed on the server. Figure 1 As shown, the code generation method includes the following steps:

[0069] 101. Obtain various metadata of the programming interface through reasoning.

[0070] 102. Generate target code based on various metadata of the programming interface; the target code is used to call the programming interface.

[0071] Steps 101-102 above primarily automate the code generation for interfacing with the programming interface (i.e., connecting to the programming interface). These steps can be, but are not limited to, implemented through a corresponding intelligent assistant. In practical applications, an intelligent assistant, such as an API assistant, is an intelligent question-and-answer system that provides an intelligent interactive interface as an entry point for user interaction. For example, consider the intelligent interactive interface provided by an intelligent assistant... Figure 2 Taking the client interface shown as an example, when a user enters a function development requirement of "delete all historical order records for user ID 456" on this interface and clicks the "OK" control, the intelligent assistant will analyze the function development requirement to locate the programming interface needed to meet it. For example, if the located programming interface is POST / batch-delete (batch deletion), the assistant will further analyze and deduce various metadata of the POST / batch-delete programming interface, and automatically generate target code that can be used to call the POST / batch-delete programming interface based on the various metadata.

[0072] In practical implementation, for example, the process of locating the programming interface in the above example can be as follows: see [link to relevant documentation] Figure 2As shown, the intelligent assistant's interactive interface relies on the client for display. When a user enters a function development requirement on this interface, such as "Delete all historical order records for user ID 456," and clicks the "OK" button, the client responds to this click by generating a code generation request based on the user's input and sending the request to the server. The server, in response to this code generation request, triggers the intelligent assistant to invoke its built-in agent to analyze the function development requirement carried in the request. Specifically, the agent utilizes its interface location model to parse the function development requirement, retrieve candidate programming interfaces based on the parsing results, and then outputs at least one relevant programming interface required. For example, the intelligent agent parses the functional development requirement "delete all historical order records for user ID 456" and extracts the following entities: action = delete, entity = orders, user_id = 456, and scope = all_history. Further, based on the extracted entities, candidate programming interfaces are retrieved: DELETE / orders / {id} (single deletion) and POST / batch-delete (batch deletion). Further, through matching analysis, the POST / batch-delete programming interface is determined to be the best match for the functional development requirement, and thus the POST / batch-delete programming interface is output.

[0073] Based on the above combination Figure 2 In the example described above, the programming interface in 101 can be located using a pre-defined interface location model based on the user's input functional development requirements. The number of located programming interfaces can be one or more (two or more). The programming interface is the OpenAPI provided by the corresponding service platform.

[0074] That is, before performing step 101 above, the method provided in this embodiment may further include the following steps.

[0075] 100a. Development requirements for functions that respond to input operations and obtain input.

[0076] 100b. Take the functional development requirements as input to the pre-defined interface positioning model and output at least one programming interface.

[0077] In practical implementation, this application constructs a corresponding intelligent agent based on the interface positioning model. The user-inputted development functional requirements serve as the input to the intelligent agent, which then outputs at least one programming interface. The interface positioning model can be, but is not limited to, a ReAct-based model. Therefore, the intelligent agent can be, but is not limited to, a ReAct-based agent. Furthermore, when the interface positioning model outputs at least one programming interface, it can output each programming interface in a three-element format: the service providing the programming interface, the service version, and the programming interface name. That is, the output format for each programming interface is: {service providing the programming interface, service version, programming interface name}. The roles of these three elements will be detailed below and will not be elaborated here. The service providing the programming interface is also called a product, specifically referring to the service platform (such as a cloud platform) or software to which the programming interface belongs.

[0078] The proposed solution utilizes an intelligent agent (specifically, the interface location model) to automatically locate the programming interface required to meet the user's needs based on user input. This simplifies user operation, avoids the complexity and high knowledge requirements of manually inputting programming interfaces, and the intelligent agent also helps ensure the accuracy of interface location.

[0079] After the agent outputs at least one programming interface, it is necessary to verify the actual existence of the output programming interface. This is to avoid incorrect programming interface localization due to model illusions or outdated information within the agent's model. Model illusions refer to the output of answers to question-and-answer problems that are unrealistic, even completely fabricated. In other words, the programming interface located by the agent may not exist. Reasons for this include: the interface localization model in the agent outputting a fictitious programming interface (model illusion); the output programming interface being obsolete or having a version mismatch (e.g., a programming interface has been upgraded from version v1 to v2, but the output is an outdated version v1 programming interface).

[0080] In addition to the above, the method provided in this embodiment may further include the following steps:

[0081] 100c. Check the existence of at least one programming interface.

[0082] 100d. When a non-existent programming interface is detected, the interface positioning model is triggered to re-output.

[0083] The existence of the programming interface can be checked using at least one of the following methods, but is not limited to:

[0084] Method 1: Document Retrieval. You can use a search engine to check whether the programming interface is explicitly defined in the API specification document from the relevant API portal. If it is explicitly defined in the API specification document, then the programming interface truly exists; otherwise, the programming interface does not exist.

[0085] Method 2: Request Probing. A lightweight probing request can be initiated against the located programming interface, and the existence of the interface can be determined by observing the response. For example, the HTTP HEAD or OPTIONS methods can be used to initiate a probing request; if the response status is 2**, the programming interface is confirmed to exist; if the response status is 404, the programming interface does not exist. The HEAD or OPTIONS methods are request methods for specific purposes, providing functions such as metadata probing and protocol negotiation.

[0086] Method 3: Reverse verification. For example, you can check whether the reference SDK code provided in the API portal contains the calling code for the programming interface. If it exists, the programming interface is confirmed to exist; otherwise, it is confirmed that the programming interface does not exist.

[0087] Preferably, Method 1 is used to check the existence of the programming interface. This is because Method 1 essentially retrieves the source data of the programming interface; if the source data exists, it proves that the programming interface is real. The advantages of using source data for checking include: it eliminates the need to call the programming interface, thus avoiding risk. Calling a programming interface, even if successful, could incur costs or lead to data changes, both of which are risky. Furthermore, getting the programming interface to work might involve cumbersome pre-processing. However, checking only static source data minimizes the cost and maximizes reliability.

[0088] The proposed solution detects and provides feedback on the actual existence of the programming interface output by the intelligent agent. This ensures the actual existence of the programming interface and helps to ensure the effectiveness of subsequent acquisition of information related to the programming interface.

[0089] Furthermore, during the specific implementation check, the existence of the programming interface can be determined by checking the three elements of the programming interface based on the check results.

[0090] In practice, the three-element check of the programming interface mainly includes the following two aspects:

[0091] (1) Accuracy check: This mainly checks whether the elements are accurate and whether there are any unrepairable problems. For example, if the version, programming interface name, etc., included in the three elements of a programming interface are found to have a problem (such as a problem with the capitalization of letters), such low-level errors can be automatically repaired and corrected through some methods. After the repair is completed, it will be determined that the three elements of the programming interface are correct, and then no feedback will be given to the interface positioning model. It will continue to execute subsequent steps such as reasoning about various information of the programming interface.

[0092] (2) Existence Check. The existence check can be implemented based on the accuracy check results. For example, if the check finds that the service providing the programming interface is incorrect among the three elements of a programming interface (e.g., it cannot be found, so it is judged as an error), this is often uncorrectable. In this case, feedback will be sent to the interface location model. The feedback information includes: the erroneous element, and the suggested element location tool (e.g., what tool should be used to further retrieve the correct relevant service providing the programming interface).

[0093] Based on the above, a specific implementation of "checking the existence of the programming interface" in step 100c may include:

[0094] 100c1. Check the three elements of the programming interface.

[0095] 100c2. When an unrepairable erroneous element is detected among the three elements, it is determined that the programming interface does not exist.

[0096] Accordingly, the phrase "when it is detected that the programming interface does not exist, trigger the interface positioning model to re-output" in the aforementioned 100d can specifically include:

[0097] 100d1. Determine feedback information based on the error elements contained in the three elements of the programming interface; wherein, the feedback information includes a suggested element location tool.

[0098] 100d2. Input the feedback information into the interface positioning model to trigger the interface positioning model to re-output.

[0099] This application employs a three-element check method to determine the existence of a programming interface, effectively improving the accuracy of the existence check. If any of the three elements contains an uncorrectable error (such as one or more), the programming interface is determined to be non-existent. Furthermore, when providing feedback on a non-existent programming interface, the error element and a suggested element location tool are fed back to the interface location model. This allows the model to re-search for relevant elements based on the suggested tool, thereby improving the authenticity and accuracy of the re-output programming interface.

[0100] After identifying at least one existing programming interface through the above steps, the characteristic information of each programming interface is obtained. The characteristic information of the programming interface includes, but is not limited to, the metadata of the programming interface, such as parameter information required to call the programming interface (including input parameters and output parameters), descriptive information related to the programming interface (such as access endpoints), supported programming languages, self-signed documents, etc.

[0101] For example, for each identified programming interface, the following steps can be further performed:

[0102] Step 1: Infer the call parameters based on the programming interface. That is, infer the parameter information required to call the programming interface.

[0103] Step 2: Verify the inferred parameter information based on the parameter schema. That is, verify whether the inferred parameter information conforms to the parameter schema of the programming interface.

[0104] Here, a parameter schema typically refers to the formal definition or description of the structure, type, and constraints of parameters. Parameter schemas help ensure data integrity and consistency. For example, parameter constraint rules defined in a parameter schema include: data type rules, format rules, value range rules, required fields rules, and dependency rules (some parameters need to be used in combination).

[0105] Step 3: If the parameter inference is not met, the parameter inference will be re-performed for the editing interface; otherwise, if the parameter inference is met, the process will continue to the next step (i.e., obtaining the description information related to the programming interface).

[0106] In this application, the aforementioned parameter schema is referred to as the interface parameter rule. Based on the above, one possible implementation scheme for step 101, "obtaining various metadata of the programming interface through reasoning," may include:

[0107] 1011. Perform parameter reasoning on the programming interface to deduce the parameter information required to call the programming interface;

[0108] 1012. Determine whether the parameter information conforms to the preset interface parameter rules;

[0109] 1013. If it does not meet the requirements, the parameter reasoning of the programming interface will be re-executed.

[0110] 1014. If the conditions are met, then perform reasoning to obtain the description information related to the programming interface;

[0111] The parameter information includes input parameters and output parameters. The description information includes at least one of the following: service access point, supported programming languages, and security specifications.

[0112] In the above 1011, the parameter information required to call the programming interface can be deduced in the following ways, but is not limited to:

[0113] 1) Analyze existing related content for reasoning. Existing related content includes, but is not limited to: other known programming interfaces with similar functions, related sample code (such as request sample code, response sample code, SDK sample code, etc.). For information on obtaining sample code, please refer to the related content in other embodiments, which will not be elaborated here.

[0114] 2) Machine learning model-based inference: Based on the functions of the programming interface (such as the POST / batch-delete programming interface, which is used to batch delete all historical orders with user ID 456), inference is performed using a trained machine learning model (such as a deep learning model, a neural network model, etc.).

[0115] For the implementation details of steps 1012 to 1014 above, please refer to steps 1 to 3 in the aforementioned examples; they will not be elaborated upon here.

[0116] The service access points of the aforementioned programming interface are also called endpoints. An endpoint is the entry point for accessing a specific service function provided by the programming interface. Specifically, an endpoint can be understood as the access address (URL) path of the programming interface, which points to a specific resource or service operation. The methods for obtaining endpoints of a programming interface include, but are not limited to, any of the following:

[0117] 1) Analyze existing documents and resources for reasoning.

[0118] For example, you can find the endpoints of a programming interface from its official documentation. Official programming interface documentation typically refers to detailed documentation officially released and maintained by the interface provider. Generally, the content of official programming interface documentation includes, but is not limited to, the following: overview and introduction (a brief introduction to the interface's background, functions, uses, and applicable scenarios), detailed interface description (such as endpoint list, request methods, request parameters, response formats, authentication methods, the authentication mechanism used by the programming interface), authorization instructions (access permissions for different users or roles), sample code (such as request sample code and response sample code), and SDK support (providing software development kits (SDKs) for various programming languages).

[0119] For example, the endpoints of the programming interface can be deduced based on relevant sample code. Sample code can be obtained from the official documentation of the programming interface, which will demonstrate how to use the interface, including the endpoint URLs.

[0120] 2) Use API probing tools for inference

[0121] For example, you can use relevant API probing tools to discover valid endpoints of the programming interface by trying different combinations of URLs and parameters.

[0122] 3) Based on the naming rules of the programming interface, deduce the possible endpoints.

[0123] Furthermore, the programming languages ​​supported by the aforementioned programming interfaces typically include: JavaScript / Node.js, Python, Java, C#, PHP, Go, etc. Similarly, methods for obtaining the supported programming languages ​​of a programming interface include, but are not limited to: obtaining them by consulting the official documentation of the programming interface, inferring them based on relevant request and response sample code, analyzing SDK examples (which can be done by checking whether the programming interface provider has released official SDK examples and which programming languages ​​these SDK examples support), and so on.

[0124] Furthermore, the security specifications for the aforementioned programming interfaces include self-signed documentation. Self-signed documentation refers to interface description documents generated, maintained, and verified independently by the programming interface provider. These documents typically include instructions on how to digitally sign requests for the programming interface or other types of data using a private key. Therefore, self-signed documentation provides users (such as developers) with clear guidance on how to enhance the security of API calls through a self-signing mechanism. Self-signed documentation can be obtained, for example, by searching for it on the relevant API portal; alternatively, API-related documentation is sometimes hosted in repositories (such as Git repositories), so it can also be obtained by searching those repositories.

[0125] In this application, when reasoning about various information of the programming interface, especially the input and output parameters of the programming interface, the reasoning results are also verified. This can effectively ensure that the information interface of the reasoned information conforms to the specification constraints, which is the key to ensuring the security of the programming interface (such as verifying the output parameters to avoid the leakage of privacy information).

[0126] Furthermore, after acquiring various metadata about the programming interface, code generation can be categorized to clarify the needs and objectives of different code generation tasks, thereby specifying the subsequent code generation process. Specifically, this categorization can be determined based on, but is not limited to, the following aspects:

[0127] 1) Programming language: Determine the programming language used to generate the code, such as Java or C#.

[0128] 2) Usage scenarios: Classified according to different usage scenarios or needs, such as whether it is used for server-side development or client-side application development.

[0129] 3) Code Purpose: Distinguish whether the code is used to access API interfaces or to process data, etc.

[0130] 4) Code generation method: decide whether to use the official SDK code as a reference for generation, or to generate native code directly based on the API definition (as self-signed code), etc.

[0131] Therefore, the code generation classification described above can be understood as determining the code generation strategy. In this application, the code generation strategy is determined based on the programming language required by the user.

[0132] Typically, when generating SDK code for a programming interface, it's usually based on the SDK code provided by the corresponding service platform (the platform providing the programming interface, such as a cloud platform). This is because the SDK provided by the service platform has already uniformly encapsulated signature logic, timeout mechanisms, retry mechanisms, etc., saving the tedious steps of implementing signature logic and other complex processes. Only some simple information (such as keys and credentials) is needed. However, service platforms often only provide SDKs for mainstream programming languages ​​such as Java, C#, and Python. Some user scenarios are more specific, such as wanting to integrate the SDK into a microcontroller. In this case, C language is needed to generate SDK code, but the service platform doesn't have the relevant C language SDK code. In such situations, a self-signed method is required to generate SDK code to call the programming interface.

[0133] Based on the above, step 102, "generating target code based on various metadata of the programming interface," may include:

[0134] 1021. Based on the aforementioned functional development requirements, obtain the required programming language.

[0135] 1022. Determine the code generation strategy based on the required programming language.

[0136] 1023. If the code generation strategy is the first strategy, then based on the programming interface and various metadata of the programming interface, reference code is obtained; and target code is generated according to the various metadata of the programming interface and the reference code.

[0137] 1024. If the code generation strategy is the second strategy, then the target code is generated based on the various metadata of the programming interface.

[0138] In the above 1021, the functional development requirements may include usage scenarios (such as microcontroller scenarios), and the programming language of the requirements can be determined according to the usage scenarios.

[0139] In the above 1022, if the service platform (providing the platform for the programming interface) supports the required programming language, then the code generation strategy is determined to be the first strategy. Conversely, if the service platform does not support the required programming language, then the code generation strategy is determined to be the second strategy.

[0140] In point 1023 above, the relevant reference code can be obtained based on the programming interface, its parameter information, and the service access point (endpoint). If there are multiple programming interfaces, the relevant reference code can be obtained in batches. The reference code is the official SDK sample code provided by the corresponding service platform. SDK sample code can be obtained from the corresponding API portal or by searching and viewing the relevant repository, where the repository refers to the repository where the programming interface is hosted. Furthermore, based on various metadata of the programming interface, the reference code can be adapted and modified (such as parameters, endpoints, etc.) to obtain the target code. In this case, since the official SDK sample code is used as the reference code, the generated target code can also be called the official SDK code.

[0141] In the above 1024, some signature algorithm code examples can be obtained based on the self-signed documentation of the programming interface; then these signature algorithm code examples and the various metadata of the programming interface obtained above are input into a corresponding custom code generation model (a pre-trained preset model), and the custom code generation model analyzes and generates a target code based on the input data.

[0142] The programming language used in the aforementioned signature algorithm code examples is matched to the programming language required by the user. Furthermore, it is understood that the self-signed document described in this application is actually a signature algorithm specification document, which, for example, defines the rules for combining the parameter information of the entire request and the signing rules after the combination is completed.

[0143] This application can generate target code for calling programming interfaces by adopting an adaptation strategy, thereby meeting the personalized needs of a wider range of user function development.

[0144] Furthermore, if it is determined that there are multiple (two or more) programming interfaces to be used, it is also necessary to generate target code based on the dependencies between these interfaces to ensure that the target code can call the multiple programming interfaces in the correct order. Therefore, in this case, a specific implementation of 102 above may include:

[0145] S21. Determine the dependencies between the multiple programming interfaces;

[0146] S22. Generate the target code based on the various metadata of the multiple programming interfaces and the dependencies.

[0147] In S21 above, the dependencies can be determined based on various metadata analyses of multiple programming interfaces. The dependency types between multiple programming interfaces may include, but are not limited to, at least one of the following:

[0148] Functional dependency: The normal execution of one programming interface depends on the output of another programming interface. For example, the programming interface for a payment service needs to verify the user's identity through a user authentication programming interface before it can be called.

[0149] Data dependency: The output of one programming interface is the input of another programming interface, or multiple programming interfaces share a data source.

[0150] Sequence dependency: Programming interfaces need to be called in a specific order to complete the corresponding functional logic. Example: E-commerce process: Create order programming interface -> Payment programming interface -> Logistics programming interface.

[0151] In S22 above, if the code generation strategy used is the first generation strategy, the target code is generated based on various metadata of multiple programming interfaces, the dependencies between multiple programming interfaces, and the corresponding reference code. If the code generation strategy used is the second generation strategy, the target code is generated based on various metadata of multiple programming interfaces and the dependencies between multiple programming interfaces. For details on determining the specific code generation strategy, please refer to the relevant content in other embodiments; it will not be elaborated here. Similarly, the acquisition of reference code can also be found in the relevant content in other embodiments.

[0152] This application's solution addresses complex scenarios involving multiple programming interfaces by introducing dependencies between these interfaces when generating target code. This improves the accuracy of the target code logic and ensures the correctness of the calling logic when calling multiple programming interfaces through the target code.

[0153] The code generation method provided in the above application is as follows: Figure 3 As shown, the process can be summarized as follows:

[0154] S1. User Problem Input: The code generation method starts with "user problem". The user raises a problem that needs to be solved, that is, a functional development requirement.

[0155] S2, Locating the relevant programming interface (i.e., OpenAPI): The user question is passed to the ReAct-based agent to locate the relevant OpenAPI.

[0156] S3. Verify the existence of OpenAPI: The system checks whether the located OpenAPIs actually exist; if they do not exist ("No"), it returns to the previous step S2 for relocation and search; if they exist ("Yes"), it continues to the next step S4.

[0157] S4. N OpenAPIs that meet the requirements: The system selects N OpenAPIs that meet the user's functional development requirements. N is greater than or equal to 1.

[0158] S5. For each OpenAPI inference call parameter

[0159] For each selected OpenAPI, the system performs the following steps:

[0160] S51. Inferring call parameters for OpenAPI: The system infers the parameters required to call the OpenAPI.

[0161] S52. Verify call parameters based on parameter schema: Verify whether the inferred parameters conform to the OpenAPI parameter schema.

[0162] S53. If the parameter schema is not met, perform parameter inference again; if the parameter schema is met, proceed to the next step S6.

[0163] S6. Infer the endpoints, programming languages, and self-signed documents associated with the OpenAPI.

[0164] S7. Code Generation Classification: Based on the information obtained above, code generation is classified.

[0165] S8. Obtain SDK Sample Code: Based on the OpenAPI, OpenAPI-related endpoints and parameters, obtain the corresponding SDK sample code in batches.

[0166] S9. Generate target code: Generate official SDK code or self-signed code.

[0167] Official SDK code and self-signed code are generated based on the preceding information. Here, the preceding information includes the information obtained through the aforementioned steps S5 and S6, and may also include the functional development requirements input by the user.

[0168] S10. Generate Answer: Provide the user with the generated official SDK code or signature code as the code answer.

[0169] In summary, the code generation method and process provided in this application is a key technical solution for API Assistant to generate personalized, high-quality code based on user queries. Specifically, this solution starts with the user's question, locates and verifies relevant OpenAPIs, infers and verifies OpenAPI call parameters, obtains relevant documentation and sample code, and finally generates code that meets the user's needs. This process ensures the accuracy and reliability of the code, and also effectively improves the efficiency of users integrating OpenAPIs and reduces their self-service costs on the OpenAPI portal.

[0170] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.

[0171] Based on the foregoing content, this application also provides several other method embodiments. Details are as follows:

[0172] This application also provides a method for generating code to connect to a programming interface. The method includes the following steps:

[0173] 201. Based on the input functional development requirements, determine the required programming interface;

[0174] 202. If multiple programming interfaces are identified, then obtain the feature information of each programming interface and the dependency relationship between the multiple editing interfaces;

[0175] 203. Based on the feature information and the dependency relationship, generate target code for calling multiple programming interfaces.

[0176] The aforementioned feature information includes metadata of the programming interface. This metadata includes various metadata (parameter information, description information) of the programming interface as described in other embodiments. For specific implementations of steps 201-203, please refer to relevant content in other embodiments; they will not be elaborated upon here. Furthermore, the method provided in this embodiment may include other steps in addition to those shown above. For details regarding these other steps and their specific implementations, please refer to relevant content in other embodiments.

[0177] This application also provides another method for generating code to connect to a programming interface. This method is primarily applied to the server side, specifically to API helpers deployed on the server. The method includes the following steps:

[0178] 301. Obtain functional development requirements;

[0179] 302. Input the functional development requirements into the preset interface positioning model and output at least one programming interface;

[0180] 303. When a non-existent programming interface is detected in at least one of the programming interfaces, the detection result is fed back to the interface location model, triggering the interface location model to re-output;

[0181] 304. Generate target program code based on the metadata of the at least one programming interface.

[0182] For the specific implementation of steps 301 to 304 above, please refer to the relevant content in other embodiments, which will not be repeated here. In addition, the method provided in this embodiment may include other steps besides those shown above. For the other steps and their specific implementation, please refer to the relevant content in other embodiments.

[0183] This application also provides yet another method for generating code to connect to a programming interface. This method includes the following steps:

[0184] 401. Based on the functional development requirements of the input, trigger the intelligent agent to output at least one programming interface required to meet the requirements;

[0185] 402. Obtain various metadata of the at least one programming interface;

[0186] 403. Generate target code for calling the at least one programming interface based on various metadata of the at least one programming interface.

[0187] For the specific implementation of steps 401 to 403 above, please refer to the relevant content in other embodiments, which will not be described in detail here. In addition, the method provided in this embodiment may include other steps besides those shown above. For the other steps and their specific implementation, please refer to the relevant content in other embodiments.

[0188] This application also provides another method for generating code to connect to a programming interface, which includes the following steps:

[0189] 501. Display the intelligent interactive interface;

[0190] 502. Based on the functional development requirements input on the intelligent interactive interface, trigger the intelligent agent to output the programming interface required to meet the functional development requirements;

[0191] 503. Obtain the feature information of the programming interface;

[0192] 504. Based on the feature information of the programming interface, determine the target code used to call the programming interface;

[0193] 505. Display the target code on the intelligent interactive interface;

[0194] The intelligent interactive interface includes a human-computer interaction interface provided by an intelligent assistant.

[0195] For the specific implementation of steps 501 to 505 above, please refer to the relevant content in other embodiments, which will not be described in detail here. In addition, the method provided in this embodiment may include other steps besides those shown above. For the other steps and their specific implementation, please refer to the relevant content in other embodiments.

[0196] This application also provides yet another method for generating code to connect to a programming interface. The execution entity of this method is specifically the client. Specifically, the method includes the following steps:

[0197] 601. Display the client interface;

[0198] 602. Respond to input operations on the client interface and obtain the input functional development requirements;

[0199] 603. Send the aforementioned functional development requirements to the server;

[0200] 604. On the client interface, display the target code returned by the server;

[0201] The target code is generated based on various metadata of the programming interface after the required programming interface is determined based on the functional development requirements.

[0202] For the specific implementation of steps 601 to 604 above, please refer to the relevant content in other embodiments, which will not be described in detail here. In addition, the method provided in this embodiment may include other steps besides those shown above. For the other steps and their specific implementation, please refer to the relevant content in other embodiments.

[0203] It should be noted that some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear in this document, or they may be executed in parallel. The operation numbers, such as 101, 102, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should also be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.

[0204] This application also provides an apparatus corresponding to the above-described method embodiments. Specifically:

[0205] One embodiment of this application provides a code generation apparatus for connecting a programming interface, including: an acquisition module and a generation module. The acquisition module is used to acquire various metadata of the programming interface through reasoning. The generation module is used to generate target code based on the various metadata of the programming interface.

[0206] Furthermore, the aforementioned acquisition module is also used to: respond to input operations and acquire the input functional development requirements. The device also includes an input / output module, used to take the functional development requirements as input to a preset interface positioning model and output at least one programming interface. The programming interface is output in the form of three elements, including the service providing the programming interface, the service version, and the programming interface name.

[0207] Furthermore, the device also includes: a checking module and a determining module. The checking module is used to check the three elements of the programming interface. The determining module is used to determine that the programming interface does not exist when an unrepairable error element is detected among the three elements; and to determine feedback information based on the error element; wherein the feedback information includes a suggested element location tool. The aforementioned input / output module is also used to input the feedback information to the interface location model to trigger the interface location model to re-output.

[0208] Furthermore, the aforementioned input / output module, when used to take the functional development requirements as input to a preset interface positioning model and output at least one programming interface, can be specifically used to: input the functional development requirements into the intelligent agent and output the at least one programming interface; wherein the intelligent agent is constructed based on the interface positioning model.

[0209] Furthermore, if there are multiple programming interfaces, then: when the above-mentioned generation module generates target code based on various metadata of the programming interfaces, it is specifically used to: determine the dependencies between the multiple programming interfaces; and generate the target code based on the various metadata of the multiple programming interfaces and the dependencies.

[0210] Furthermore, the aforementioned generation module, when used to generate target code based on various metadata of the programming interface, is specifically used for: obtaining the required programming language based on the functional development requirements; determining a code generation strategy based on the required programming language; if the code generation strategy is a first strategy, obtaining reference code based on the programming interface and its various metadata; generating the target code based on the various metadata of the programming interface and the reference code; if the code generation strategy is a second strategy, generating the target code based on the various metadata of the programming interface.

[0211] Furthermore, the aforementioned acquisition module, when acquiring various metadata of the programming interface, is specifically used for: performing parameter reasoning on the programming interface to infer the parameter information required to call the programming interface; if the parameter information conforms to preset interface parameter rules, then acquiring description information related to the programming interface; if the parameter information does not conform to the interface parameter rules, then triggering re-execution of the parameter reasoning on the programming interface; if it conforms, then acquiring description information related to the programming interface; the description information includes at least one of the following: access service point, supported programming language, and security specifications.

[0212] Another embodiment of this application also provides a code generation apparatus for connecting programming interfaces. The apparatus includes: a determining module, an acquiring module, and a generating module. The determining module is used to determine the required programming interfaces based on input functional development requirements. The acquiring module is used to acquire, if multiple programming interfaces are determined, the feature information of each programming interface and the dependencies between the multiple programming interfaces. The generating module is used to generate target code for calling the multiple programming interfaces based on the feature information and the dependencies.

[0213] Another embodiment of this application also provides a code generation device for connecting programming interfaces. The device includes: an acquisition module, an input / output module, a feedback module, and a generation module. The acquisition module is used to acquire functional development requirements. The input / output module is used to input the functional development requirements into a preset interface positioning model and output at least one programming interface. The feedback module is used to provide feedback to the interface positioning model when a non-existent programming interface is detected among the at least one programming interface, triggering the interface positioning model to re-output. The generation module is used to generate target code for calling the at least one programming interface based on the metadata of the at least one programming interface.

[0214] Another embodiment of this application also provides a code generation apparatus for connecting a programming interface. The apparatus includes: a trigger module, an acquisition module, and a generation module. The trigger module is used to trigger an intelligent agent to output at least one programming interface required to meet input functional development requirements. The acquisition module is used to acquire various metadata of the at least one programming interface. The generation module is used to generate target code for calling the at least one programming interface based on the various metadata of the at least one programming interface.

[0215] Another embodiment of this application also provides a code generation device for connecting a programming interface. The device includes: a display module, a trigger module, an acquisition module, a determination module, and a presentation module. The display module is used to display an intelligent interactive interface. The trigger module is used to trigger the intelligent agent to output the programming interface required to meet the functional development requirements input on the intelligent interactive interface. The acquisition module is used to acquire the feature information of the programming interface. The determination module is used to determine the target code for calling the programming interface based on the feature information of the programming interface. The presentation module is used to display the target code on the intelligent interactive interface. The intelligent interactive interface includes a human-computer interaction interface provided by an intelligent assistant.

[0216] Another embodiment of this application also provides a code generation apparatus for connecting a programming interface. The apparatus includes: a display module, an acquisition module, and a sending module. The display module is used to display a client interface. The acquisition module is used to respond to input operations on the client interface and acquire the input functional development requirements. The sending module is used to send the functional development requirements to a server. The display module is also used to display the target code returned by the server on the client interface; wherein the target code is generated based on various metadata of the programming interface after the required programming interface is determined based on the functional development requirements.

[0217] It should be noted that the above-mentioned devices can implement the technical solutions described in the corresponding method embodiments. The specific implementation principles of each module or unit can be found in the relevant content of the corresponding method embodiments, and will not be elaborated here.

[0218] This application also provides a code generation system, as shown in [reference]. Figure 2 As shown, the system includes a client and a server. The client is used to implement the content related to steps 301-304 described in the other embodiments above. The server is used to implement the content related to steps 101-104 and steps 201-205 described in the other embodiments above.

[0219] Of course, if the client has logical processing capabilities (such as an all-in-one computer), the steps in the methods provided in this application can also be executed on the client side.

[0220] For a detailed description of the client and server, please refer to the relevant content in other embodiments, which will not be described in detail here.

[0221] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, in practice, this electronic device includes a memory 41 and a processor 42.

[0222] Memory 41 is used to store computer programs and can be configured to store various other data to support operation on the electronic device. Examples of this data include instructions for any application or method used to operate on the electronic device, data structures, contact data, phone book data, messages, pictures, videos, etc.

[0223] The processor 42, coupled to the memory 41, is used to execute the computer program in the memory 42 to implement the steps in the various method embodiments provided in this application.

[0224] Furthermore, such as Figure 4 As shown, the electronic device also includes other components such as a communication component 43, a display 44, a power supply component 45, and an audio component 46. Figure 4 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 4 The components shown. Additionally... Figure 4 The components within the dashed box are optional, not mandatory, and their specific requirements depend on the product form of the electronic device. The electronic device in this embodiment can be a client device (such as a desktop computer, laptop, smartphone, or IoT device) or a server device (such as a conventional server, cloud server, or server array). If the electronic device in this embodiment is implemented as a client device, it may include... Figure 4 The components within the dashed box; if the electronic device in this embodiment is implemented as a server device, it may not include... Figure 4 The component within the dashed box.

[0225] The aforementioned memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0226] The aforementioned communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices. The device containing the communication component can access wireless networks based on communication standards, such as 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.

[0227] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.

[0228] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.

[0229] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.

[0230] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the above-described method embodiments. The computer-readable storage medium includes volatile or non-volatile components, or a combination thereof, and can be removable or non-removable. Examples of computer-readable storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random-access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium.

[0231] Accordingly, this application also provides a computer program product, which includes a computer program or instructions that, when executed by a processor, cause the processor to implement the steps in the above method embodiments. It should be understood that each step or combination of steps in the above method flow can be implemented by the computer program or instructions. Furthermore, these computer programs or instructions can be applied to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device, enabling the processor of the general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to function as an apparatus for implementing the corresponding functions in the above method embodiments.

[0232] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0233] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for generating code to connect to a programming interface, characterized in that, include: The development requirement is to respond to input operations and obtain input functionality. The aforementioned functional development requirements are used as input to a pre-defined interface positioning model, and at least one programming interface is output. Various metadata of the programming interface are obtained through reasoning; Based on various metadata from the programming interface, generate target code; The target code is used to call the programming interface; The programming interface is output in the form of three elements, which include the service that provides the programming interface, the service version, and the programming interface name.

2. The method according to claim 1, characterized in that, Also includes: The three elements of the programming interface are checked; When an unrepairable error element is detected among the three elements, it is determined that the programming interface does not exist; Based on the erroneous element, determine the feedback information; wherein, the feedback information includes a suggested element location tool; The feedback information is input into the interface positioning model to trigger the interface positioning model to output again.

3. The method according to claim 1, characterized in that, The aforementioned functional development requirements are used as input to a pre-defined interface positioning model, and at least one programming interface is output, including: Input the aforementioned functional development requirements into the intelligent agent and output at least one programming interface; The intelligent agent is constructed based on the interface localization model.

4. The method according to any one of claims 1 to 3, characterized in that, If there are multiple programming interfaces, then Based on various metadata from multiple programming interfaces, target code is generated, including: Determine the dependencies between the multiple programming interfaces; The target code is generated based on various metadata of the multiple programming interfaces and the dependencies.

5. The method according to any one of claims 1 to 3, characterized in that, Based on various metadata from the programming interface, target code is generated, including: Based on the aforementioned functional development requirements, obtain the required programming language; Determine the code generation strategy based on the required programming language; If the code generation strategy is the first strategy, then reference code is obtained based on the programming interface and various metadata of the programming interface; and the target code is generated based on the various metadata of the programming interface and the reference code. If the code generation strategy is the second strategy, then the target code is generated based on various metadata of the programming interface.

6. The method according to any one of claims 1 to 3, characterized in that, Obtain various metadata from the programming interface, including: Perform parameter reasoning on the programming interface to deduce the parameter information required to call the programming interface; If the parameter information conforms to the preset interface parameter rules, then inference is performed to obtain the description information related to the programming interface; If the parameter information does not conform to the interface parameter rules, then the parameter reasoning of the programming interface will be re-executed. The description information includes at least one of the following: access service point, supported programming language, and security specifications.

7. A method for generating code to connect to a programming interface, characterized in that, include: Based on the input functional development requirements, determine the programming interface to be used; If multiple programming interfaces are identified, the feature information of each programming interface and the dependency relationship between the multiple editing interfaces are obtained. Based on the feature information and the dependency relationships, target code for calling the multiple programming interfaces is generated.

8. A method for generating code to connect to a programming interface, characterized in that, include: Obtain feature development requirements; Input the aforementioned functional development requirements into a preset interface positioning model, and output at least one programming interface; When a non-existent programming interface is detected in at least one of the programming interfaces, feedback is sent to the interface location model, triggering the interface location model to re-output. Based on the metadata of the at least one programming interface, generate target code for calling the at least one programming interface.

9. A method for generating code to connect to a programming interface, characterized in that, include: Based on the functional development requirements of the input, the agent is triggered to output at least one programming interface required to meet the requirements. Obtain various metadata from the at least one programming interface; Based on various metadata of the at least one programming interface, generate target code for calling the at least one programming interface.

10. A method for generating code to connect to a programming interface, characterized in that, include: Provides an intelligent interactive interface; Based on the functional development requirements input on the intelligent interactive interface, the intelligent agent is triggered to output the programming interface required to meet the functional development requirements. Obtain the feature information of the programming interface; Based on the feature information of the programming interface, determine the target code used to call the programming interface; The target code is displayed on the intelligent interactive interface; The intelligent interactive interface includes a human-computer interaction interface provided by an intelligent assistant.

11. A method for generating code to connect to a programming interface, characterized in that, include Display the client interface; The function development requirements for responding to input operations on the client interface and obtaining the input are as follows: Send the aforementioned functional development requirements to the server; The target code returned by the server is displayed on the client interface; The target code is generated based on various metadata of the programming interface after the required programming interface is determined based on the functional development requirements.

12. A code generation system for connecting to a programming interface, characterized in that, include: A client is configured to implement the method described in claim 11 above; A server-side component for implementing the method described in any one of claims 1 to 10.

13. An electronic device, characterized in that, include: Memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is configured to execute the program stored in the memory to implement the method of any one of claims 1 to 11.

14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a computer, it can implement the method of any one of claims 1 to 11.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 11.