Protocol data template construction method and system, electronic equipment and storage medium

By analyzing protocol documents and real data using a large language model, and automatically updating protocol data templates, the problems of low construction efficiency and difficult to guarantee data quality in the existing technology are solved, and efficient and reliable protocol data template construction is achieved.

CN119311264APending Publication Date: 2025-01-14CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411448975.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

During the system or software development and testing process, it takes a long time to construct the protocol test data and the data quality is difficult to guarantee. The existing data generation template needs to be manually constructed based on data rules, which is inefficient.

Method used

By obtaining protocol documents, analyzing protocol documents and real protocol data using large language models, obtaining and updating protocol data templates, improving the construction efficiency of protocol data templates.

Benefits of technology

It realizes efficient construction of protocol data templates, improves the efficiency of data template construction, and ensures the reliability of data quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311264A_ABST
    Figure CN119311264A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a protocol data template construction method and system, electronic equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: acquiring a protocol document, analyzing description information of each field defined in the protocol document by using a large language model to obtain first protocol rule information, initializing a protocol data template according to the first protocol rule information, and then collecting real protocol data. And analyzing each field value of the real protocol data by using the large language model to obtain second protocol rule information, and updating the protocol data template according to the second protocol rule information. According to the method and the device, the protocol document and the real protocol data are analyzed by utilizing the correlation analysis capability of the large language model, and the reliable protocol data template is obtained by fusing the first protocol rule information of the protocol document and the second protocol rule information of the real protocol data, so that the construction efficiency of the protocol data template is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a protocol data template construction method, system, electronic device and storage medium. Background Art

[0002] During the system or software development and testing process, different positions (front-end and back-end) of the same project team, docking of different system platforms, and big data access may use various different protocol data, so the system or software needs to have a corresponding protocol interface. In the process of testing the protocol interface, it is usually considered to construct protocol test data, which is very time-consuming and the data quality cannot be guaranteed. In the related technology, data generation templates can be used to generate test data in batches, but the data generation templates also need to be manually constructed based on data rules. This template construction method is inefficient. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose a protocol data template construction method, system, electronic device and storage medium, aiming to improve the efficiency of protocol data template construction.

[0004] To achieve the above purpose, an embodiment of the present application provides a method for constructing a protocol data template, comprising the following steps:

[0005] Obtain agreement documents;

[0006] Analyze each field description information defined in the protocol document using a large language model to obtain first protocol rule information;

[0007] Initialize a protocol data template according to the first protocol rule information;

[0008] Collect real protocol data;

[0009] Analyzing each field value of the real protocol data using the large language model to obtain second protocol rule information;

[0010] The protocol data template is updated according to the second protocol rule information.

[0011] In some embodiments, the step of analyzing the field description information defined in the protocol document using a large language model to obtain the first protocol rule information includes the following steps:

[0012] Extracting description information of each field in the protocol document;

[0013] Writing the field description information into a first variable of a first question template to obtain a first question text, wherein the content of the first question template is an enabling statement generated by a rule code about the first variable;

[0014] Inputting the first question text into the large language model to obtain a data rule function of the field description information;

[0015] The first protocol rule information is determined according to the data rule function of each of the field description information.

[0016] In some embodiments, after the step of extracting the description information of each field in the protocol document, the step of using the large language model to analyze the description information of each field defined in the protocol document to obtain the first protocol rule information further includes the following steps:

[0017] By matching each of the field description information with a function mapping table respectively, determining whether the field description information exists in the function mapping table, wherein the function mapping table records a mapping relationship between stored data rule functions and function descriptions;

[0018] When the field description information exists in the function mapping table, determining the data rule function of the field description information according to the function mapping table;

[0019] When the field description information does not exist in the function mapping table, the step of writing the field description information into the first variable of the first question template to obtain the first question text is executed, and the step of inputting the first question text into the large language model to obtain the data rule function of the field description information is executed.

[0020] In some embodiments, the step of matching each of the field description information with the function mapping table to determine whether the field description information exists in the function mapping table comprises the following steps:

[0021] Writing the field description information and the function description in the function mapping table into the second variable and the third variable of the second question template respectively to obtain a second question text, wherein the content of the second question template is an enabling statement for calculating the semantic similarity between the second variable and the third variable;

[0022] Inputting the second question text into the large language model to obtain the semantic similarity between the field description information and the function description;

[0023] When the semantic similarity between the field description information and any function description in the function mapping table is greater than a preset similarity value, it is determined that the field description information exists in the function mapping table;

[0024] When the semantic similarities between the field description information and all function descriptions in the function mapping table are less than or equal to a preset similarity value, it is determined that the field description information does not exist in the function mapping table.

[0025] In some embodiments, the using the large language model to analyze each field value of the real protocol data to obtain the second protocol rule information includes the following steps:

