API design method and device based on large model, electronic equipment and storage medium

By fine-tuning the large model for API design questions and answer templates, the problem that existing API design technologies are difficult to provide high-quality design suggestions is solved, and more accurate and professional API design results are achieved.

CN119597263APending Publication Date: 2025-03-11TRAVELSKY TECHNOLOGY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411642667.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

Existing API design technologies are difficult to provide high-quality API design advice, especially in professional fields and English writing, and lack specific design guidance and packaging object name suggestions.

Method used

By designing questions and answer templates for API design, fine-tune the big model to obtain a big model for API design, use the big model to answer users' API design questions, and generate API design results.

Benefits of technology

Improves the quality and accuracy of API design, provides API design suggestions in professional fields and correct writing of English fields, simplifying developers' work in API design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597263A_ABST
    Figure CN119597263A_ABST
Patent Text Reader

Abstract

The invention provides an API design method and device based on a large model, electronic equipment and a storage medium. Three different training modes are adopted for an original large model, a large model oriented to API design is obtained, and the training modes are training based on preset answers and answer templates, training based on retrieval enhancement and training based on multi-agent framework construction; according to the large model-based API design method provided by the invention, an artificial intelligence large model is finely adjusted or trained to obtain an API design-oriented large model, and the large model can better understand design characteristics in the API design field, so that convenience can be provided for developers, and the software quality is convenient to maintain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of information technology, and in particular relates to a large model API-based design method, device, electronic device and storage medium. Background Art

[0002] In the process of software development, poor-quality API (Application Programming Interface) design will trouble developers and is not conducive to subsequent software quality maintenance. Therefore, it is necessary to design or develop high-quality APIs to meet the business needs of enterprises. However, it is not easy to design high-quality APIs that are recognized by the industry. It requires not only basic development knowledge, but also professional English knowledge in special fields, because APIs need to be written in English.

[0003] Existing API design technology can only provide general design rules for fields. For example, Java uses camel case to name fields, and some English fields can be abbreviated, such as Number is shortened to No. These simple programming rules do not point out more detailed issues. For example, for the field "Aviation festival", which specific English word should be used? Ordinary developers have no such professional vocabulary, and it is difficult to design reasonable and professional API fields. However, using "Aviation festival" as a result obtained from Baidu's webpage is wrong. Existing API design technology only gives common suggestions such as reasonable parameters and not too many parameters. However, in actual development, there are more parameters, and when multiple parameters must be encapsulated into one object, are there any specific suggestions for the name of the encapsulated object? Summary of the invention

[0004] In view of the deficiencies in the prior art, the present invention provides a large model API design method, the method comprising:

[0005] Design question and answer templates for API design;

[0006] The problems designed for the API are used as training samples, and the original large model is fine-tuned using the training samples to obtain a large model designed for the API;

[0007] Based on the answer template for API design and the large model for API design, the API design questions input by the user are answered and the API design results are generated.

[0008] Furthermore, the original big model includes: ChatGPT's open source interface, LLAMA2 open source big model or the enterprise's own big model.

[0009] A method for API design based on a large model is based on retrieval enhancement generation, the method comprising: establishing an API professional knowledge database, and using the data in the API professional knowledge database as data samples to fine-tune the large model to obtain a large model for API design;

[0010] The API design problem input by the user is queried through the query engine in the API professional knowledge base to obtain multiple API design problems with a high degree of relevance to the API design problem input by the user;

[0011] The API design problem input by the user and the multiple API design problems are input into the large model for API design, and an API design result is output.

[0012] Furthermore, the storage format of the API professional knowledge base is a dictionary format or a text description format.

[0013] Furthermore, when the API design problem input by the user is consistent with the API knowledge stored in the API professional knowledge base, the API knowledge is output as the API design result.

[0014] A large model API design method is based on building a multi-agent framework, and the method includes:

[0015] Design original API design questions and standard answers to original API design questions;

[0016] Input the original API design problem as a training sample into the first large model, and generate an API design answer;

[0017] Inputting the API design answers and the standard answers to the original API design questions into the second largest model;

[0018] The second large model compares the API design answer with the standard answer to the original API design question, generates a review opinion, and feeds it back to the first large model to determine whether the first large model has finished training;

[0019] The user inputs the required API design problem into the first large model that has completed training, and outputs the API design result.

[0020] Furthermore, the determining whether the first large model has finished training includes: when the review opinion is that the API design answer is consistent with the standard answer to the original API design question, the first large model finishes training;

