Method for generating back-end interface by large language model based on dynamic embedding mechanism
Through the dynamic embedding mechanism, the knowledge base and large language model are combined, which solves the problems of long data update cycles and static search results in traditional technology, and efficient generation and automation of interface metadata are realized, and the real-time and accuracy of the system are improved.
Patent Information
- Application Number
- CN202411778022.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-15
AI Technical Summary
The existing technology is difficult to effectively integrate knowledge bases and large language models, resulting in a long data update cycle, static search results, efficiency and consistency, and the automatic generation of interface metadata cannot be fully realized.
Through the dynamic embedding mechanism, the historical data in the structured database is imported into the knowledge base, and the multimodal attention mechanism is used to fuse user input and knowledge base search results to build a dynamic embedding layer, realize the efficient combination of large language models and knowledge bases, and generate interface metadata.
Real-time and dynamic nature are achieved, the efficiency and accuracy of interface metadata generation is improved, manual intervention is reduced, development costs are significantly reduced, and the interface expansion capabilities are improved.
Smart Images

Figure CN119829660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method for generating a backend interface from a large language model based on a dynamic embedding mechanism. The method is specifically applied to a scenario in which natural language requirements are parsed through a large language model and interface metadata is efficiently generated, and belongs to the intersection of artificial intelligence and software development automation technology. Background Art
[0002] With the rapid development of artificial intelligence technology, large language models (LLM) have demonstrated powerful capabilities in the field of natural language processing. Applications based on large language models have gradually penetrated into multiple scenarios such as intelligent dialogue, text generation, and semantic analysis. However, in the development of complex back-end systems, how to use large language models to automatically generate interface metadata is still a technical difficulty.
[0003] The development process of traditional backend interfaces usually relies on developers to manually design and implement according to the requirements document, including interface function definition, data structure normalization, syntax verification and other steps. This process has high requirements on the experience and technical level of developers. At the same time, the entire process may introduce delays or errors due to manual participation, making it difficult to adapt to the needs of rapid iteration development. In recent years, the rise of low-code development platforms has alleviated this problem to a certain extent, but the interface development of low-code platforms still requires developers to predefine data models or manually configure interface logic, and cannot be fully automated.
[0004] At the same time, knowledge bases, as storage and retrieval tools for structured information, are widely used in information query and knowledge management. By introducing real-time update mechanisms and efficient retrieval technologies, such as Elasticsearch, knowledge bases can provide higher accuracy and timeliness in large-scale data processing. However, traditional knowledge bases have the following shortcomings in combination with large language models:
[0005] Traditional knowledge bases have a long data update cycle and cannot match the data needs generated in real time; knowledge base retrieval results are usually provided in a static form, failing to fully utilize the contextual understanding capabilities of the language model to dynamically optimize the generated results; knowledge base optimization and language model training are two independent processes that fail to achieve mutual coordination, resulting in difficulty in ensuring efficiency and consistency.
[0006] In order to solve these problems, some studies have begun to try to combine knowledge bases with large language models to improve the ability of natural language understanding and generation through dynamic data updates and deep integration. However, in practice, such methods are often limited by computing resource overhead and lack of real-time performance, and a mature solution has not yet been formed. In addition, how to efficiently convert natural language requirements into executable interface metadata and quickly deploy them in low-code platforms is still a key problem that needs to be solved in the current technological development.
[0007] To sum up, in order to solve the above problems, there is an urgent need for a new technical solution that can effectively integrate knowledge bases and large language models. Summary of the invention
[0008] In order to solve the above problems in the prior art, the present invention proposes a method for generating a backend interface based on a large language model with a dynamic embedding mechanism, which is characterized by comprising the following steps:
[0009] Step 1: Extract historical data related to the back-end interface from the existing system; and store the cleaned data in a structured database according to field classification;
[0010] Step 2: Import historical data from the structured database into the knowledge base by indexing the structure and using the real-time synchronization mechanism;
[0011] Step 3: Load the large language model and use the knowledge base retrieval results as input features to build a dynamic embedding layer to inject the latest data into the context of the large language model training;
[0012] Step 4: Analyze natural language requirements using the large language model to identify user intent and key entities; and generate interface metadata based on context understanding capabilities and the dynamic embedding characteristics of the knowledge base;
[0013] Step 5: Perform syntax verification and data structure normalization on the generated interface metadata, and optimize the generation process using the dynamic embedding layer;
[0014] Step 6: Import the generated interface metadata into the low-code prototype builder and generate an interface prototype to complete functional verification.
[0015] The historical data related to the development and use of the back-end interface is extracted from the existing system, specifically including the interface name, function description, parameter definition, call frequency, return value format and call examples; the field classification includes basic interface information, parameter information, call characteristics and sample data.
[0016] The index structure includes field definition, index strategy and word segmentation rules.
[0017] The step 3 further comprises the following steps:
[0018] 3.1: Extract features from the natural language requirements Q input by the user and generate feature vector V Q ;
[0019] 3.2: Based on V Q Search the knowledge base and extract the interface information R={r1,r2,…,r i ,…,r n};
[0020] 3.3: For each retrieved interface related information r i Generate its corresponding feature vector i ranges from 1 to n; n is the number of interface related information;
[0021] 3.4: Use the multimodal attention mechanism to input the user feature vector V Q and the retrieval result feature vector Fusion, generating dynamic embedding vectors Among them, α i is the attention weight calculated by the following formula:
[0022]
[0023] Where W is a learnable linear transformation matrix, and d is a vector dimension normalization factor;
[0024] 3.5: Dynamically embed vector V E With the user input feature vector V Q Combined, a complete context vector is constructed for the large language model to generate interface metadata. V Q The transpose of .
[0025] The dynamic embedding vector V E The generation of adopts an incremental update strategy, which includes: generating a sequence G = {g1, g2, ..., g i ,…,g t} to generate the current context vector C t =Concat(V Q ,V E ,V G ); Update the dynamic embedding vector V by incrementally optimizing the network E , the dynamic embedding vector V E At each generation time t, based on the current context C t Update generation get
[0026] in:
[0027] G t is the context vector at the current generation time t:
[0028] V G is the embedding vector of the generated sequence, which represents the sequence G = {g1, g2, ..., g t}'s semantic representation;
[0029] g i Represents the i-th generated content in the generated sequence;
[0030] and are the dynamic embedding vectors at generation time t+1 and t respectively;
[0031] GRU (Gated Recurrent Unit): Recurrent neural network (RNN) structure used to process sequence data;
[0032] Concat: Vector concatenation operation, which connects multiple feature vectors into a longer feature vector to represent comprehensive semantics.
[0033] The key entities in step 4 include interface name, function description, parameter information and return value format; the generated interface metadata includes interface name, parameter definition and return value format.
[0034] The generated interface metadata is optimized using a dynamic embedding layer, and through real-time updating and fusion, attention optimization and feedback loop optimization, it is ensured that the generated results can dynamically reflect the latest content of the knowledge base and accurately meet user needs; the generated interface metadata is personalized and the order or naming style of the interface parameters is optimized according to user needs.
[0035] The step 6 further comprises:
[0036] Convert the generated interface metadata into a new format and import it into the low-code platform;
[0037] Automatically generate interface prototypes, including automatic mapping and configuration of interface names, parameter lists, and return value formats;
[0038] Deploy the generated interface prototype to the test environment of the low-code platform;
[0039] Use low-code platform tools to bind interfaces to implement logic and perform functional verification;
[0040] Design and execute test cases, covering interface functionality, stability and performance testing;
[0041] Debug and optimize the interface.
[0042] The present invention realizes the efficient combination of large language model and knowledge base through dynamic embedding mechanism, which has the following advantages:
[0043] Beneficial effects:
[0044] 1. Real-time and dynamic: By building a knowledge base that supports real-time updates and introducing a dynamic embedding layer, we ensure that the latest content of the knowledge base can be quickly injected into the model context, achieving real-time and consistency in the interface metadata generation process.
[0045] 2. Efficiency: Multi-task learning is used to combine knowledge base optimization with large language model fine-tuning, reducing repeated steps in the training and generation process, and greatly improving the operating efficiency and response speed of the model.
[0046] 3. Accuracy: The weights of knowledge base retrieval results are dynamically adjusted through a multimodal attention mechanism, so that the generated interface metadata can accurately reflect user needs and reduce the interference of redundant and erroneous information.
[0047] 4. Automation and standardization: The present invention can automatically parse natural language requirements, generate interface metadata that meets standard specifications, and improve the quality and applicability of generated results through syntax verification and data standardization processing.
[0048] 5. Adaptability and scalability: The generated interface metadata can be directly imported into the low-code platform, combined with automated testing and verification, to quickly complete interface development and verification, significantly reducing development costs and improving the interface's scalability.
[0049] The present invention improves the efficiency and intelligence of the entire process from demand analysis to interface generation, and provides an efficient and reliable solution for large-scale interface development and management. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application, but do not constitute an improper limitation of the present invention. In the drawings:
[0051] Figure 1 A flow chart of the method of the present invention is shown. DETAILED DESCRIPTION
[0052] The present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments, wherein the exemplary embodiments and descriptions are only used to explain the present invention, but are not intended to limit the present invention. Figure 1 The specific implementation steps of the present invention include the following contents:
[0053] Step 1: Collect historical data and clean and summarize
[0054] 1.1 Collection of historical data
[0055] Extract historical data related to the development and use of backend interfaces from existing systems, including but not limited to the following: interface name, function description, parameter definition, call frequency, return value format, call examples and their associated usage scenarios, etc. This data is usually stored in existing log files, API documents or databases. To ensure the comprehensiveness and reliability of the collection process, multi-source data extraction technology can be used to collect relevant information from multiple channels such as distributed databases, file systems, and version management tools.
[0056] 1.2 Data cleaning and summarization
[0057] Cleaning and summarizing the collected historical data mainly includes the following steps:
[0058] Remove redundant data: By comparing multiple versions of the same interface, remove duplicate information and merge logically consistent data;
[0059] Process incomplete data: Supplement missing parameter information or call examples in interface calls to ensure the integrity of data fields;
[0060] Verify data consistency: Check the logical consistency of data format and content according to the interface design specifications, such as whether the parameter type is correct, whether the description matches the function, etc.;
[0061] Abnormal data removal: remove abnormal data with incorrect format, not meeting interface specifications or failed calls.
[0062] After the cleaning is completed, the data is classified and summarized according to fields (such as interface name, parameter definition, call frequency, etc.) to ensure that the data is organized reasonably to facilitate subsequent operations and retrieval.
[0063] 1.3 Data Storage
[0064] The cleaned and summarized interface history data is stored in a structured database. The database used may include a relational database (such as MySQL, PostgreSQL) or a NoSQL database (such as MongoDB, Cassandra) to meet the storage requirements of different scenarios. The specific storage content includes:
[0065] Basic interface information: interface name, function description;
[0066] Parameter information: parameter name, data type, whether it is a required item, default value, etc.;
[0067] Call characteristics: call frequency, access rights, performance indicators, etc.
[0068] Sample Data: Sample input and output data for easier understanding and testing.
[0069] During the storage process, the data structure is further optimized, such as using primary keys and indexes to improve query efficiency, ensure data integrity and consistency, and facilitate subsequent integration with the knowledge base system. Through the above steps, a standardized and structured historical data storage system is formed, providing a high-quality original data foundation for the subsequent construction of the knowledge base and model training.
[0070] Step 2: Build a knowledge base
[0071] 2.1 Knowledge Base Design
[0072] Build a knowledge base based on Elasticsearch and comprehensively design the index structure including field definition, index strategy and word segmentation rules to meet the needs of efficient retrieval and data organization. Specifically:
[0073] Field definition: Based on the characteristics of historical data, define the key fields of interface historical data, such as interface name, parameter description, call frequency, return value format, etc. Each field needs to specify an appropriate data type (such as string, numeric value, or Boolean value) to ensure a clear storage structure;
[0074] Index strategy: according to the search requirements, set the number of index shards and copies to ensure efficient and stable search services under massive data;
[0075] Word segmentation rules: Based on the needs of natural language processing, design an adaptive word segmentation algorithm (such as standard word segmentation, Chinese word segmentation, or custom word segmentation) to achieve accurate word segmentation of interface function descriptions or parameter descriptions, thereby improving the accuracy of retrieval.
[0076] Through the above steps, the constructed knowledge base can support efficient query of multi-dimensional data and provide structured data support for the subsequent dynamic embedding mechanism.
[0077] 2.2 Data Synchronization
[0078] Using the real-time synchronization mechanism, historical data in the structured database is dynamically imported into the knowledge base to ensure the timeliness and consistency between the knowledge base and the source data. The specific implementation includes:
[0079] Data import tool: Use a stream processing framework (such as Logstash or Apache Kafka) as a data transmission tool to complete real-time data push from structured databases to Elasticsearch;
[0080] Incremental synchronization: By identifying new, modified, and deleted records in the source data, only the changed data is updated, thereby reducing the resource consumption of data synchronization;
[0081] Consistency guarantee: Distributed transaction control mechanism is used to ensure consistency during data transmission and writing, avoiding partial data loss or inconsistency caused by network or system failures.
[0082] This step significantly improves the dynamic update capability of the knowledge base and lays the foundation for real-time data retrieval and model interaction.
[0083] 2.3 Multi-layer caching mechanism
[0084] In the process of interaction between the knowledge base and the model, a multi-layer cache mechanism is introduced to further optimize data retrieval efficiency and reduce the delay caused by frequent access to the knowledge base. The specific implementation includes:
[0085] Local cache: For frequently queried data, set up model local cache, and store the recently used knowledge base search results in the model memory, which significantly reduces the number of knowledge base queries;
[0086] Distributed caching: Combine distributed caching tools (such as Redis or Memcached) to set up a global caching mechanism at the application layer to support cross-service data sharing and fast access;
[0087] Cache invalidation strategy: To ensure the real-time and accuracy of data, design a reasonable cache invalidation strategy, such as a time-based expiration mechanism or an active cleanup mechanism based on data updates, to dynamically clear expired or invalid data.
[0088] By introducing the above-mentioned multi-layer caching mechanism, the response speed and reliability of data retrieval are further improved while reducing the system load, thereby ensuring the efficient collaboration between the knowledge base and the large language model.
[0089] Step 3: Preprocess, train, and optimize the large language model
[0090] 3.1 Data Preprocessing
[0091] Before training the large language model, the data in the knowledge base is first preprocessed to generate training sets, validation sets, and test sets that meet the training requirements. The specific steps are as follows:
[0092] Data screening: Screen the content related to the interface historical data from the knowledge base, including interface name, parameter description, call example and other information, remove irrelevant and duplicate data, and ensure the pertinence and effectiveness of the data;
[0093] Word Segmentation: For text data, select an appropriate word segmentation algorithm according to the language characteristics. For example, for Chinese data, use a word segmentation algorithm based on statistical models; for English data, use standard space segmentation or sub-word segmentation algorithms combined with language models;
[0094] Stop Word Removal: Remove common stop words (such as "de", "shi", etc.) or perform custom processing on stop words in specific domains to reduce the interference of invalid information on model training;
[0095] Formatting: Perform unified formatting on the filtered text data, including:
[0096] Standardize punctuation marks;
[0097] Convert the data encoding format (such as unifying the data to UTF-8 encoding);
[0098] According to the training requirements, organize the text data in the form of "input - output", clarify the input content of the model and the expected target content to be generated, such as "natural language requirements → interface metadata".
[0099] Finally, the generated training set, validation set, and test set are stored in structured data files (such as JSON or CSV) to ensure that they can be directly input into the training process.
[0100] 3.2 Construction of the Dynamic Embedding Layer
[0101] After loading a pre-trained large language model (such as GPT series models), to efficiently utilize the dynamic retrieval results of the knowledge base, construct a "dynamic embedding" layer to dynamically inject the latest knowledge in the knowledge base into the model context.
[0102] By parsing the user's input natural language requirements, generate a preliminary retrieval request, and dynamically extract relevant content from the knowledge base, such as interface descriptions, parameter definitions, and call examples that match the requirement intent. The specific implementation includes:
[0103] Feature Extraction: Use a pre-trained model (such as BERT or RoBERTa) to extract the sentence vector V Q from the user's input natural language requirements Q, and use it as the feature vector;
[0104] Knowledge Base Retrieval: Based on the semantic vector of V Q , perform fuzzy matching or semantic retrieval in the knowledge base to extract the results R = {r1, r2,..., r i ,..., r n} related to the requirement, where each r i represents the interface-related information retrieved (such as interface name, parameter definition, etc.).
[0105] The results of knowledge base retrieval are embedded into the context of the model as additional input features. The specific steps are as follows:
[0106] Organize search content: Reorganize the knowledge base search results in text form, such as "matching interface: interface name; parameter definition: parameter list; example call: call example", etc., to ensure clear structure and facilitate model understanding;
[0107] The dynamic embedding algorithm is specifically based on the following steps to fuse the user input requirements and the knowledge base retrieval results into a complete context vector. The dynamic embedding algorithm adopts a multimodal attention mechanism to integrate the user input feature vector V Q The feature vector of the search result Fusion, generating dynamic embedding vector V E , thereby achieving effective utilization of knowledge base information. Represents the search result r i The feature vector of .
[0108] Dynamic embedding vector V E Calculated as:
[0109]
[0110] Dynamic embedding vector V E is the feature vector of all search results The weighted sum of i Represents the search result r i The importance relative to the user input Q, calculated by the attention mechanism.
[0111] The meanings of the parameters are as follows:
[0112] V E : Dynamic embedding vector, which represents the contextual information that integrates user input and knowledge base retrieval results, serves as an important input in the model generation process.
[0113] Knowledge base search results i The feature vector of the retrieval result text is embedded and generated through a pre-trained model (such as BERT, GPT, etc.).
[0114] α i :Search results i The attention weight of , which measures its relevance to the user input.
[0115] Attention weight α i The calculation formula is:
[0116]
[0117] Weight α iis the normalized value calculated by the attention mechanism, representing the user input Q and the retrieval result r i The numerator in the formula measures the similarity between the two, and the denominator is used to normalize the feature vector dimension to ensure calculation stability.
[0118] The meanings of the parameters are as follows:
[0119] α i :Search results i The attention weights are normalized by the softmax function so that the sum of all weights is equal to 1.
[0120] V Q : The feature vector of the user input requirement is generated by the embedding layer of the large language model, which represents the semantic representation of the user input. Transpose operation for a matrix or vector.
[0121] W: A learnable linear transformation matrix that transforms the retrieval result feature vector Project it to match the user input feature vector V Q Similarity calculation is performed in the same space.
[0122] Search Results i The feature vector is generated by the content retrieved from the knowledge base (such as interface description, parameter definition, etc.) after being processed by the embedded model.
[0123] d: The dimension of the feature vector, used to normalize the similarity score to prevent the vector dimension from being too large, which may lead to unstable calculation.
[0124] Softmax: Normalize the similarity scores so that the attention weights α of all retrieval results are i Between 0 and 1, and sum to 1.
[0125] pass Calculate the similarity between user input and search results to ensure that the weight is positively correlated with the demand relevance. The similarity scores are normalized by the softmax function to make the weight distribution smoother and adapt to the diverse search results. The importance of different search results is dynamically adjusted, and the model can focus on the search content most relevant to user needs, ensuring that the generated context vector V E Highest quality.
[0126] The above algorithms ensure that the knowledge base is integrated with user needs efficiently and accurately, providing key support for the model generation process. The importance of different retrieval results is dynamically adjusted through attention weights, allowing the model to focus on the information most relevant to the needs.
[0127] VQ and V E Combined, a complete context vector is constructed to guide the model to generate interface metadata.
[0128] The dynamic embedding is further optimized during the model generation process to ensure that the embedded content can reflect the semantic requirements of the generated context in real time, and the dynamic embedding vector is updated in real time during the generation process:
[0129] For the generated sequence G = {g1, g2, ..., g i ,...,g t} to generate the current context vector C t :
[0130] C t =Concat(V Q ,V E ,V G )
[0131] meaning:
[0132] C t is the context vector at the current generation time t. Through the concatenation operation, the following three parts of information are combined:
[0133] The feature vector V entered by the user Q , represents the semantic features of users’ natural language needs;
[0134] Dynamic embedding vector V E , represents the fusion characteristics of knowledge base retrieval results and user needs;
[0135] Generate the embedding vector V of the sequence G , which means the sequence G = {g1,g2,…,g i ,…,g t} semantic representation.
[0136] G t Provides complete context information during the generation process to dynamically update the embedding vector for the next step Provide semantic support.
[0137] G={g1,g2,…,g i ,…,g t} describes the structure and composition of the generated sequence G. Each element g i represents the i-th generated content in the generated sequence (such as a word, a subword or a character). The length t of G is the current time step of the generation process. The set represents {g1,g2,…,g i ,…,g t} is a sequential set, representing the generation history from the beginning of generation to the current time step t.
[0138] By updating the embedding vector through incremental optimization networks (such as GRU or Transformer blocks), the embedded content and context are dynamically adapted to improve the relevance and real-time performance of the generated results. During the embedding optimization process, the attention mechanism dynamically adjusts the weight distribution of user needs and retrieval results to further improve the model's attention to key information.
[0139] By building and optimizing the dynamic embedding layer, we ensure that the latest content of the knowledge base can be used in the generation process of the large language model in real time. Compared with existing methods, this solution achieves the accuracy and real-time performance of dynamic knowledge injection through a multimodal attention mechanism and incremental update strategy, effectively improving the accuracy and applicability of the generated results.
[0140] The dynamic embedding vector update formula is:
[0141]
[0142] meaning:
[0143] Dynamic embedding vector V E At each generation time t, based on the current context C t Update, generate
[0144] This updating process is completed by an incremental optimization network (such as GRU), ensuring that the embedding vector can reflect the latest generation semantics in real time.
[0145] The incremental update mechanism allows the embedding vector to adjust as the generated sequence changes, adapting it to the context and improving the relevance and real-time performance of the generated results.
[0146] Parameter meaning:
[0147] V E : Dynamic embedding vector, which represents the semantic features after the fusion of user input requirements and knowledge base retrieval results.
[0148] Initial is a weighted vector generated by the multimodal attention mechanism.
[0149] GRU (Gated Recurrent Unit): A recurrent neural network (RNN) structure used to process sequence data. GRU performs gate operations on the input and historical state at each time step to calculate the updated state GRU can effectively capture dynamic changes in context and reduce the gradient vanishing problem of traditional RNN.
[0150] Concat: Vector concatenation operation, which connects multiple feature vectors into a longer feature vector to represent comprehensive semantics.
[0151] 3.3 Multi-task learning optimization
[0152] In the model fine-tuning stage, a multi-task learning strategy is adopted to combine interface metadata generation with knowledge base optimization tasks, thereby improving the generation efficiency and real-time performance of the model. Specific implementation methods include:
[0153] Task design: Design two core tasks:
[0154] Task 1: Interface metadata generation: Based on the user's natural language requirements, directly generate interface metadata that meets the requirements, including interface name, parameter definition, return value format, etc.;
[0155] Task 2: Knowledge base optimization: Based on the generated interface metadata, dynamically adjust the index weight and field relevance of the knowledge base to make future retrieval results more accurate.
[0156] Task weight assignment: During the model training process, weights are assigned to different tasks through the loss function. The initial value of the weight can be set based on the importance of the task, and then dynamically adjusted according to the training results. For example, in the initial stage, the weight of the interface metadata generation task can be set to 0.7, and the weight of the knowledge base optimization task can be set to 0.3.
[0157] Joint optimization: Construct a joint loss function, combine the loss values of the two tasks into a total loss value, and optimize the model parameters through the back propagation algorithm. The specific formula is: L total =α·L 接口生成 +β·L 知识库优化 Among them, α and β are task weights, L 接口生成 The loss value generated for the interface metadata, L 知识库优化 The loss value optimized for the knowledge base.
[0158] Through the optimization strategy of multi-task learning, the large language model can not only generate high-quality interface metadata, but also optimize the knowledge base retrieval process at the same time, achieving a synergistic improvement of the two.
[0159] In summary, this implementation plan has formed a set of efficient large language model training and optimization methods through data preprocessing, dynamic embedding layer construction and multi-task learning optimization, achieving a comprehensive improvement in the accuracy and real-time performance of interface metadata generation.
[0160] 4. Parse natural language requirements and generate interface metadata
[0161] 4.1 Natural Language Parsing
[0162] The loaded large language model is used to deeply analyze the natural language requirements input by the user to extract the user's intent and key entities. The specific process is as follows:
[0163] Semantic understanding: Based on the ability to understand context, the model performs semantic analysis on the natural language input by the user and identifies the core intentions in the user's needs, such as creating a new interface, modifying an existing interface, or querying interface information.
[0164] Key entity extraction: Combine the semantic recognition capability of the model with the support of the knowledge base to extract key entity information in natural language requirements. Common entities include:
[0165] Interface name: such as the functional name or descriptive title of the interface;
[0166] Functional description: the user's expression of demand for interface functions, such as the main purpose or function of the interface;
[0167] Parameter requirements: parameter information explicitly mentioned by the user in the requirements, including parameter name, data type, default value, whether it is a required item, etc.;
[0168] Return value format: the output structure expected by the user, such as JSON, XML or other formats;
[0169] Structured requirement representation: Convert the parsed user requirements into a structured semantic representation, such as "Intent: Create an interface; Interface name: Get user information; Parameter: User name (string type, required); Return value: User information in JSON format".
[0170] Through the above steps, the model can accurately identify the user's core needs and key information, providing a complete foundation for the subsequent generation of interface metadata.
[0171] 4.2 Metadata Generation
[0172] Combining the contextual understanding ability of the large language model and the dynamic embedding characteristics of the knowledge base, the interface metadata that meets user needs is automatically generated. The specific process is as follows:
[0173] Context understanding and fusion: Using the dynamic embedding layer, the semantic representation of user needs is integrated with the knowledge base search results to build a complete generated context. For example, for the requirement of "obtaining user information", the interface template and parameter definition related to user management can be retrieved from the knowledge base as reference input for generating context;
[0174] Interface metadata generation: During the generation process, the model gradually generates interface metadata based on the fused context. The generated content includes:
[0175] Interface name: Generate a concise and meaningful interface name based on the functional description in the requirements;
[0176] Parameter definition: automatically generate the parameter list required by the interface, including parameter name, data type, default value, whether it is a required item, etc., for example, "user name: string type, required; user ID: integer type, optional";
[0177] Return value format: Define the structured format of the interface return value based on user needs or knowledge base templates, such as "user information: JSON format, including fields (name, age, email address, etc.)";
[0178] Automatic verification and supplementation: During generation, the model automatically verifies metadata using built-in rules to ensure the integrity and standardization of the generated content, such as supplementing unclear parameter default values or correcting inconsistent data types.
[0179] Through the above steps, the generation process of interface metadata not only reflects the accurate expression of user needs, but also combines the dynamic embedding characteristics of the knowledge base, thereby greatly improving the accuracy and practicality of the generated results. The generated metadata can be directly used for subsequent development and interface implementation of the low-code platform, providing reliable support for the rapid construction and verification of the interface.
[0180] 5. Generate and optimize interface metadata
[0181] 5.1 Metadata Verification
[0182] After the interface metadata is generated, a comprehensive syntax check and consistency check is performed to ensure that the generated results meet the standard specifications. The specific process includes the following steps:
[0183] Syntax check: Check the syntax rules of the fields contained in the interface metadata (such as interface name, parameter definition, return value format, etc.) to ensure the legitimacy of the field name and data format. For example:
[0184] Whether the interface name contains illegal characters;
[0185] Whether the parameter names comply with the naming conventions (such as using lowercase letters and underscores to separate words);
[0186] Whether the data type definition is valid (for example, whether "string", "integer", etc. are in the list of standard data types).
[0187] Consistency check: Check the logical consistency and format consistency of the content involved in the interface metadata, for example:
[0188] Whether there are duplicate parameter names in the parameter list;
[0189] Whether the return value format conforms to the expected structured data format (such as JSON or XML);
[0190] Is there a conflict between the parameter type and the default value (for example, the type of the default value is inconsistent with the type defined by the parameter).
[0191] Normalization: For metadata that does not conform to grammatical rules or has consistency issues, use automated tools or rule engines to correct them. For example:
[0192] Automatically modify parameter names to eliminate conflicts;
[0193] Complete missing parameter information or return value fields according to the specification;
[0194] Unify the output format, for example, force all return values to be output in JSON format.
[0195] Through the above verification process, the syntax standardization and logical consistency of the interface metadata are ensured, providing a reliable foundation for subsequent interface implementation.
[0196] 5.2 Optimizing the Generation Process
[0197] The generated interface metadata is further optimized using the dynamic embedding layer to ensure that it can fully reflect the real-time knowledge base content and accurately meet the specific needs of users. The optimization process includes the following steps:
[0198] Real-time update and integration: Based on the latest search results of the knowledge base, dynamically adjust the parameter definition and return value structure in the interface metadata generation process. For example, when the recommended parameters or call examples of an interface are updated in the knowledge base, the dynamic embedding layer will inject the latest information into the generation context to ensure that the generation results can reflect the changes in the knowledge base in real time.
[0199] Attention optimization: The attention mechanism dynamically embedded in the algorithm is used to further optimize the relevance and accuracy of the generated results. For example, higher weights are given to key entities involved in user input requirements, making the generated metadata more in line with user intent.
[0200] Personalized adjustment: Refine and customize the generated metadata based on the specific needs of users. For example, adjust the order or naming style of interface parameters according to user preferences to ensure that the generated results match the user's development habits or platform requirements.
[0201] Feedback loop optimization: After metadata generation is completed, a feedback loop is established by comparing the generated results with the expected results of user needs. The weight parameters or optimization rules of the dynamic embedding algorithm are adjusted according to the feedback to make the future generation process more in line with user needs.
[0202] Through the optimization of the dynamic embedding layer, the generated interface metadata can not only accurately meet user needs, but also adapt to the dynamic changes of the knowledge base content in a timely manner, thereby improving the efficiency and accuracy of interface development. This process provides strong technical support for the automatic generation and optimization of interfaces, and reduces the necessity of manual intervention while ensuring the real-time and consistency of data.
[0203] 6. Import the interface metadata into the low-code platform and complete the verification
[0204] 6.1 Data Import
[0205] Import the generated interface metadata into the low-code prototype builder to realize the automatic generation of the prototype interface. The specific steps are as follows:
[0206] Data format conversion: According to the interface builder requirements of the low-code platform, the generated interface metadata is converted into a format. For example, the interface metadata is converted from JSON format to an internal format supported by the low-code platform (such as a specific DSL language or configuration file format).
[0207] Automatically generate prototype interface: Through the automated processing capabilities of the low-code prototype builder, the definition content in the interface metadata (such as interface name, parameter list, return value format, etc.) is parsed and mapped to the platform's interface prototype to generate an interface prototype that meets the requirements. For example:
[0208] Create interface routes and assign corresponding HTTP methods (such as GET, POST, etc.);
[0209] Definition and validation rules for auto-fill parameter fields;
[0210] Configure the return value template of the interface to ensure that the returned data structure is consistent with expectations.
[0211] Platform integration and deployment: Deploy the generated interface prototype directly to the test environment of the low-code platform to complete the initialization settings of the interface so that it can receive external calls.
[0212] Through the data import step, an interface prototype that meets user needs can be quickly generated, greatly improving the efficiency of interface development.
[0213] 6.2 Function Implementation and Testing
[0214] Functional verification is performed on the interface automatically generated by the low-code platform to ensure that it can correctly meet user needs. The specific process is as follows:
[0215] Functional implementation: Combine the visualization tools or automation functions of the low-code platform to bind specific implementation logic to the generated interface prototype. For example:
[0216] Set data processing rules or operation flows (such as database query, business logic call, etc.) for the parameters and return value structures defined by the interface;
[0217] Use the platform's drag-and-drop orchestration function to associate interfaces with corresponding backend services or database tables.
[0218] Test case design: Based on the interface functions and user requirements, design multiple groups of test cases to cover the main scenarios and boundary conditions of the interface. The test cases should include the following:
[0219] Normal input: Verify whether the interface returns the correct result when receiving legal parameters;
[0220] Abnormal input: Test the fault tolerance of the interface when receiving illegal parameters or missing necessary parameters;
[0221] Performance testing: Evaluate the response time and stability of the interface under high-concurrency calls or large data volume input.
[0222] Functional verification and debugging: Execute preset test cases to verify the functionality, stability, and error handling capabilities of the interface. For example:
[0223] Call the generated API and record the returned result, comparing it with the expected result;
[0224] Use platform logs or debugging tools to troubleshoot problems in the interface implementation, and adjust the interface logic or metadata configuration based on the test results.
[0225] Through functional implementation and testing steps, we ensure that the automatically generated interface can accurately execute the functional definition in user requirements and has good applicability and stability, providing strong guarantee for the final release of the interface.
[0226] The above description is only a preferred embodiment of the present invention, so all equivalent changes or modifications made according to the structure, characteristics and principles described in the scope of the patent application of the present invention are included in the scope of the patent application of the present invention.
Claims
1. A method for generating a backend interface using a large language model based on a dynamic embedding mechanism, characterized in that: The following steps are involved: Step 1: Extract historical data related to the back-end interface from the existing system; and store the cleaned data in a structured database according to field classification; Step 2: Import historical data from the structured database into the knowledge base by indexing the structure and using the real-time synchronization mechanism; Step 3: Load the large language model and use the knowledge base retrieval results as input features to build a dynamic embedding layer to inject the latest data into the context of the large language model training; Step 4: Analyze natural language requirements using the large language model to identify user intent and key entities; And based on the context understanding ability and the dynamic embedding characteristics of the knowledge base, interface metadata is generated; Step 5: Perform syntax verification and data structure normalization on the generated interface metadata, and optimize the generation process using the dynamic embedding layer; Step 6: Import the generated interface metadata into the low-code prototype builder and generate an interface prototype to complete functional verification.
2. The method for generating a backend interface using a large language model based on a dynamic embedding mechanism as claimed in claim 1, characterized in that: The historical data related to the development and use of the back-end interface is extracted from the existing system, specifically including the interface name, function description, parameter definition, call frequency, return value format and call examples; the field classification includes basic interface information, parameter information, call characteristics and sample data.
3. The method for generating a backend interface from a large language model based on a dynamic embedding mechanism as claimed in claim 1, characterized in that: The index structure includes field definition, index strategy and word segmentation rules.
4. The method for generating a backend interface from a large language model based on a dynamic embedding mechanism as claimed in claim 1, characterized in that: The step 3 further comprises the following steps: 3.1: Extract features from the natural language requirements Q input by the user and generate feature vector V Q ; 3.2: Based on V Q Search the knowledge base and extract the interface information R={r1,r2,…,r i ,…,r n }; 3.3: For each interface related information retrieved i Generate its corresponding feature vector i ranges from 1 to n; n is the number of interface related information; 3.4: Use the multimodal attention mechanism to input the user feature vector V Q and the retrieval result feature vector Fusion, generating dynamic embedding vectors Among them, α i is the attention weight calculated by the following formula: Where W is a learnable linear transformation matrix and d is a vector dimension normalization factor; 3.5: Dynamically embed the vector V E With the user input feature vector V Q Combined, a complete context vector is constructed for the large language model to generate interface metadata.
5. The method for generating a backend interface from a large language model based on a dynamic embedding mechanism as claimed in claim 4, characterized in that: The dynamic embedding vector V E The generation of adopts an incremental update strategy, which includes: generating a sequence G = {g1, g2, ..., g i ,…,g t } to generate the current context vector C t =Concat(V Q ,V E ,V G ); Update the dynamic embedding vector V by incrementally optimizing the network E , the dynamic embedding vector V E At each generation time t, based on the current context C t Update generation get in: C t is the context vector at the current generation time t: V G is the embedding vector of the generated sequence, which represents the sequence G = {g1, g2, ..., g t }'s semantic representation; g i Represents the i-th generated content in the generated sequence; GRU (Gated Recurrent Unit): Recurrent neural network (RNN) structure used to process sequence data; Concat: Vector concatenation operation, which connects multiple feature vectors into a longer feature vector to represent comprehensive semantics.
6. The method for generating a backend interface from a large language model based on a dynamic embedding mechanism as claimed in claim 1, characterized in that: The key entities in step 4 include interface name, function description, parameter information and return value format; the generated interface metadata includes interface name, parameter definition and return value format.
7. The method for generating a backend interface from a large language model based on a dynamic embedding mechanism as claimed in claim 1, characterized in that: The generated interface metadata is optimized using a dynamic embedding layer, and through real-time updating and fusion, attention optimization and feedback loop optimization, it is ensured that the generated results can dynamically reflect the latest content of the knowledge base and accurately meet user needs; the generated interface metadata is personalized and the order or naming style of the interface parameters is optimized according to user needs.
8. The method for generating a backend interface from a large language model based on a dynamic embedding mechanism as claimed in claim 1, characterized in that: The step 6 further comprises: Convert the generated interface metadata into a new format and import it into the low-code platform; Automatically generate interface prototypes, including automatic mapping and configuration of interface names, parameter lists, and return value formats; Deploy the generated interface prototype to the test environment of the low-code platform; Use low-code platform tools to bind interfaces to implement logic and perform functional verification; Design and execute test cases, covering interface functionality, stability and performance testing; Debug and optimize the interface.
Citation Information
Cited By
Auditing text auxiliary writing method and system based on large language model
CN120745621A
A method and system for assisting in the writing of audit texts based on a large language model
CN120745621B