[0026] Extracting field values ​​from multiple real protocol data respectively to obtain each field value of each real protocol data;

[0027] Integrate the same field values ​​of multiple real protocol data to obtain a field value set;

[0028] Writing the field value set into the fourth variable of the third question template to obtain a third question text, wherein the content of the third question template is an enabling statement for analyzing the data rule composition of the fourth variable and performing code generation;

[0029] Inputting the third question text into the large language model to obtain a data rule function of the field value set;

[0030] The second protocol rule information is determined according to the data rule function of each of the field value sets.

[0031] In some embodiments, after the step of integrating the same field values ​​of the plurality of real protocol data to obtain a field value set, the step of analyzing the field values ​​of the real protocol data using the large language model to obtain the second protocol rule information further includes the following steps:

[0032] By matching the field value set with the target function, determining whether the data composition rule of the field value set matches the rule defined by the target function;

[0033] When the data combination rule of the field value set matches the rule defined by the objective function, the objective function is determined as the data rule function of the field value set;

[0034] When the data combination rule of the field value set does not match the rule defined by the objective function, the step of writing the field value set into the fourth variable of the third question template to obtain the third question text is executed, and the step of inputting the third question text into the large language model to obtain the data rule function of the field value set is executed.

[0035] In some embodiments, the step of matching the field value set with the target function to determine whether the data composition rule of the field value set matches the rule defined by the target function comprises the following steps:

[0036] Writing the field value set and the code block of the target function into the fifth variable and the sixth variable of the fourth question template respectively to obtain a fourth question text, wherein the content of the fourth question template is an enabling statement for matching and analyzing the function code rule of the sixth variable with the data rule of the fifth variable;

[0037] The fourth question text is input into the large language model to obtain an output result, wherein the output result is used to determine whether the data combination rule of the field value set matches the rule defined by the objective function.

[0038] To achieve the above purpose, another aspect of the embodiment of the present application proposes a protocol data template construction system, including:

[0039] The first module is used to obtain the agreement document;

[0040] The second module is used to analyze the description information of each field defined in the protocol document by using a large language model to obtain the first protocol rule information;

[0041] A third module is used to initialize a protocol data template according to the first protocol rule information;

[0042] The fourth module is used to collect real protocol data;

[0043] A fifth module is used to analyze each field value of the real protocol data by using the large language model to obtain second protocol rule information;

[0044] The sixth module is used to update the protocol data template according to the second protocol rule information.

[0045] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes an electronic device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program implements the method described in the above embodiment when executed by the processor.

[0046] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium used for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in the above embodiment.

[0047] The protocol data template construction method, system, electronic device and storage medium proposed in the present application obtain a protocol document, use a large language model to analyze the description information of each field defined in the protocol document, obtain first protocol rule information, initialize the protocol data template according to the first protocol rule information, then collect real protocol data, use a large language model to analyze the values ​​of each field of the real protocol data, obtain second protocol rule information, and then update the protocol data template according to the second protocol rule information. The present application utilizes the relevant analysis capabilities of the large language model to parse the protocol document and the real protocol data, obtains a reliable protocol data template by integrating the first protocol rule information of the protocol document and the second protocol rule information of the real protocol data, and improves the construction efficiency of the protocol data template. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 is a flowchart of a protocol data template construction method provided in an embodiment of the present application;

[0049] Figure 2 yes Figure 1 Flow chart of step S102 in FIG.

[0050] Figure 3 yes Figure 1 A flowchart of another embodiment of step S102;

[0051] Figure 4 yes Figure 3 Flow chart of step S301 in FIG.

[0052] Figure 5 yes Figure 1 Flow chart of step S105 in FIG.

[0053] Figure 6 yes Figure 5 A flowchart of another embodiment of step S105;

[0054] Figure 7 yes Figure 6 Flow chart of step S601 in FIG.

[0055] Figure 8 It is a schematic diagram of a protocol data template construction system provided in an embodiment of the present application;

[0056] Fig. 9 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0057] Fig.10 It is a flowchart of the overall process of the protocol data template construction method provided in the embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0059] It should be noted that, although the functional modules are divided in the system and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0061] First, some nouns involved in this application are analyzed:

[0062] A protocol document is a document that details how to exchange information, perform operations, or coordinate behaviors between two or more systems, devices, services, or programs. It defines all aspects of communication, including the format of messages, the order of exchange, error handling mechanisms, security requirements, and any necessary authentication and authorization processes. The purpose of a protocol document is to ensure that all parties can interact according to the same rules and standards, thereby achieving seamless data exchange and system interoperability. A protocol document typically contains an introduction, a glossary, a protocol overview, message formats, communication processes, error handling, security requirements, version control, and appendices (including sample messages, test cases, references to relevant standards and specifications, etc.).