[0021] When the comparison result shows that the API design answer is inconsistent with the standard answer to the original API design question, the first large model regenerates the API design answer and compares it again through the second large model until the comparison result shows that the API design answer is consistent with the standard answer to the original API design question, and the training of the first large model ends.

[0022] A large model based API design device, the device comprising: a data storage module, a large model training module and an API design module;

[0023] The data storage module is used to store its own business or professional API professional knowledge database to provide data support for fine-tuning or training large artificial intelligence models;

[0024] The large model training module is used to train the large model to obtain a large model designed for API;

[0025] The API design module is used to input the original API design problem into the established large model oriented to API design to obtain the API design result.

[0026] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements any of the method steps described above.

[0027] An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0028] Memory, used to store computer programs;

[0029] The processor is used to implement any of the method steps described above when executing the program stored in the memory.

[0030] Compared with the prior art, the present invention has the following advantages:

[0031] The present invention proposes a big model-based API design method, which obtains a big model for API design by fine-tuning or training the artificial intelligence big model, so that the big model can better understand the design features in the API design field, thereby providing convenience to developers and facilitating the maintenance of software quality.

[0032] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A schematic flow chart of a large model API design method according to the present invention is shown.

[0035] Figure 2 A schematic diagram of a process of retrieval-enhanced generation based on a large model API design method of the present invention is shown.

[0036] Figure 3 A schematic diagram of a process generated based on a large model API design method and a multi-agent framework is shown in the present invention.

[0037] Figure 4 A schematic diagram of a large model API design device according to the present invention is shown. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] An embodiment of the present invention provides a large model API design method, such as Figure 1 As shown, the steps include:

[0040] A1. Design questions and answer templates specific to API design; design different answers based on different questions to improve the AI ​​model’s ability to understand API design problems.

[0041] Optionally, the question template includes: common API design questions, for example, "How should I design xx as a professional English API field";

[0042] The answer template may be “You may use yy as the professional English API field” or the like.

[0043] A2. Use the questions designed in step S1 as training data sets and fine-tune the original AI model.

[0044] Optionally, the original artificial intelligence big model includes: ChatGPT's open source interface, LLAMA2 and other open source big models, or the enterprise's own big model.

[0045] A3. End the fine-tuning process of step S2, obtain an artificial intelligence large model for API design, answer API design questions based on the designed answer template, and generate API design results.

[0046] Another embodiment provided by the present invention is as follows: Figure 2 As shown, a large model-based API design method is based on retrieval-enhanced generation, and the steps include:

[0047] B1. Establish an API professional knowledge database, and use the data in the API professional knowledge database as training samples to fine-tune the artificial intelligence big model to obtain an artificial intelligence big model for API design.

[0048] Optionally, the storage format in the API expertise database can be a dictionary format (Chinese API field, English API field) or a text description format (the English API field corresponding to the Chinese API field is, for example, "the Chinese API field is designed as an English API field, the result is xx", "the Chinese API field corresponds to the API field design is xx").

[0049] B2. The original API design question input by the user is searched through the query engine to search for multiple API design questions with a high correlation with the original API design question in the API professional knowledge base.

[0050] Optionally, when the input original API design problem is consistent with the API knowledge stored in the API professional knowledge base, the search results of the API knowledge are directly fed back and the API knowledge is used as the final API design result.

[0051] B3. The original API design problem and multiple highly correlated API design problems retrieved from the API professional knowledge base are sorted into new problems, and the API design results are output through the artificial intelligence big model for API design established in step S1.

[0052] Optionally, the querying the original API design problem and multiple highly correlated API design problems from the API professional knowledge base includes:

[0053] When the original question is "Design the creation date as an API field", and the knowledge base already has "The API field for creation time is createTime", then the answer to the API field design for the creation date in the original question should be createDate, not buildDate, establishDate, etc.;

[0054] Alternatively, when the original API design problem is "the English API field design of the airline is", multiple API design problems with a high degree of correlation may be "the English API field design of the airline in Beijing, China is xx", "the English API field design of the large airline is yy", etc.

[0055] The method for outputting the API design result includes: in the known professional knowledge base, 'the English API field design of the airline in Beijing, China is xx', 'the English API field design of the large airline is yy', and according to these professional knowledge, the English API field of the airline can be designed as? etc.

[0056] In another embodiment provided by the present invention, Figure 3 As shown, a large model API design method is based on building a multi-agent framework, and its steps include:

[0057] C1. Design original API design questions and standard answers.

[0058] C2. Input the original API design problem into the artificial intelligence model A and obtain the answer A for API design.

