Report generation method and device, storage medium and program product
Automatically creates data content generation functions and main functions through user input information and pre-trained language models, solving the limitations of report generation automation in the existing technology, and achieving efficient and customized report generation.
Patent Information
- Application Number
- CN202510193798.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-02-20
AI Technical Summary
Existing report generation techniques have limitations in automation, requiring manual templates and writing rules, resulting in high costs and inefficiency.
The target description object, data item and API interface call information are determined through user input information, and the pre-trained language model is used to automatically create data content generation functions and main functions to achieve full automatic generation of reports.
Significantly improves the efficiency of report generation, reduces manual intervention and error rates, and reduces the complexity and cost of template making and maintenance rules.
Smart Images

Figure CN120045173A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of computer software technology, and in particular, to a report generation method, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] As enterprises and organizations continue to increase their demand for data analysis, report generation has become an important part of daily operations. Effective report generation can help enterprises quickly obtain the information needed for decision-making and improve operational efficiency. However, existing report generation technology still has certain limitations in automation.
[0003] At present, there are two common ways to generate reports: one is to generate reports based on predefined templates. The method based on predefined templates requires manual template creation. When faced with diverse reporting requirements and constantly changing data, different templates need to be created specifically, which is costly. Another common method is to generate reports based on rules solidified into computer code. This method usually relies on manually written rules to determine how to extract data and how to organize report content, and requires manual writing and maintenance of rules. Summary of the invention
[0004] In view of this, one or more embodiments of the present specification provide a report generating method, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0006] According to a first aspect of one or more embodiments of this specification, a report generation method is proposed, including:
[0007] Based on the user input information, determine the identifier of the target description object of the report to be generated, at least one data item to be displayed in the report to be generated, and API interface call information related to each of the data items; the API interface call information related to each of the data items is used to obtain the data content of any description object in the data item;
[0008] For each of the data items, using a pre-trained language model, a data content generation function is created that takes an identifier of any description object as an input parameter and encapsulates API interface call information related to the data item; and
[0009] Using the pre-trained language model, a main function is created that takes an identifier of any description object as an input parameter, is capable of calling each of the data content generation functions to obtain output content, and generates a report based on the output content;
[0010] Run the main function based on the identifier of the target description object to obtain a report for the target description object.
[0011] According to a second aspect of the embodiments of the present specification, there is provided an electronic device, including:
[0012] A processor;
[0013] A memory for storing executable instructions of the processor;
[0014] Wherein, when the processor executes the executable instructions, it is used to implement the method described in the first aspect.
[0015] According to a third aspect of the embodiments of the present specification, there is provided a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the steps of the method described in the first aspect.
[0016] According to a fourth aspect of the embodiments of the present specification, there is provided a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the steps of the method described in the first aspect.
[0017] The technical solutions provided by the embodiments of the present specification may include the following beneficial effects:
[0018] In the embodiments of the present specification, the target description object, the data items to be displayed, and the API interface call information related to these data items can be flexibly determined through user input information. Then, the data content generation functions corresponding to each data item are automatically created by using a pre-trained language model, and the main function capable of calling these data content generation functions is automatically created. Finally, by running the main function based on the identifier of the target description object, a customized report for the target description object can be generated, avoiding the cumbersome process of manually configuring templates or rules, reducing manual intervention, and through an intelligent and automated process, not only significantly improving the efficiency of report generation, but also greatly reducing the complexity and error rate of manual operations.
[0019] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present specification. Description of the Drawings
[0020] Figure 1 is a schematic diagram of the architecture of a report generation service system provided by an exemplary embodiment.
[0021] Figure 2 is a flowchart of a report generation method provided by an exemplary embodiment.
[0022] Figure 3 is a schematic diagram of a report generation implementation process provided by an exemplary embodiment.
[0023] Figure 4 It is an interactive schematic diagram of generating a reference sample report provided by an exemplary embodiment.
[0024] Figure 5 It is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Detailed implementation manners
[0025] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with one or more embodiments of this specification. On the contrary, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0026] It should be noted that: In other embodiments, the steps of the corresponding methods are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0027] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to select authorization or rejection.
[0028] Here, relevant terms are explained:
[0029] A pre-trained language model, such as a large language model (LLM), refers to an artificial intelligence model based on deep learning technology, especially trained using a large corpus, aiming to understand and generate text similar to human language, and has powerful natural language understanding and generation capabilities. The goal of the LLM is to achieve various applications through natural language processing capabilities, such as text generation, translation, summarization, question answering, and dialogue systems, so as to help improve the efficiency of human-computer interaction and the degree of automation.
[0030] Figure 1 It is a schematic architecture diagram of a report generation service system provided by an exemplary embodiment. As Figure 1As shown, the system may include a server 11, a network 12, and several user terminals, such as a PC (Personal Computer) 13, a mobile phone 14, etc.
[0031] The server 11 may be a physical server including an independent host, or the server 11 may be a virtual server hosted by a host cluster. During operation, the server 11 may run the server-side program of the report generation application to implement the corresponding report generation service platform.
[0032] The PC 13 and the mobile phone 14 are only some types of user terminals that users can use. In fact, users can obviously also use user terminals of the following types: tablet devices, laptop computers, personal digital assistants (PDAs), wearable devices (such as smart glasses, smart watches, etc.). One or more embodiments of this specification do not limit this. During operation, the user terminal may run the client-side program of the report generation application to implement the client of the report generation service. Among them, the application program of the client of the above report generation service can be started and run on the user terminal. The client-side program may be a native application program installed on the user terminal, or the client-side program may be a small program, a fast application, or other similar forms. Of course, when using web technologies such as HTML5 or similar, relevant functions can be implemented through the page displayed by the browser. The browser here may be an independent browser application or a browser module embedded in some applications.
[0033] For the network 12 for interaction between user terminals such as the PC 13 and the mobile phone 14 and the server 11, it can be specifically selected to use a wired or wireless network to implement communication based on the communication method supported by the corresponding user terminal. This specification does not limit this. For example, the PC 13 can support both wired and wireless communication, so wired or wireless network can be used to implement communication according to needs, while the mobile phone 14 usually only supports wireless communication, so wireless network can be used to implement communication.
[0034] Based on the problems in the related technology, please refer to Figure 2 , an embodiment of this specification provides a report generation method, which can be executed by the above-mentioned server 11. The method includes:
[0035] In S201, based on the user input information, determine the identifier of the target description object of the report to be generated, at least one data item to be displayed in the report to be generated, and the API interface call information related to each data item; the API interface call information related to each data item is used to obtain the data content of any description object in this data item.
[0036] Exemplarily, based on Figure 1 the reported generation service system shown in the figure, a user can input relevant information through the user terminal held by the user, such as relevant information about the target description object (such as enterprise name, product name, etc.), data items that need to be displayed in the report to be generated, etc. Then, the user terminal can send the user input information to the server 11. The user input information can be the content input by the user at one time or the content input multiple times. For example, it can be the information transmitted through multiple rounds of conversations with the server. This embodiment does not impose any restrictions on this.
[0037] Exemplarily, the server can pre-store a number of API (Application Programming Interface) interface call information. After determining at least one data item to be displayed in the report to be generated, it can screen out the API interface call information related to each data item from the pre-stored number of API interface call information. Any API interface call information can be stored in the form of an API document, and the API document is used to describe the detailed information related to the API interface, including how to call the API, what input parameters are required, what data is returned, etc.
[0038] Exemplarily, the API document includes the basic information of the API interface, the basic information of the input parameters, the basic information of the returned data, and the call example.
[0039] The basic information of the API interface includes but is not limited to: (1) Interface name: the name or function description of the API. For example, get_company_info represents an interface for obtaining enterprise information. (2) Version information: the version number of the API to ensure compatibility between the client and the server. (3) Request type: describes the request method of the API, usually GET (obtaining data), POST (submitting data), PUT (updating data), DELETE (deleting data), etc. (4) Interface path (URL): the request path of the API, usually included after the base URL, for example: https: / / api.example.com / v1 / get_company_info.
[0040] The basic information of input parameters includes, but is not limited to: (1) Parameter name: The parameters required for each API request. For example, company_name (enterprise name), company_id (enterprise ID), etc. (2) Type: The type of the parameter, usually string, integer, boolean, etc. (3) Parameter description: A detailed description of each input parameter to help developers understand the meaning of the parameter and how to fill it in. For example, "company_name: The name of the enterprise, which must be the same as the name registered in the system." (4) Input example value: Give an example value of the parameter to facilitate understanding of how to use it. For example, company_name: "ABC Corp".
[0041] The basic information of the returned data includes, but is not limited to: (1) Return data structure: The data format returned by the API, usually in JSON or XML format. The document will describe in detail the returned data structure, field names, types, meanings, etc. (2) Field description: The description of each returned field, including the field name, type, meaning, etc. For example, "company_name: Returns the name of the enterprise; revenue: The annual revenue of the enterprise, in ten thousand yuan." (3) Example response: An example of the returned data to help developers understand the actual returned data format. (4) Error codes and error messages: Describe the error codes that the API may return and their meanings. For example, 404 means the resource cannot be found, and 400 means the request parameters are incorrect, etc.
[0042] Call examples include: (1) Example request: Show how to call the API interface, which may include request headers, request bodies, and query parameters, etc. For example, GET / v1 / get_company_info?company_name=ABC%20Corp, or a JSON request body example using the POST method. (2) Example response: Show the possible results returned after calling this interface to help developers understand how to process the returned data.
[0043] In S202, for each data item, a data content generation function is created using a pre-trained language model, with the identifier of any description object as the input parameter and encapsulating the API interface call information related to the data item.
[0044] In this step, each data item and its related API interface call information can be input into a pre-trained language model to create, by the pre-trained language model, a data content generation function that takes the identifier of any description object as an input parameter and encapsulates the API interface call information related to the data item. Through the pre-trained language model, data content generation functions for each data item can be automatically generated, reducing manual coding and saving development time and labor costs; the pre-trained language model can understand and process complex data structures, automatically encapsulate API call information, and improve the intelligence level of the data acquisition process.
[0045] It can be understood that this embodiment does not impose any restrictions on the specific form of the data content generation function. For example, the data content generation function can be a Python function or a function written in other programming languages.
[0046] In S203, a main function is created by using the pre-trained language model, which takes the identifier of any description object as an input parameter, can call each data content generation function to obtain the output content, and generates a report based on the output content.
[0047] In this step, all data items and their corresponding data content generation functions can be input into the pre-trained language model to create a main function by the pre-trained language model. The main function takes the identifier of any description object as an input parameter, can call each data content generation function to obtain the output content, and uses these output contents to generate a final report. The main function combines each data content generation function together, automatically calls these functions and summarizes the results, realizing the automation of report generation.
[0048] In S204, the main function is run based on the identifier of the target description object to obtain a report for the target description object.
[0049] In this step, running the main function based on the identifier of the target description object can automatically obtain various data contents of the target description object, complete the fully automated process of report generation. Through the above automated operations, the manual operation requirements are greatly reduced, and the time and cost required for report generation are reduced.
[0050] The report generation method provided in this embodiment can achieve a fully automated report generation process through the steps of S201 to S204. First, the target description object and related data items to be displayed can be flexibly determined through user input information. The server intelligently determines and obtains the API interface call information related to these data items, avoiding the cumbersome process of manually configuring templates or rules. Then, the data content generation functions corresponding to each data item are automatically created using a pre-trained language model, and the main function that can call these data content generation functions is automatically created. Finally, by running the main function based on the identifier of the target description object, a customized report for the target description object can be generated, reducing manual intervention and improving the generation efficiency and flexibility. Generally speaking, through an intelligent and automated process, this method not only significantly improves the efficiency of report generation, but also greatly reduces the complexity and error rate of manual operations.
[0051] In some embodiments, refer to Figure 3 , the implementation process of data report generation includes an intent recognition process, a first report generation process, a second report generation process, and a regular reply process.
[0052] In the intent recognition process, the server can perform intent recognition on the user input information. Intent recognition is an important task in natural language processing. First, the server parses the user input information, including word segmentation, syntactic analysis, named entity recognition, etc., so as to extract the key information in the user input information. For example, the target description object mentioned by the user, the report generation method expected by the user, etc. Then, useful features are extracted from the parsed text, and based on the extracted features, the user input information is classified into different intents. Through intent recognition, the server can understand the specific needs of the user and determine the expected operation type according to the user's input, so as to provide more accurate and customized services for the user.
[0053] Exemplarily, the user input information can be classified into any one of three intents, which are the first intent, the second intent, and the third intent respectively. The first intent indicates generating a report with reference to a sample, the second intent indicates generating a report without a sample, and the third intent indicates other questions other than generating a report.
[0054] After the server recognizes the first intent, it enters the first report generation process. The user input information usually includes the relevant information of the target description object and the sample report for reference in the report to be generated; after recognizing the second intent, it enters the second report generation process. The user input information usually includes the relevant information of the target description object. For example, the user input information is "Provide a report on the basic information of Company A"; after recognizing the third intent, it enters the regular reply process.
[0055] The following is an exemplary description of the first report generation process:
[0056] In the first report generation process, the user input information usually includes information about the target description object and a sample report for reference in the report to be generated. Therefore, the server can determine the identifier of the target description object based on the user input information and obtain the sample report for reference in the report to be generated from it. Then, based on the sample report and a number of pre-stored API interface call information, at least one data item to be displayed in the report to be generated and the API interface call information related to each data item are determined. In this embodiment, by referring to the existing sample report, the server can quickly identify and determine the data items required for the report and the relevant API interfaces, avoiding the lengthy process of generating the report from scratch; and by based on the sample report and the pre-stored API interface call information, the server can automatically decide which data items to display and their sources, reducing manual intervention and improving the degree of automation.
[0057] Exemplarily, the server can convert the sample report into a first vector, convert each API interface call information in the number of pre-stored API interface call information into a second vector, and then recall a number of candidate API interface call information from the number of pre-stored API interface call information based on the similarity between the first vector and each second vector. For example, the number of API interface call information can be sorted in descending order of similarity, and then starting from the API interface call information with the highest similarity, the first n API interface call information can be selected as the candidate API interface call information, where n > 0. For another example, the API interface call information with a similarity higher than a preset threshold can be determined as the candidate API interface call information, and the preset threshold can be specifically set according to the actual application scenario.
[0058] The sample report provides the specific display content and structure of the report, and the API interface call information provides the specific data source information related to the data item, including how to obtain the data, the data type, etc. The server can input the sample report and a number of candidate API interface call information into the pre-trained language model, so as to use the pre-trained language model to refer to the number of candidate API interface call information and identify at least one data item from the sample report and establish a data item mapping relationship. The data item mapping relationship includes but is not limited to: the display position, type, and the relevant API interface call information of each data item in the sample report.
[0059] Exemplarily, after receiving the sample report and candidate API interface information, the pre-trained language model converts them into a format suitable for the model to understand. For example, the pre-trained language model decomposes the text of the sample report into different data segments, identifies the context of each data item, and then infers the type of the data item based on the context information in the sample report text. For example, "enterprise name" may be a string, while "establishment time" may be a date format. And by analyzing the description of each candidate API interface call information, the function of each API interface is judged and matched with the data items in the sample report. For example, if there is a data item "enterprise name" in the report, the pre-trained language model may match it with an API interface such as get_company_info, which returns company name information. Finally, the pre-trained language model establishes the mapping relationship of each data item, clarifying the position, type, and API interface call information of the data item in the sample report. Through the in-depth understanding of the sample report and the intelligent analysis of the API interface description by the pre-trained language model, the processes of data item identification, type inference, display position determination, and API interface matching are completed, thus providing a basis for the automatic generation of the report.
[0060] The server can input each data item and its related API interface call information into the pre-trained language model, so that the pre-trained language model creates a data content generation function with the identifier of any description object as the input parameter and encapsulating the API interface call information related to the data item.
[0061] In a possible scenario, considering that there may be a difference between the display format of at least some data items in the sample report and the return data format described by the API interface call information related to the data item. This format difference may cause the return data of the API interface to not be directly used during the report generation process. Therefore, the server can define data processing logic for the return data of the API interface based on the difference between the two. Through defining the corresponding data processing logic in this embodiment, the data format returned by the API interface can be automatically converted into the format required in the sample report, thus ensuring data consistency and accuracy in report generation.
[0062] Then, during the process of generating the data content generation function, the server can input each data item, the related API interface call information, and the possible data processing logic into the pre-trained language model, so that the pre-trained language model creates a data content generation function with the identifier of any description object as the input parameter and encapsulating the API interface call information related to the data item and the data processing logic for the return data of the API interface. The data content generation function can directly output the content that meets the report display requirements, reducing the manual work of developers in data format conversion during the report generation process and improving the degree of automation.
[0063] For example, suppose there is a data item "Enterprise Establishment Date" in a sample report, with the format "February 10, 2025", and the data format returned by the relevant API interface get_company_info is a date object "2025-02-10T00:00:00Z". Due to the format difference between the two, the date object returned by the API cannot be directly put into the report when generating the report. Therefore, the server needs to solve this problem through the following steps: The server discovers that the data returned by the API is a date object, while the report requires a date in string format. The server can define data processing logic based on the format difference between the two, converting the date object returned by the API into the format of "YYYY year MM month DD day" (i.e., "February 10, 2025"). The server inputs the data item "Enterprise Establishment Date", the relevant API interface call information, and the data processing logic into the pre-trained language model. The pre-trained language model creates a data content generation function based on this information, and intelligently converts the date format returned by the API into the string format required by the report. In this way, the format difference can be automatically adapted, and the data content generation function can directly output content that meets the report display requirements, significantly improving the flexibility and accuracy of automatically generating reports.
[0064] In some possible implementation manners, after generating the data content generation function, the data content generation function can be verified to improve the stability of the data content generation function. The server can obtain the identifier of the example description object from the sample report included in the user input information, and obtain the reference data content of the example description object in each data item from the sample report, and then run each data content generation function using the identifier of the example description object to obtain the output content of the data content generation function; if there is an abnormal data content generation function whose output content is inconsistent with the reference data content, the pre-trained language model can be used to modify the abnormal data content generation function based on the difference between the output content of the abnormal data content generation function and the reference data content.
[0065] In this implementation manner, by verifying after generating the data content generation function, the stability and accuracy of the data content generation function can be significantly improved. The server can run the data content generation function based on the identifier of the example description object, and compare its output content with the expected output (i.e., the reference data content), automatically detecting the abnormal data content generation function. If an abnormality is found, the server can analyze the difference between the output content of the abnormal data content generation function and the reference data content through the pre-trained language model, and automatically adjust the abnormal data content generation function, thereby correcting potential problems in the generation process. This process can not only enhance the accuracy and reliability of report generation, but also reduce manual intervention and improve the intelligence and automation level of the system.
[0066] For example, assume there is a sample report that contains multiple data items, such as company name, incorporation date, number of employees, etc. The reference data contents of these 3 data items in the sample report are respectively: (1) Company name: XXX Technology Co., Ltd.; (2) Incorporation date: February 10, 2025; (3) Number of employees: 100.
[0067] The server generates 3 data content generation functions corresponding to the enterprise identifier input and the 3 data contents of "company name", "incorporation date", and "number of employees" respectively. The output content of the data content generation function corresponding to "company name" is "XXX Technology Co., Ltd.", the output content of the data content generation function corresponding to "incorporation date" is "2025-02-10T00:00:00Z", and the output content of the data content generation function corresponding to "number of employees" is "100".
[0068] After comparison, it can be seen that the actual output content of the "incorporation date" data item is "2025-02-10T00:00:00Z", while the reference data content in the sample report is "February 10, 2025". The two are inconsistent. The server automatically detects this difference and marks the "incorporation date" as an abnormal data item. The server can input the data content generation function, the actual output content, and the reference data content corresponding to the "incorporation date" into a pre-trained language model, so that the pre-trained language model can modify the data content generation function corresponding to the abnormal data item based on the difference between the output content and the reference data content corresponding to the abnormal data item. For example, encapsulate data processing logic in the data content generation function to convert the date returned by the API interface into the format of "YYYY year MM month DD day".
[0069] Of course, in addition to format differences, abnormalities in the data content generation function also include: the numerical value returned by the API interface may be in a different unit from that expected in the report, the data returned by the API interface may be incomplete, or the data returned by the API interface may exceed the reasonable range or expected value in the report (such as exceeding the allowed maximum or minimum value), etc. By validating and correcting the data content generation function, the accuracy and stability of the report generation process are ensured.
[0070] Exemplarily, the maximum verification times for the data content generation function corresponding to the same data item can be set. When the verification of the data content generation function corresponding to the same data item passes (the output content of the data content generation function is consistent with the reference data content) or reaches the maximum verification times, the verification is stopped to prevent getting into an infinite loop or excessive resource consumption when encountering unsolvable abnormalities, and to ensure the efficiency and stability of the report generation process.
[0071] After obtaining the data content generation functions corresponding to each data item, the server can input the sample report, the data item mapping relationship, and all the data content generation functions into the pre-trained language model to create a main function using the pre-trained language model. The functions of this main function include: taking the identifier of any description object as an input parameter, being able to call each data content generation function to obtain the output content, and replacing the reference data content of each data item in the sample report based on the display position of each data item in the sample report and the output content corresponding to each data item, and outputting the final report. In this embodiment, the pre-trained language model can automatically generate the main function according to the structure of the sample report without manual intervention, greatly improving the speed and efficiency of report generation. The main function can automatically call the data content generation function, fill the data into the correct position of the report, and automatically complete the generation of the report. By automatically generating the main function, the workload of manually writing the report generation logic can be reduced, making the report generation process more intelligent and efficient.
[0072] Finally, after obtaining the main function output by the pre-trained language model, the server can run the main function based on the identifier of the target description object to obtain a report for the target description object.
[0073] In one example, please refer to Figure 4 , assuming that the user input information is "generate a report for Company A by imitating the sample report of Company B", and the sample report of Company B is uploaded. If the server determines it as the first intention through intent recognition, then the report generation process described in the above first report generation process is followed to generate a report for Company A and display it to the user.
[0074] The following is an exemplary description of the second report generation process:
[0075] In the second report generation process, the user input information usually includes relevant information about the target description object. For example, if the user input information is "provide a report on the basic information of Company A", the server can determine the identifier of the target description object based on the user input information, and determine at least one data item to be displayed in the report to be generated based on the user input information and the pre-constructed knowledge base that includes at least several data items, and obtain the API interface call information related to each data item from the pre-stored several API interface call information. In this embodiment, when there is no sample report, the server can automatically determine the data item according to the user input information and the pre-constructed knowledge base, ensuring that the report generation still proceeds smoothly. By using the data items pre-stored in the knowledge base, report content that matches the information provided by the user can be generated, ensuring the customization and flexibility of the report.
[0076] Exemplarily, a set of specific data items corresponding to different types of description objects can be pre-stored in the knowledge base. For example, the data items of a description object of the enterprise type include: company name, establishment time, number of employees, company address, etc.; for another example, the data items of a description object of the product type include: product name, product category, listing date, price, product description, manufacturer, etc.; for another example, the data items of a description object of the employee type include: employee name, position, start date of employment, department, work location, etc. Then, in the actual application process, the server can determine the type of the target description object based on the user input information, and thus obtain the data items related to the target description object from the knowledge base based on the type of the target description object.
[0077] Exemplarily, the user input information may also include data items related to the target description object, and this embodiment does not impose any restrictions on this.
[0078] After determining at least one data item to be displayed in the to-be-generated report and the API interface call information related to each data item, the server can input the at least one data item and the API interface call information related to each data item into the pre-trained language model, so that the pre-trained language model creates a data content generation function that takes the identifier of any description object as an input parameter and encapsulates the API interface call information related to the data item.
[0079] In a possible scenario, data processing logics for the return data of the API interface corresponding to at least some of the data items can be pre-stored in the knowledge base. Then, in the process of generating the data content generation function, the server can input each data item, the related API interface call information, and the data processing logics obtained from the knowledge base into the pre-trained language model, so that the pre-trained language model creates a data content generation function that takes the identifier of any description object as an input parameter and encapsulates the API interface call information related to the data item and the data processing logics for the return data of the API interface. The data content generation function can directly output the content that meets the report display requirements, reducing the manual work of developers for data format conversion during the report generation process and improving the degree of automation. Through the pre-stored data processing logics in this embodiment, different format conversions can be automatically processed when generating the data content function, avoiding manual intervention, thereby improving the efficiency of report generation.
[0080] In another possible scenario, the user can also request the display format of at least some data items in their user input information. If there is a difference between the display format of the data items described in the user input information and the return data format described in the API interface call information related to the data items, the server can define the data processing logic for the return data of the API interface based on the difference between the two. The server can input each data item, the related API interface call information, and the data processing logic into the pre-trained language model to create a data content generation function with the identifier of any description object as the input parameter and encapsulating the API interface call information related to the data item and the data processing logic for the return data of the API interface. In this embodiment, the user no longer needs to manually adjust the data display format, and the server can automatically complete the conversion according to the predefined format requirements, avoiding the cumbersome manual processing and improving the degree of automation.
[0081] In some possible implementation manners, after generating the data content generation function, the data content generation function can be verified to improve the stability of the data content generation function. Exemplarily, the knowledge base can also pre-store example information corresponding to each type of description object, and the example information can include the identifier of the example description object and the reference data content of the example description object in each data item. The server can obtain the identifier of the example description object and the reference data content of the example description object in each data item from the knowledge base, and then run each data content generation function using the identifier of the example description object to obtain the output content of the data content generation function; if there is an abnormal data content generation function with inconsistent output content and reference data content, the pre-trained language model can be used to modify the abnormal data content generation function based on the difference between the output content of the abnormal data content generation function and the reference data content.
[0082] In this implementation manner, by verifying after generating the data content generation function, the stability and accuracy of the data content generation function can be significantly improved. The server can run the data content generation function based on the identifier of the example description object and compare its output content with the expected output (i.e., the reference data content) to automatically detect the abnormal data content generation function. If an abnormality is found, the server can analyze the difference between the output content of the abnormal data content generation function and the reference data content through the pre-trained language model and automatically adjust the abnormal data content generation function, thereby correcting potential problems in the generation process. This process can not only enhance the accuracy and reliability of report generation but also reduce manual intervention and improve the intelligence and automation level of the system.
[0083] After obtaining the data content generation functions corresponding to each data item, the server can input the preset display logic and the data content generation functions corresponding to each data item into the pre-trained language model to create a main function using the pre-trained language model. The functions of this main function include: taking the identifier of any description object as an input parameter, being able to call each data content generation function to obtain the output content, and generating a report based on the preset display logic for the output content corresponding to each data item. This embodiment can improve the automation degree of report generation, reduce manual intervention. The main function can call the generation function according to the identifier of the description object to obtain the output content, and generate a complete report according to the preset display logic, thus improving the efficiency of report generation.
[0084] Finally, after obtaining the main function output by the pre-trained language model, the server can run the main function based on the identifier of the target description object, so as to obtain a report for the target description object.
[0085] The following gives an exemplary description of the conventional reply process:
[0086] After entering the conventional reply process, the server can input the user input information into the pre-trained language model. The pre-trained language model generates a reply to the user input information and returns the reply to the user.
[0087] In some embodiments, when presenting the report for the target description object to the user, the user can also edit the report for the target description object according to their own needs. The server can obtain the editing information of the user for the report of the target description object, and then input the main function and the editing information of the user for the report of the target description object into the pre-trained language model, so that the pre-trained language model modifies the main function based on the editing information of the user for the report of the target description object, making the report format output by the modified main function conform to the report format after the user's editing. The modified main function can be saved for subsequent reuse.
[0088] In some embodiments, the above-generated main function can take the identifier of any description object as an input parameter, so as to generate a report for any description object. Therefore, in order to improve the report generation efficiency, the above main function can be reused as a report generation template. After obtaining the main function, the server can also use the pre-trained language model to generate function description information of the main function, and then store the main function and its function description information in the template library.
[0089] In subsequent actual application processes, the main functions in the template library can be presented as report generation templates in the user interface for the user to select, and the function description information of each main function template can also be provided to the user to help the user understand the functions and applicable scopes of each main function. Furthermore, the server can respond to the selection operation of at least one main function in the template library, and reuse the selected main function and the identifier of the description object input by the user to generate a report. In this embodiment, by storing the main function as a template, the recreation of relevant functions every time a report is generated can be avoided. The main functions in the template library can be reused in different application scenarios, greatly improving the efficiency of report generation.
[0090] In some embodiments, another report generation method is provided. Relevant report generation data can be prepared to fine-tune any pre-trained language model to obtain a report generation model. The report generation model can flexibly adjust the generation strategy according to different inputs and requirements to handle more diverse report generation tasks.
[0091] For example, if the first intent is recognized, the input of the report generation model is the user input information and several API interface call information, and the output is a report for the target description object.
[0092] For another example, if the second intent is recognized, the input of the report generation model is the user input information, relevant knowledge obtained from the knowledge base, and several API interface call information, and the output is a report for the target description object.
[0093] The various technical features in the above embodiments can be combined arbitrarily as long as there is no conflict or contradiction between the features. However, due to space limitations, they are not described one by one. Therefore, any combination of the various technical features in the above embodiments also belongs to the scope disclosed in this specification.
[0094] In some embodiments, this embodiment of the specification also provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor realizes the method described in any one of the above by running the executable instructions.
[0095] Figure 5 It is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to Figure 5, at the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510. Of course, it may also include other hardware required for other functions. One or more embodiments of this specification can be implemented in a software manner. For example, the processor 502 reads the corresponding computer program from the non-volatile memory 510 into the memory 508 and then runs it. Of course, in addition to the software implementation method, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, and can also be hardware or a logic device.
[0096] The report generation device can be applied to a device as Figure 5 shown to implement the technical solutions of this specification. Among them, the report generation device may include:
[0097] An information determination module, configured to determine the identifier of the target description object of the report to be generated, at least one data item to be displayed in the report to be generated, and API interface call information related to each of the data items based on user input information; the API interface call information related to each of the data items is used to obtain the data content of any description object in this data item.
[0098] A function creation module, configured to, for each of the data items, create a data content generation function that uses the pre-trained language model with the identifier of any description object as the input parameter and encapsulates the API interface call information related to the data item.
[0099] The function creation module is further configured to use the pre-trained language model to create a main function that uses the identifier of any description object as the input parameter, can call each of the data content generation functions to obtain the output content, and generates a report based on the output content.
[0100] A report generation module, configured to run the main function based on the identifier of the target description object to obtain a report for the target description object.
[0101] In some embodiments, the information determination module is specifically configured to: perform intent recognition on the user input information; if a first intent is recognized, where the first intent indicates generating a report with reference to a sample report, determine the identifier of the target description object based on the user input information and obtain a sample report for reference in the to-be-generated report therefrom, and determine at least one data item to be displayed in the to-be-generated report and API interface call information related to each of the data items based on the sample report and a plurality of pre-stored API interface call information; if a second intent is recognized, where the second intent indicates generating a report without a sample, determine the identifier of the target description object based on the user input information, and determine at least one data item to be displayed in the to-be-generated report based on the user input information and a knowledge base that at least includes a plurality of data items, and obtain API interface call information related to each of the data items from a plurality of pre-stored API interface call information.
[0102] In some embodiments, the information determination module is specifically configured to: obtain a first vector obtained by converting the sample report and second vectors obtained by converting each of the API interface call information in the plurality of pre-stored API interface call information; recall a plurality of candidate API interface call information from the plurality of pre-stored API interface call information based on the similarity between the first vector and each of the second vectors; use the pre-trained language model to identify the at least one data item from the sample report and establish a data item mapping relationship with reference to the plurality of candidate API interface call information, where the data item mapping relationship at least includes each of the data items and the API interface call information related thereto.
[0103] In some embodiments, the data content generation functions respectively corresponding to at least some of the data items further encapsulate data processing logic for the return data of the API interface.
[0104] Wherein, in the case of recognizing the first intent from the user input information, the data processing logic corresponding to the data item is defined based on the format difference between: the display format of the data item in the sample report, and, the return data format described by the API interface call information related to the data item.
[0105] In the case of recognizing the second intent from the user input information, the data processing logic corresponding to the data item is obtained from the knowledge base, or, is defined based on the format difference between: the display format of the data item described in the user input information, and, the return data format described by the API interface call information related to the data item.
[0106] In some embodiments, the data item mapping relationship further includes the display positions of the respective data items in the sample report. The function creation module is specifically configured to input the sample report, the data item mapping relationship, and the data content generation functions into the pre-trained language model, so as to create a main function by using the pre-trained language model. The main function takes the identifier of any description object as an input parameter, can call each of the data content generation functions to obtain output content, and replaces and outputs the reference data content of each data item in the sample report based on the display positions of the respective data items in the sample report and the output content corresponding to each data item.
[0107] In some embodiments, the function creation module is specifically configured to, if a second intent is recognized, input the preset display logic and the data content generation functions into the pre-trained language model, so as to create a main function by using the pre-trained language model. The main function takes the identifier of any description object as an input parameter, can call each of the data content generation functions to obtain output content, and generates a report based on the preset display logic for the output content corresponding to each data item.
[0108] In some embodiments, the apparatus further includes a function verification module, configured to obtain the identifier of the example description object and the reference data content of the example description object in each of the data items; run each of the data content generation functions by using the identifier of the example description object to obtain the output content of the data content generation functions; if there is an abnormal data content generation function for which the output content is inconsistent with the reference data content, use the pre-trained language model to modify the abnormal data content generation function based on the difference between the output content of the abnormal data content generation function and the reference data content.
[0109] In some embodiments, the function verification module is specifically configured to, when a first intent is recognized from the user input information, obtain the identifier of the example description object from the sample report included in the user input information, and obtain the reference data content of the example description object in each of the data items from the sample report; when a second intent is recognized from the user input information, obtain the identifier of the example description object and the reference data content of the example description object in each of the data items from the knowledge base.
[0110] In some embodiments, it further includes a reuse module, configured to generate function description information of the main function by using the pre-trained language model; store the main function and its function description information in a template library; in response to a selection operation on at least one main function in the template library, reuse the selected main function to generate a report.
[0111] The implementation processes of the functions and roles of the various modules in the above device are specifically described in detail in the implementation processes of the corresponding steps in the above method, and will not be elaborated here.
[0112] Based on the same concept as the above method, this specification also provides a computer-readable storage medium, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.
[0113] Computer-readable media includes both permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage, quantum memory, graphene-based storage media, or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0114] Based on the same concept as the above method, this specification also provides a computer program product, including computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.
[0115] The above description is only a preferred embodiment of one or more embodiments of this specification, and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included within the scope of protection of one or more embodiments of this specification.
Claims
1. A report generation method, comprising: Based on the user input information, determine the identifier of the target description object of the report to be generated, at least one data item to be displayed in the report to be generated, and API interface call information related to each of the data items; the API interface call information related to each of the data items is used to obtain the data content of any description object in the data item; For each of the data items, a data content generation function is created using a pre-trained language model, which takes an identifier of any description object as an input parameter and encapsulates API interface call information related to the data item; as well as, Using the pre-trained language model, a main function is created that takes an identifier of any description object as an input parameter, is capable of calling each of the data content generation functions to obtain output content, and generates a report based on the output content; The main function is run based on the identifier of the target description object to obtain a report on the target description object.
2. The method according to claim 1, wherein the step of determining, based on user input information, an identifier of a target description object of a report to be generated, at least one data item to be displayed in the report to be generated, and API interface call information related to each of the data items comprises: Performing intent recognition on the user input information; If a first intention is identified, the first intention indicates to generate a report with reference to a sample, an identifier of the target description object is determined based on the user input information and a sample report for reference of the report to be generated is obtained therefrom, and at least one data item to be displayed in the report to be generated and API interface call information related to each of the data items are determined based on the sample report and a plurality of pre-stored API interface call information; If a second intent is identified, the second intent indicates generating a report without a sample, determining an identifier of the target description object based on the user input information, and determining at least one data item to be displayed in the report to be generated based on the user input information and a pre-built knowledge base including at least several data items, and obtaining API interface call information related to each of the data items from several pre-stored API interface call information.
3. The method according to claim 2, wherein the step of determining at least one data item to be displayed in the report to be generated and the API interface call information related to each of the data items based on the sample report and the pre-stored API interface call information comprises: Acquire a first vector converted from the sample report and a second vector converted from each of the plurality of pre-stored API interface call information; Recalling a plurality of candidate API interface call information from the plurality of pre-stored API interface call information based on the similarities between the first vector and each of the second vectors; The pre-trained language model is used to refer to the multiple candidate API interface call information, identify at least one data item from the sample report and establish a data item mapping relationship, wherein the data item mapping relationship includes at least each of the data items and its related API interface call information.
4. The method according to claim 2, wherein the data content generation function corresponding to at least part of the data items further encapsulates data processing logic for return data of the API interface; in, In the case where the first intention is identified from the user input information, the data processing logic corresponding to the data item is defined based on the format difference between: the display format of the data item in the sample report, and the return data format described by the API interface call information related to the data item; When the second intention is identified from the user input information, the data processing logic corresponding to the data item is obtained from the knowledge base, or defined based on the format difference between: the display format of the data item described in the user input information, and the return data format described by the API interface call information related to the data item.
5. The method according to claim 2, wherein the data item mapping relationship further includes a display position of each of the data items in the sample report; The method of using the pre-trained language model to create a main function that takes the identifier of any description object as an input parameter, can call the data content generation function to obtain output content, and generates a report based on the output content includes: The sample report, the data item mapping relationship and the data content generation function are input into the pre-trained language model to create a main function using the pre-trained language model. The main function takes the identifier of any description object as an input parameter, can call each of the data content generation functions to obtain output content, and replaces and outputs the reference data content of each data item in the sample report based on the display position of each data item in the sample report and the output content corresponding to each data item.
6. The method according to claim 2, wherein the step of using the pre-trained language model to create a main function that takes an identifier of any description object as an input parameter, can call the data content generation function to obtain output content, and generates a report based on the output content comprises: If the second intention is identified, the preset display logic and the data content generation function are input into the pre-trained language model, so as to use the pre-trained language model to create a main function that takes the identifier of any descriptive object as an input parameter, can call each of the data content generation functions to obtain output content, and report and generate the output content corresponding to each data item based on the preset display logic.
7. The method according to any one of claims 1 to 6, after creating, for each of the data items, a data content generation function corresponding to each of the data items using a pre-trained language model, taking an identifier of any description object as an input parameter and encapsulating API interface call information related to the data item, further comprising: Obtaining an identifier of an example description object and reference data content of the example description object in each of the data items; Using the identifier of the example description object, running each of the data content generation functions to obtain output content of the data content generation function; If there is an abnormal data content generation function whose output content is inconsistent with the reference data content, the abnormal data content generation function is modified using the pre-trained language model based on the difference between the output content of the abnormal data content generation function and the reference data content.
8. The method according to claim 7, wherein obtaining the identifier of the example description object and the reference data content of the example description object in each of the data items comprises: In the case where the first intention is identified from the user input information, obtaining an identifier of the example description object from the sample report included in the user input information, and obtaining reference data content of the example description object in each of the data items from the sample report; When the second intention is identified from the user input information, the identifier of the example description object and the reference data content of the example description object in each of the data items are obtained from the knowledge base.
9. The method according to claim 1, further comprising: Generate functional description information of the main function using the pre-trained language model; Storing the main function and its functional description information in a template library; In response to a selection operation on at least one main function in the template library, the selected main function is reused to generate a report.
10. An electronic device comprising: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 9 by executing the executable instructions.
11. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 9.
12. A computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Automatic report generation method and system
CN117933217A
Market subject special credit report generation method, system and device and medium
CN118520855A
Data report generation method, electronic device, storage medium and computer program product
CN119202140A
Report generation system and method
US20030046264A1