[0063] Large Language Model (LLM) refers to a deep learning model that is trained with a large amount of text data, such as Transformer, and is trained to understand and generate human language. LLM can be OpenAI's GPT series (such as GPT-3 and GPT-4), Google's BERT and T5, etc.

[0064] The embodiments of the present application provide a protocol data template construction method, system, electronic device and storage medium, aiming to improve the efficiency of protocol data template construction.

[0065] The protocol data template construction method, system, electronic device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the protocol data template construction method in the embodiments of the present application is described.

[0066] The protocol data template construction method provided in the embodiment of the present application relates to the field of computer technology. The protocol data template construction method provided in the embodiment of the present application can be applied to a terminal, can also be applied to a server side, and can also be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms; the software can be an application that implements the protocol data template construction method, etc., but is not limited to the above forms.

[0067] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0068] Figure 1 is an optional flowchart of the protocol data template construction method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S106.

[0069] Step S101, obtaining a protocol document;

[0070] Step S102, using a large language model to analyze the description information of each field defined in the protocol document to obtain first protocol rule information;

[0071] Step S103, initializing a protocol data template according to the first protocol rule information;

[0072] Step S104, collecting real protocol data;

[0073] Step S105, using the large language model to analyze each field value of the real protocol data to obtain second protocol rule information;

[0074] Step S106: Update the protocol data template according to the second protocol rule information.

[0075] In step S101 of some embodiments, in the early stage of the project, the development team needs to construct early stage test data based on the protocol document. The protocol document defines aspects such as the message interaction format adopted by the communicating parties. The message interaction format can be described using various field description information, which can be in Chinese description information, English description information, or other language forms.

[0076] In step S102 of some embodiments, the large language model is used to perform semantic understanding and analysis on each field description information defined in the protocol document, and the data rule function about each field description information is determined in combination with the large language model, thereby obtaining the first protocol rule information. This embodiment uses the large language model to perform semantic understanding and rule generation on the field description information, and can efficiently analyze the first protocol rule information involved in the protocol document.

[0077] See also Figure 2 In some embodiments, step S102 may include but is not limited to steps S201 to S204:

[0078] Step S201, extracting description information of each field in the protocol document;

[0079] Step S202, writing the field description information into the first variable of the first question template to obtain a first question text, wherein the content of the first question template is an enabling statement generated by the rule code about the first variable;

[0080] Step S203, inputting the first question text into the large language model to obtain a data rule function of field description information;

[0081] Step S204: determining first protocol rule information according to the data rule function of each field description information.

[0082] In this embodiment, the protocol document generally includes an introduction, a glossary, a protocol overview, a message format, a communication process, error handling, security requirements, version control, and appendices (including sample messages, test cases, references to relevant standards and specifications, etc.). The message format can be described by field description information. In this embodiment, natural language processing technology can be used to extract each field description information from the protocol document, and then the first question text is constructed according to the field description information.

[0083] In this embodiment, the first question text can be constructed manually or automatically using a template. Automatic construction using a template specifically involves obtaining a first question template pre-existing in the system after determining the field description information. The content of the first question template is an enabling statement generated by the rule code of the first variable. For example, the first question template is as follows:

[0084] Please use Python to implement: Generate [first variable]. This function needs to add fixed input parameters: user_id = None, user_info = None. There is no need to output the inference process, just give the code directly.

[0085] The above-mentioned first question template includes a replaceable variable part and a fixed text part. The fixed text part is only exemplary, and the specific text expression can be set according to actual needs as long as it can express the content meaning of the enabling statement generated by the rule code about the first variable.

[0086] Fill the field description information into the [First Variable] position of the first question template to obtain the first question text. For example, if the field description information is "Personnel Name", the following first question text can be obtained:

[0087] Please use Python language to implement: Generate personnel names. This function needs to add fixed input parameters: user_id = None, user_info = None. There is no need to output the reasoning process, just give the code directly.

[0088] In this embodiment, the first question text can be input into the large language model, and the code construction capability of the large language model can be used to obtain the data rule function of the field description information. The data rule function is a code for constructing data of the field description information, and the corresponding data can be constructed through the data rule function. According to the field description information in the protocol document, the corresponding first question text is constructed respectively, and then the first question text is input into the large language model respectively, so that the data rule function of each field description information in the protocol document can be obtained, thereby forming the first protocol rule information, that is, the first protocol rule information contains the data rule function of multiple field description information of the protocol document.

[0089] See also Figure 3 In some embodiments, after step S201, step S102 may also include but is not limited to steps S301 to S303:

[0090] Step S301, by matching each field description information with the function mapping table respectively, determining whether the field description information exists in the function mapping table, wherein the function mapping table records the mapping relationship between the stored data rule function and the function description;