[0059] C3. Input answer A and the standard answer to the original API design question into artificial intelligence big model B, and use artificial intelligence big model B to compare answer A and the standard answer to the original API design question.

[0060] Optionally, when answer A is consistent with the standard answer, the API design problem is successful and feedback is given to the artificial intelligence big model A, and the artificial intelligence big model A ends training.

[0061] When answer A is inconsistent with the standard answer, AI big model A receives the inconsistent content fed back by AI big model B and redesigns the API based on the feedback; AI big model A finishes training until the API design for the designed question is consistent with the standard answer.

[0062] C4. Through steps S1-S3, the API design capability of the artificial intelligence big model A in the professional field is trained to obtain an artificial intelligence big model for API design.

[0063] When the user inputs other API design questions, the questions are given to the trained artificial intelligence model A to obtain the API design results.

[0064] A device designed based on a large model API, such as Figure 4 As shown, the device includes: a data storage module, a large model training module and an API design module.

[0065] The data storage module is used to store its own business or professional API expertise database to provide data support for fine-tuning or training large models.

[0066] The large model training module is used to fine-tune or train the artificial intelligence large model to obtain an artificial intelligence large model for API design.

[0067] The API design module is used to input the original API design problem into the established artificial intelligence large model for API design to obtain the API design result.

[0068] Based on the above disclosed content, the present invention also provides an electronic device accordingly. The electronic device of an embodiment of the present invention includes at least one electrically connected processor and at least one storage medium, the storage medium is electrically connected to the processor, wherein the storage medium stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method as described above.

[0069] Based on the same inventive concept, the present invention also provides a storage medium, which stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method as described above.

[0070] It should be noted that the electrical connection between the above-mentioned units does not necessarily mean the connection between lines. An indirect connection method can be applied to the embodiments of the present invention as long as the purpose of the present invention is achieved.

[0071] The above description and the accompanying drawings fully illustrate the embodiments of the present invention so that those skilled in the art can practice them. Other embodiments may include structural and other changes. The embodiments represent only possible variations. Unless explicitly required, individual components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The embodiments of the present invention are not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A large model API design method, characterized in that: The method comprises: Design question and answer templates for API design; The problems for API design are used as training samples, and the original large model is fine-tuned using the training samples to obtain a large model for API design; Based on the answer template for API design and the big model for API design, the API design questions input by the user are answered and the API design results are generated.

2. The large model API design method according to claim 1 is characterized in that: The original large model includes: ChatGPT's open source interface, LLAMA2 open source large model or the enterprise's own large model.

3. A large model API design method based on retrieval-enhanced generation, characterized in that: The method comprises: Establish an API professional knowledge database, and use the data in the API professional knowledge database as data samples to fine-tune the big model to obtain a big model for API design; The API design problem input by the user is queried in the API professional knowledge base through the query engine to obtain multiple API design problems that are highly related to the API design problem input by the user; The API design problem input by the user and the multiple API design problems are input into the large model for API design, and the API design result is output.

4. The large model API design method according to claim 3 is characterized in that: The storage format in the API professional knowledge base is a dictionary format or a text description format.

5. The large model API design method according to claim 3 is characterized in that: When the API design problem input by the user is consistent with the API knowledge stored in the API professional knowledge base, the API knowledge is output as the API design result.

6. A large model API design method based on building a multi-agent framework, characterized in that: The method comprises: Design original API design questions and standard answers to original API design questions; Input the original API design problem as a training sample into the first large model, and generate an API design answer; Input the API design answers and the standard answers to the original API design questions into the second largest model; The second large model compares the API design answer with the standard answer to the original API design question, generates a review opinion, and feeds it back to the first large model to determine whether the first large model has finished training; The user inputs the required API design problem into the first large model that has completed training, and outputs the API design result.

7. The large model API design method according to claim 6, characterized in that: The determining whether the first large model has finished training includes: when the review opinion is that the API design answer is consistent with the standard answer to the original API design question, the first large model finishes training; When the review opinion is that the API design answer is inconsistent with the standard answer to the original API design question, the first large model regenerates the API design answer and compares it again through the second large model until the comparison result is that the API design answer is consistent with the standard answer to the original API design question, and the first large model ends training.

8. A device for designing a large model API, characterized in that: The device comprises: a data storage module, a large model training module and an API design module; The data storage module is used to store its own business or professional API expertise database to provide data support for fine-tuning or training large artificial intelligence models; The large model training module is used to train the large model to obtain a large model for API design; The API design module is used to input the original API design problem into the established large model for API design to obtain the API design result.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.