[0091] Step S302, when the field description information exists in the function mapping table, determining the data rule function of the field description information according to the function mapping table;

[0092] Step S303: When the field description information does not exist in the function mapping table, execute steps S202 to S203.

[0093] In this embodiment, in the historical development and testing process, data rule functions of some fields may have been constructed and stored in the local system or remote database, specifically stored in the constructed function factory. In order to reduce the amount of calculation of the large language model, the embodiment of the present application maps the existing data rule function to the corresponding function description to form a function mapping table. Exemplarily, the function mapping table is as follows:

[0094] {

[0095] "generate_card_id": "personnel's ID number",

[0096] “generate_email”: “personnel’s email address”,

[0097] "generate_addr": "person's home address"

[0098] }

[0099] Among them, "generate_card_id" on the left represents the data rule function, and "personnel's ID number" on the right represents the function description.

[0100] After extracting the description information of each field in the protocol document, this embodiment first matches each extracted field description information with the function mapping table to determine whether the field description information exists in the function mapping table. If the field description information exists in the function mapping table, the corresponding data rule function known in the function factory can be used directly; if the field description information does not exist in the function mapping table, it is necessary to use the large language model to generate the data rule function of the field description information, that is, execute steps S202 to S203. Furthermore, the data rule function generated by the large language model can be stored in the function factory, and the field description information can be updated to the function mapping table as the function description of the generated data rule function to facilitate subsequent use. For example, the data rule function for the name of a person generated by the large language model is "generate_name", and the updated function mapping table is as follows:

[0101] {

[0102] "generate_card_id": "personnel's ID number",

[0103] “generate_email”: “personnel’s email address”,

[0104] "generate_addr": "personnel's home address",

[0105] "generate_name": "Person Name"

[0106] }

[0107] In this embodiment, after extracting the description information of each field of the protocol document, the matching field description information is first determined based on the function mapping table. The data rule function of this part of the field description information can be obtained from the function factory without the need to use a large language model for construction. For the unmatched field description information, the large language model is used to construct the data rule function, thereby reducing the amount of calculation of the large language model and improving the efficiency of the protocol data template construction.

[0108] See also Figure 4 In some embodiments, step S301 may include but is not limited to steps S401 to S404:

[0109] Step S401, writing the field description information and the function description in the function mapping table into the second variable and the third variable of the second question template respectively to obtain a second question text, wherein the content of the second question template is an enabling statement for calculating the semantic similarity between the second variable and the third variable;

[0110] Step S402, inputting the second question text into the large language model to obtain the semantic similarity between the field description information and the function description;

[0111] Step S403, when the semantic similarity between the field description information and any function description in the function mapping table is greater than a preset similarity value, it is determined that the field description information exists in the function mapping table;

[0112] Step S404: when the semantic similarities between the field description information and all function descriptions in the function mapping table are less than or equal to a preset similarity value, it is determined that the field description information does not exist in the function mapping table.

[0113] In this embodiment, for fields with the same semantics, the field description information used in the protocol document and the textual expressions in the function mapping table are not necessarily the same. Therefore, when determining whether the field description information matches the function mapping table, the embodiment of the present application needs to calculate the semantic similarity between the field description information and the function description. The semantic similarity between the field description information and the function description can be calculated using word vector methods and deep learning methods, etc., and the embodiment of the present application does not make specific restrictions.

[0114] In this embodiment, the semantic similarity between the field description information and the function description can be calculated using a large language model, which is a type of deep learning method, as follows:

[0115] After determining the field description information to be matched currently, a second question template pre-existing in the system is obtained. The content of the first question template is an enabling statement for calculating the semantic similarity between the second variable and the third variable. Exemplarily, the second question template is as follows:

[0116] [Second variable] and [Third variable], please use the BERT model to evaluate the semantic similarity of these two sentences? I don't need a specific process, please give me the similarity value directly.

[0117] The above-mentioned second question template includes a replaceable variable part and a fixed text part. The fixed text part is only exemplary, and the specific text expression can be set according to actual needs as long as it can express the content meaning of the enabling statement for calculating the semantic similarity between the second variable and the third variable.

[0118] Fill the field description information into the [Second Variable] position of the second question template, and fill the function description of the function mapping table into the [Third Variable] position of the second question template to obtain the second question text. For example, if the field description information is "personnel name" and the function description is "personnel ID card", the following second question text can be obtained:

[0119] ID card number and ID card of a person, please use the BERT model to evaluate the semantic similarity of these two sentences? I don't need a specific process, please give me the similarity value directly.

[0120] Input the second question text into the large language model, and the model outputs the semantic similarity between the field description information and the function description. If the field description information and the function description are greater than the preset similarity value (e.g. 80%), it is considered that the field description information matches the function mapping table successfully, and the data rule function of the field is set to the corresponding rule function in the function mapping table, such as setting the data rule function of the field to: generate_card_i, and then the next field description information is matched in the same way. If the field description information and the function description are less than or equal to the preset similarity value, the semantic similarity between the current field description information and the next function description of the function mapping table is calculated. If the semantic similarity between the field description information and all function descriptions in the function mapping table is less than or equal to the preset similarity value, it is considered that the field description information fails to match the function mapping table, and it is necessary to use the large language model to generate the data rule function of the field.

[0121] In S103 of some embodiments, the data rule functions of the various field description information of the protocol document are combined into the first protocol rule information. After obtaining the first protocol rule information, the protocol data template can be determined according to the field order of the message format defined in the protocol document and by referencing the corresponding data rule function. The protocol data template is a code for automatically generating protocol data.

[0122] In S104 of some embodiments, in the subsequent development process, real protocol data from the actual interaction process can be collected, and the protocol data template can be updated again by statistically analyzing the protocol rules of multiple real protocol data to improve the reliability of the protocol data template in generating protocol data.

[0123] In S105 of some embodiments, the real protocol data is composed of field values ​​of various fields. A large language model can be used to analyze the rules of field values ​​of the same field in multiple real protocol data to obtain data rule functions of each field. The data rule functions of all fields in the real protocol data are combined to obtain the second protocol rule information, that is, the second protocol rule information contains data rule functions of multiple fields of the real protocol data.

[0124] See also Figure 5 In some embodiments, step S105 may include but is not limited to steps S501 to S505:

[0125] Step S501, extracting field values ​​from a plurality of real protocol data respectively to obtain each field value of each real protocol data;

[0126] Step S502, integrating the same field values ​​of multiple real protocol data to obtain a field value set;

[0127] Step S503, writing the field value set into the fourth variable of the third question template to obtain a third question text, wherein the content of the third question template is an enabling statement for analyzing the data rule composition of the fourth variable and performing code generation;

[0128] Step S504, inputting the third question text into the large language model to obtain a data rule function of a field value set;

[0129] Step S505: determine the second protocol rule information according to the data rule function of each field value set.

[0130] In this embodiment, the real protocol data is composed of field values ​​of different fields, and the different field values ​​are in the order of the protocol document. After collecting multiple real protocol data from the same protocol interface, each real protocol data is parsed and each field value is extracted based on the field data position to obtain each field value of each real protocol data, and then the field values ​​of the same field position of multiple real protocol data are integrated to obtain a field value set. For example, the extracted field value set is [13812345678, 13923456789, 13734567890, 15098765432, 15812345678, 18665432109, 14789012345, 13567890123, 18901234567, 13654321098].

[0131] In this embodiment, the third question text can be constructed manually or automatically using a template. The automatic construction using a template is specifically to obtain a third question template pre-existing in the system after determining the field value set. The content of the third question template is an enabling statement for analyzing the data rule composition of the fourth variable and performing code generation. For example, the third question template is as follows:

[0132] Now there is a set of data: [Fourth variable]. Please analyze the composition rules of this data. There is no need to output the reasoning process, just output the code directly.

[0133] The above-mentioned third question template includes a replaceable variable part and a fixed text part. The fixed text part is only exemplary, and the specific text expression can be set according to actual needs, as long as it can express the content meaning of the enabling statement about the data rule composition analysis of the fourth variable and code generation.

[0134] Fill the field value set into the [fourth variable] position of the third question template to obtain the third question text. For example, fill the field value of the above example into the [fourth variable] position to obtain the following third question text:

[0135] Now there is a set of data: 13812345678, 13923456789, 13734567890, 15098765432, 15812345678, 18665432109, 14789012345, 13567890123, 18901234567, 13654321098. Please analyze the composition rules of the data. There is no need to output the reasoning process, just output the code directly.

[0136] In this embodiment, the third question text can be input into the large language model, and the data analysis capability and code construction capability of the large language model can be used to obtain the data rule function of the field value set. The data rule function of the field value set represents the synthesis law of a certain field value of the real protocol data in the form of code, and the corresponding data can be constructed through the data rule function. According to the field value set of each field in the real protocol data, the corresponding third question text is respectively constructed, and then the third question text is respectively input into the large language model, and the data rule function of each field value set can be obtained, thereby forming the second protocol rule information.

[0137] See also Figure 6 In some embodiments, after step S502, step S105 may also include but is not limited to steps S601 to S603:

[0138] Step S601, by matching the field value set with the target function, it is determined whether the data composition rule of the field value set matches the rule defined by the target function;

[0139] Step S602, when the data combination rule of the field value set matches the rule defined by the target function, the target function is determined as the data rule function of the field value set;

[0140] Step S603, when the data combination rule of the field value set does not match the rule defined by the target function, execute steps S503 to S504.

[0141] In this embodiment, after determining the field value set of all fields constituting the real protocol data based on multiple real protocol data, this embodiment first matches each extracted field value set with a known function or a manually configured function in the function factory. The target function can be manually specified from the function factory based on experience or the function code can be manually configured by the system in accordance with the order of functions in the function factory. By matching the field value set with the target function, it is determined whether the data composition rule of the field value set matches the rule defined by the target function. If it matches, the target function can be directly used as the data rule function of the field value set; if it does not match all the specified target functions, it is necessary to use the large language model to generate the data rule function of the field value set, that is, execute steps S503 to S504. Furthermore, the data rule function generated by the large language model can be stored in the function factory, and the function description of the data rule function can be set and updated in the function mapping table for subsequent use.

[0142] In this embodiment, after determining the field value set of all fields constituting the real protocol data based on multiple real protocol data, a data rule function of the field value set can be matched from a function factory or a configured function without the need to use a large language model for construction. For unmatched field value sets, the large language model is used to construct the data rule function, thereby reducing the amount of calculation of the large language model and improving the efficiency of protocol data template construction.

[0143] See also Figure 7 In some embodiments, step S601 may include but is not limited to steps S701 to S702:

[0144] Step S701, writing the field value set and the code block of the target function into the fifth variable and the sixth variable of the fourth question template respectively, to obtain a fourth question text, wherein the content of the fourth question template is an enabling statement for matching and analyzing the function code rule of the sixth variable with the data rule of the fifth variable;

[0145] Step S702: input the fourth question text into the large language model to obtain an output result, wherein the output result is used to determine whether the data combination rule of the field value set matches the rule defined by the target function.

[0146] In this embodiment, a large language model can be used to determine whether the data composition rule of the field value set matches the rule defined by the target function, as follows:

[0147] After determining the field value set and target function to be matched, illustratively, the field value set is [13812345678, 13923456789, 13734567890, 15098765432, 15812345678, 18665432109, 14789012345, 13567890123, 18901234567, 13654321098], and the target function is generage_phone_number, the code block of the target function is obtained from the function factory, as follows:

[0148] def generate_phone_number():

[0149] #Chinese mobile phone numbers start with 1, and the second digit can be any number from 3 to 9

[0150] #Randomly select the second digit

[0151] second_digit=random.choice('3456789')

[0152] #Generate the next 9 random numbers

[0153] remaining_digits = ".join(random.choices('0123456789',k=9))#combined generated phone number

[0154] phone_number=f'1{second_digit}{remaining_digits}'

[0155] return phone_number

[0156] Question template: The content of the fourth question template is an enabling statement for matching and analyzing the function code rule of the sixth variable with the data rule of the fifth variable. Exemplarily, the fourth question template is as follows:

[0157] Now there is a set of data: [Fifth variable]. Please analyze the composition rules of the data and use the following code to see if you can generate data with the same rules: [Sixth variable]. You do not need to answer the reasoning process, just answer whether it matches.

[0158] The above-mentioned second question template includes a replaceable variable part and a fixed text part. The fixed text part is only exemplary. The specific text expression can be set according to actual needs, as long as it can express the content meaning of the enabling statement for matching and analyzing the function code rules of the sixth variable with the data rules of the fifth variable.

[0159] Fill the field value set into the [fifth variable] position of the fourth question template, and fill the code block of the target function into the [sixth variable] position of the fourth question template, to obtain the fourth question text. For example, the fourth question text is as follows:

[0160] Now there is a set of data: 13812345678, 13923456789, 13734567890, 15098765432, 15812345678, 18665432109, 14789012345, 13567890123, 18901234567, 13654321098. Please analyze the composition rules of the data and see if the following code can generate data with the same rules:

[0161] def generate_phone_number():

[0162] #Chinese mobile phone numbers start with 1, and the second digit can be any number from 3 to 9

[0163] #Randomly select the second digit

[0164] second_digit=random.choice('3456789')

[0165] #Generate the next 9 random numbers

[0166] remaining_digits = ".join(random.choices('0123456789',k=9))#combined generated phone number

[0167] phone_number=f'1{second_digit}{remaining_digits}'

[0168] return phone_number

[0169] There is no need to answer the reasoning process, just answer whether it matches.

[0170] The fourth question text is input into the large language model, and the model outputs a determination result of whether the data composition rule of the field value set matches the rule defined by the target function.

[0171] In step S106 of some embodiments, in the process of initializing the protocol data template based on the protocol document, the data rule function is directly generated according to the field description information, and the data rule functions of the fields are combined according to the defined message field order to determine the protocol data template. However, since the data rule function generated based on the field description information in this process does not necessarily conform to the field value combination rules of the actual protocol data, the embodiments of the present application correct the protocol data template generated by the protocol document by analyzing the data combination rules of each field of the actual protocol data to obtain a reliable protocol data template.

[0172] For example, in a scenario where a company has a log middle platform and all internal systems of the company pass through the middle platform, protocol A is set as the protocol of the internal chat software of the company. The fields contained in the protocol are shown in Table 1:

[0173] Table 1 Definition fields of message metadata in protocol documents

[0174] Metadata Chinese name Metadata Chinese name Send User ID SendUserId Send user associated login account type SendUserType Send user linked account SendUserAccout Receive User ID RecoveUserId Chat content ChatContent appendix MainFile MAC Address Mac

[0175] Through the above process, the protocol data template can be obtained as follows:

[0176]

[0177] According to some embodiments of the present application, Fig.10 , the protocol data template construction method of the embodiment of the present application is specifically described:

[0178] In the first stage, according to the protocol document structure, the process of generating the protocol data template is as follows:

[0179] First, obtain the Chinese description information of the fields in the protocol document;

[0180] Then the obtained Chinese description information is matched with the function description in the existing function mapping table of the system. The specific matching process is to assemble the interactive statements of the Chinese description information and the function description and the large language model, and obtain the similarity value of the two through the answer of the large language model;

[0181] If the similarity is greater than 85%, the match is successful, and the data rule function of the field is set directly based on the function in the function mapping table.

[0182] If the match is unsuccessful, the interactive statements with the large language model are assembled based on the Chinese description information. The interactive statements use specific question texts to enable the large language model to accurately understand the semantics of the Chinese description of the field to generate the data rule function for the field. In the return information of the large model, extract the Python code and update it to the function factory, set the data rule function for the field, and update the function mapping table.

[0183] The data rule functions of each field determined by the above process are then manually inspected and a data protocol template is output.

[0184] In the second stage, the specific process of updating the protocol data template according to the real protocol data is as follows:

[0185] First, obtain N pieces of real protocol data;

[0186] Then, the values ​​of all fields of N real protocol data are traversed, and all values ​​of a field (i.e., field value set) and the code block of the configured target function are provided as input conditions to the large language model to determine whether the function rules match the composition rules of the real protocol data. The specific matching process is: assemble the field value set and the code block of the target function to generate an interactive statement, and input it into the large language model to evaluate whether the function is consistent with the field value rule;

[0187] According to the answer of the large language model, if there is a match, the next field is matched, and the target function is used as the data rule function of the field and manually checked;

[0188] For unmatched fields, the large language model input sentence is assembled according to the field value set, so that the large language model analyzes the composition rules of the data and generates the data rule function of the field;

[0189] According to the code returned by the large language model, set the data rule function of the field, enter the function into the function factory, and set the function mapping table.

[0190] The data rule function obtained through the real protocol data is then used to detect and update the protocol data template generated for the first time through the protocol document, and finally the protocol data template of the model is output.

[0191] See also Figure 8 , the embodiment of the present application also provides a protocol data template construction system, including:

[0192] The first module is used to obtain the agreement document;

[0193] The second module is used to analyze the description information of each field defined in the protocol document by using the large language model to obtain the first protocol rule information;

[0194] A third module is used to initialize the protocol data template according to the first protocol rule information;

[0195] The fourth module is used to collect real protocol data;

[0196] The fifth module is used to analyze the values ​​of each field of the real protocol data using the large language model to obtain the second protocol rule information;

[0197] The sixth module is used to update the protocol data template according to the second protocol rule information.

[0198] It can be understood that the contents of the above-mentioned protocol data template construction method embodiment are all applicable to the present system embodiment, the functions specifically implemented by the present system embodiment are the same as those in the above-mentioned protocol data template construction method embodiment, and the beneficial effects achieved are also the same as those achieved by the above-mentioned protocol data template construction method embodiment.

[0199] The embodiment of the present application also provides an electronic device, the electronic device comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein the program is executed by the processor to realize the above-mentioned protocol data template construction method. The electronic device can be any intelligent terminal including a tablet computer, a vehicle-mounted computer, etc.

[0200] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0201] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0202] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the protocol data template construction method of the embodiment of this application;

[0203] Input / output interface 903, used to implement information input and output;

[0204] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0205] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0206] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0207] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned protocol data template construction method.

[0208] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0209] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0210] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0211] The system embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0212] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0213] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0214] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0215] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0216] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0217] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0218] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0219] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A method for constructing a protocol data template, characterized in that: The following steps are involved: Obtain agreement documents; Analyze each field description information defined in the protocol document using a large language model to obtain first protocol rule information; Initialize a protocol data template according to the first protocol rule information; Collect real protocol data; Analyzing each field value of the real protocol data using the large language model to obtain second protocol rule information; The protocol data template is updated according to the second protocol rule information.

2. The method for constructing a protocol data template according to claim 1, characterized in that: The method of using the large language model to analyze the field description information defined in the protocol document to obtain the first protocol rule information includes the following steps: Extracting description information of each field in the protocol document; Writing the field description information into a first variable of a first question template to obtain a first question text, wherein the content of the first question template is an enabling statement generated by a rule code about the first variable; Inputting the first question text into the large language model to obtain a data rule function of the field description information; The first protocol rule information is determined according to the data rule function of each of the field description information.

3. The protocol data template construction method according to claim 2, characterized in that: After the step of extracting the description information of each field in the protocol document, the step of using the large language model to analyze the description information of each field defined in the protocol document to obtain the first protocol rule information further includes the following steps: By matching each of the field description information with a function mapping table respectively, determining whether the field description information exists in the function mapping table, wherein the function mapping table records a mapping relationship between stored data rule functions and function descriptions; When the field description information exists in the function mapping table, determining the data rule function of the field description information according to the function mapping table; When the field description information does not exist in the function mapping table, the step of writing the field description information into the first variable of the first question template to obtain the first question text is executed, and the step of inputting the first question text into the large language model to obtain the data rule function of the field description information is executed.

4. The method for constructing a protocol data template according to claim 3, characterized in that: The method of matching each of the field description information with the function mapping table to determine whether the field description information exists in the function mapping table comprises the following steps: Writing the field description information and the function description in the function mapping table into the second variable and the third variable of the second question template respectively to obtain a second question text, wherein the content of the second question template is an enabling statement for calculating the semantic similarity between the second variable and the third variable; Inputting the second question text into the large language model to obtain the semantic similarity between the field description information and the function description; When the semantic similarity between the field description information and any function description in the function mapping table is greater than a preset similarity value, it is determined that the field description information exists in the function mapping table; When the semantic similarities between the field description information and all function descriptions in the function mapping table are less than or equal to a preset similarity value, it is determined that the field description information does not exist in the function mapping table.

5. The method for constructing a protocol data template according to claim 1, characterized in that: The step of analyzing each field value of the real protocol data by using the large language model to obtain the second protocol rule information comprises the following steps: Extracting field values ​​from multiple real protocol data respectively to obtain each field value of each real protocol data; Integrate the same field values ​​of multiple real protocol data to obtain a field value set; Writing the field value set into the fourth variable of the third question template to obtain a third question text, wherein the content of the third question template is an enabling statement for analyzing the data rule composition of the fourth variable and performing code generation; Inputting the third question text into the large language model to obtain a data rule function of the field value set; The second protocol rule information is determined according to the data rule function of each of the field value sets.

6. The method for constructing a protocol data template according to claim 5, characterized in that: After the step of integrating the same field values ​​of the plurality of real protocol data to obtain a field value set, the step of using the large language model to analyze the respective field values ​​of the real protocol data to obtain the second protocol rule information further includes the following steps: By matching the field value set with the target function, determining whether the data composition rule of the field value set matches the rule defined by the target function; When the data combination rule of the field value set matches the rule defined by the objective function, the objective function is determined as the data rule function of the field value set; When the data combination rule of the field value set does not match the rule defined by the objective function, the step of writing the field value set into the fourth variable of the third question template to obtain the third question text is executed, and the step of inputting the third question text into the large language model to obtain the data rule function of the field value set is executed.

7. The method for constructing a protocol data template according to claim 6, characterized in that: The method of matching the field value set with the target function to determine whether the data composition rule of the field value set matches the rule defined by the target function comprises the following steps: Writing the field value set and the code block of the target function into the fifth variable and the sixth variable of the fourth question template respectively to obtain a fourth question text, wherein the content of the fourth question template is an enabling statement for matching and analyzing the function code rule of the sixth variable with the data rule of the fifth variable; The fourth question text is input into the large language model to obtain an output result, wherein the output result is used to determine whether the data combination rule of the field value set matches the rule defined by the objective function.

8. A protocol data template construction system, characterized in that: include: The first module is used to obtain the agreement document; The second module is used to analyze the description information of each field defined in the protocol document by using a large language model to obtain the first protocol rule information; A third module is used to initialize a protocol data template according to the first protocol rule information; The fourth module is used to collect real protocol data; A fifth module is used to analyze each field value of the real protocol data by using the large language model to obtain second protocol rule information; The sixth module is used to update the protocol data template according to the second protocol rule information.

9. An electronic device, characterized in that: The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the steps of the method described in any one of claims 1 to 7 are realized.

10. A storage medium, the storage medium being a computer-readable storage medium, used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any one of claims 1 to 7.

Citation Information

Cited By

  • Data communication method and device, storage medium and electronic equipment

    CN121056530A