Report generation method and device, equipment, storage medium and program product
By determining the report type, time period and format information in the report generation, and inputting corresponding generation prompt information into the large language model, the problem of low accuracy of report generation in the prior art is solved, and high accuracy and timeliness report generation is achieved.
Patent Information
- Application Number
- CN202410637148.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-05-27
AI Technical Summary
In the report generation, due to the randomness of the content generated by the model, the generated reports are low in accuracy and cannot meet the specific needs of users.
By responding to user's report generation instructions, determine the report type, time period and format information, match the corresponding model prompt template, and enter the generated prompt information in the large language model to output the report that meets the requirements.
It improves the accuracy and timeliness of report generation, ensures that the generated reports are formatted correctly and have fresh content, and can better meet user needs.
Smart Images

Figure CN120045640A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of artificial intelligence technology and big data technology, and more particularly to a report generation method, apparatus, device, medium, and program product. Background Art
[0002] When writing a report, the writer usually needs to first collect relevant data, then analyze the data, and finally write the report. However, the processes of collecting and analyzing data consume a large amount of time, and the efficiency of writing reports manually is low.
[0003] Therefore, to solve the problem of low efficiency in writing reports manually, the prior art usually uses a report generation model to automatically generate reports. However, due to the randomness of the content generated by the model, the accuracy of the generated report is low, and a report that meets the requirements cannot be obtained. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides a report generation method, apparatus, device, medium, and program product.
[0005] According to a first aspect of the present disclosure, there is provided a report generation method, including: in response to receiving a report generation instruction issued by a user's terminal device, based on the report generation instruction, determining report type information, report period information, and report format information of the report to be generated; based on the report type information, determining a model prompt template matching the report type information; based on the model prompt template, the report period information, and the report format information, determining report generation prompt information; and inputting the report generation prompt information into the large language model to output a target report.
[0006] According to an embodiment of the present disclosure, the determining report generation prompt information based on the model prompt template, the report period information, and the report format information: querying target report data matching the model prompt template and the report period information in a database; and determining report generation prompt information based on the target report data, the model prompt template, and the report format information.
[0007] According to an embodiment of the present disclosure, the querying target report data matching the model prompt template and the report period information in the database includes: obtaining an initial query statement matching the model prompt template; adding the report period information to the initial query statement to obtain a target query statement; and querying the database using the target query statement to obtain the target report data.
[0008] According to an embodiment of the present disclosure, the above model prompt template includes an index determination function and a conclusion generation function. The above target report data includes target period data and reference period data. Adding the above target report data to the above model prompt template according to the second identifier of the above target report data to obtain model prompt information includes: inputting the above target period data and the above reference period data into the above index determination function to output target index data, where the above reference period data is historical data of the above target period data, and the above target index data is used to characterize the change amount of the above target period data relative to the above reference period data; inputting the above target index data into the above conclusion generation function to output target conclusion information; and adding the above target conclusion information to the above model prompt template to obtain the above model prompt information.
[0009] According to an embodiment of the present disclosure, the above conclusion generation function includes a plurality of conclusion determination statements. The above conclusion determination statements include conclusion information. Inputting the above target index data into the above conclusion generation function to output target conclusion information includes: determining a target conclusion determination statement that matches the above target index data from the above plurality of conclusion determination statements; and determining the conclusion information in the above target conclusion determination statement as the target conclusion information.
[0010] According to an embodiment of the present disclosure, the above method further includes: displaying the above report generation prompt information on a terminal corresponding to the user; in response to a modification operation of the user on the above report generation prompt information, obtaining the modified report generation prompt information modified by the user from the above terminal; and using the above modified report generation prompt information to replace the above report generation prompt information.
[0011] A second aspect of the present disclosure provides a report generation device, including: an information determination module, configured to determine report type information, report period information, and report format information of a report to be generated based on a report generation instruction received from a terminal device of a user in response to the report generation instruction; a template determination module, configured to determine a model prompt template that matches the above report type information based on the above report type information; a prompt determination module, configured to determine report generation prompt information based on the above model prompt template, the above report period information, and the above report format information; and a report output module, configured to input the above report generation prompt information into the above large language model to output a target report.
[0012] A third aspect of the present disclosure provides an electronic device, including: one or more processors; a memory, configured to store one or more programs, where when the above one or more programs are executed by the above one or more processors, the one or more processors are caused to execute the above report generation method.
[0013] The fourth aspect of the present disclosure further provides a computer-readable storage medium, on which executable instructions are stored. When the instructions are executed by a processor, the processor is caused to execute the above-mentioned report generation method.
[0014] The fifth aspect of the present disclosure further provides a computer program product, including a computer program which, when executed by a processor, implements the above-mentioned report generation method.
[0015] According to an embodiment of the present disclosure, report generation prompt information is determined based on a model prompt template, report period information, and report type information that match the report type information, so that the obtained report generation prompt information can guide the large model to output a target report with a format that meets the requirements and timeliness, improving the accuracy of report generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above-mentioned content and other objects, features, and advantages of the present disclosure will become clearer. In the drawings:
[0017] Figure 1 Schematically shows an application scenario diagram of a report generation method, apparatus, device, medium, and program product according to an embodiment of the present disclosure;
[0018] Figure 2 Schematically shows a flowchart of a report generation method according to an embodiment of the present disclosure;
[0019] Figure 3 Schematically shows a data flow diagram for determining report generation prompt information according to an embodiment of the present disclosure
[0020] Figure 4 Schematically shows a structural schematic diagram of a report generation system according to a specific embodiment of the present disclosure;
[0021] Figure 5 Schematically shows a flowchart of a report generation method according to a specific embodiment of the present disclosure;
[0022] Figure 6 Schematically shows a structural block diagram of a report generation apparatus according to an embodiment of the present disclosure; and
[0023] Figure 7 Schematically shows a block diagram of an electronic device suitable for implementing the report generation method according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present disclosure.
[0025] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0026] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0027] In the case of using expressions such as "at least one of A, B, and C, etc.", generally, it should be interpreted according to the meaning commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include, but is not limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0028] For reports with stable data sources, relatively fixed formats and contents, it takes a lot of time to write them manually, and the writing efficiency is low. To improve efficiency, a large language model is used to generate reports. However, due to the large randomness of the content generated by the large model, the content generated each time is not very controllable, and due to the insufficient timeliness of the reference content, the generated content is not accurate enough to meet the requirements of format accuracy and content timeliness. Therefore, in this application, data with timeliness is added to the report generation prompt information, and the format requirements are increased to guide the large language model to output a report with accurate format and in line with timeliness.
[0029] Embodiments of the present disclosure provide a report generation method. In response to receiving a report generation instruction issued by a user's terminal device, based on the report generation instruction, determine the report type information, report period information, and report format information of the report to be generated; based on the report type information, determine a model prompt template that matches the report type information; based on the model prompt template, report period information, and report format information, determine report generation prompt information; and input the report generation prompt information into a large language model to output a target report.
[0030] Figure 1 Schematically shows an application scenario diagram of the report generation method according to an embodiment of the present disclosure.
[0031] As Figure 1 shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, and a third terminal device 103. The network 104 is a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0032] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0033] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0034] The server 105 may be a server that provides various services, such as a background management server that supports the websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (for example only). The background management server may analyze and process data such as received user requests, etc., and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0035] It should be noted that the report generation method provided by the embodiments of the present disclosure can generally be executed by the server 105. Correspondingly, the report generation device provided by the embodiments of the present disclosure can generally be set in the server 105. The report generation method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Correspondingly, the report generation device provided by the embodiments of the present disclosure can also be set in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.
[0036] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in
[0037] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 1 Based on the Figures 2 to 5 scenario described below, the report generation method of the public embodiments will be described in detail through
[0038] Figure 2 FIG. schematically shows a flowchart of the report generation method according to an embodiment of the present disclosure.
[0039] As Figure 2 shown, the report generation of this embodiment includes operation S210 to operation S240.
[0040] In operation S210, in response to receiving a report generation instruction sent by a user's terminal device, based on the report generation instruction, determine the report type information, report period information, and report format information of the report to be generated.
[0041] According to an embodiment of the present disclosure, the report period information can represent the period for which the report to be generated is targeted. The user can report type information can represent the report type of the report to be generated. The report format information can represent the format requirements for the report to be generated.
[0042] According to an embodiment of the present disclosure, the user can perform an interactive operation with the terminal, input the report type information, report period information, and report format information in the terminal. The terminal generates a report generation instruction based on the report type information, report period information, and report format information.
[0043] According to an embodiment of the present disclosure, selection boxes for selecting report type information, report period information, and report format information can be displayed in the terminal, and the user selects the report type information, report period information, and report format information in the selection boxes. At this time, when the report generation instruction already contains clear report type information, report period information, and report format information, the report type information, report period information, and report format information of the report to be generated can be directly determined from the report generation instruction.
[0044] According to another embodiment of the present disclosure, an input box can also be displayed in the terminal, and the user inputs report generation requirements in the input box. The terminal directly generates a report generation instruction based on the report generation requirements. At this time, the report generation instruction may not contain clear report type information and report format information, and the report type and report format with the highest similarity to the report generation instruction can be determined by screening the existing report types and report formats in the database based on the report generation instruction as the report type information and report format information.
[0045] In operation S220, based on the report type information, a model prompt template matching the report type information is determined.
[0046] According to an embodiment of the present disclosure, multiple model prompt templates can be stored in the database, and different report types correspond to different model prompt templates. Therefore, the model prompt template matching the report type information can be obtained from the database based on the report type information.
[0047] According to an embodiment of the present disclosure, the model prompt template includes a template for instructing a large language model (LLM) to perform an expected task. The template content of the model prompt template can include the prompt information required to drive the large language model to generate a report.
[0048] In operation S230, based on the model prompt template, report period information, and report format information, report generation prompt information is determined.
[0049] According to an embodiment of the present disclosure, the report generation prompt information can be obtained by adding the report format information and data matching the report period information to the model prompt template, or by adding the report period information and report format information to the model prompt template.
[0050] According to an embodiment of the present disclosure, since the report generation prompt information is generated based on the model prompt template, report period information, and report format information, the report generation prompt information can be used to guide the large language model to output a report that conforms to the report period information and report format information.
[0051] In operation S240, input the report generation prompt information into the large language model to output the target report.
[0052] According to an embodiment of the present disclosure, the large language model can be pre-trained for report generation.
[0053] According to an embodiment of the present disclosure, the target report can be a report with stable format and data source and high timeliness requirements. Specifically, the target report can be a financial research report, such as daily reports, weekly reports, investment reports, etc.
[0054] According to an embodiment of the present disclosure, determine the report generation prompt information based on the model prompt template, report period information, and report type information that match the report type information, so that the obtained report generation prompt information can guide the large model to output a target report with a compliant format and timeliness, improving the accuracy of report generation.
[0055] According to an embodiment of the present disclosure, the report generation method provided by the present application can be used to generate financial research reports. Specifically, the report type information can be an investment research report, the report period information can be the date targeted by the investment research report, and the report format information can be the market short-term capital interest rate prediction format. At this time, the model prompt template that matches the report type information can be "The weighted averages of the Shanghai Stock Exchange pledged treasury bond repurchase rates GC001, GC007, and GC014 on the same day are the average values of GC001, GC007, and GC014 on the same day, respectively, compared with the previous day, respectively [[GC001 index > 0.5: up; GC001 index < -0.5: down; GC001 index default: flat]], [[GC007 index > 0.5: up; GC007 index < -0.5: down; GC007 index default: flat]], [[GC014 index > 0.5: up; GC014 index < -0.5: down; GC014 index default: flat]]".
[0056] When manually writing a financial research report, the writer needs to obtain relevant data from external data sources such as public websites, information providers, relevant research institutions, and internal research departments. Since the process of collecting data takes a lot of time, data can be automatically obtained from external data sources through robotic process automation and stored in an internal database.
[0057] According to an embodiment of the present disclosure, determine the report generation prompt information based on the model prompt template, report period information, and report format information: query the target report data that matches the model prompt template and report period information in the database; and determine the report generation prompt information based on the target report data, model prompt template, and report format information.
[0058] According to embodiments of the present disclosure, reports such as morning reports and daily reports have strong timeliness. However, when the large language model generates randomly, the reference data and materials may have poor timeliness, resulting in poor timeliness of the output report and inability to meet the timeliness requirements. Therefore, by querying the target report data matching the report period information in the database, the queried target report data can have timeliness, and then the large language model can be guided to output content with timeliness. For example, when the user needs to generate a report for the date of Y year, M month, and D day, query the data related to Y year, M month, and D day in the database.
[0059] According to embodiments of the present disclosure, since the model prompt template may only require partial data matching the report period information, directly querying the database based on the report period information will obtain a large amount of redundant data, wasting computer resources. Therefore, when querying the database, data matching the model prompt template can be directly queried to improve efficiency.
[0060] According to embodiments of the present disclosure, since the target report data matches the report period information, the report generation prompt information obtained based on the target report data contains timely data. Thus, the large language model can directly obtain timely data from the report generation prompt information and then obtain the target report meeting the timeliness requirements.
[0061] According to embodiments of the present disclosure, when querying the target report data matching the model prompt template and the report period information in the database, the database can be queried based on the respective identifiers of the model prompt template and the report period information, or a query statement can be pre-configured for the model prompt template, and the database can be queried using the query statement and the identifier of the report period information.
[0062] According to embodiments of the present disclosure, when determining the report generation prompt information based on the target report data, the model prompt template, and the report format information, it can be added to the model prompt template according to the respective identifiers of the target report data and the report format information, or after adding the target report data to the model prompt template according to the identifier of the target report data, it can be concatenated with the report format information.
[0063] According to embodiments of the present disclosure, by querying the target report data matching the model prompt template and the report period information in the database and obtaining the report generation prompt information based on the target report data, the obtained report generation prompt information includes the report format information and timely target report data, improving the accuracy and timeliness of the report generated by the large language model.
[0064] According to an embodiment of the present disclosure, querying target report data that matches a model prompt template and report period information from a database includes: obtaining an initial query statement that matches the model prompt template; adding the report period information to the initial query statement to obtain a target query statement; and querying the database using the target query statement to obtain the target report data.
[0065] According to an embodiment of the present disclosure, since the data required to fill the model prompt template is relatively stable, an initial query statement can be designed based on the identifier of the data required to fill the model prompt template and stored in the database. Specifically, the identifier of the model prompt template can be used to query the database for an initial query statement that matches the model prompt template.
[0066] According to an embodiment of the present disclosure, since the initial query statement does not include a time limit and cannot query the required report period information, the report period information can be added to the initial query statement to obtain a target query statement, so that the target query statement can query timely target report data in the database. Specifically, the identifier of the report period information can be used in the initial query statement to reserve a place for the report period information, and after determining the report period information, the report period information can be added to the initial query statement through the identifier to obtain the target query statement.
[0067] According to an embodiment of the present disclosure, the report period information can be defined as a global variable, and then data can be shared between program modules, thereby reducing data transfer logic, simplifying the code structure, and improving performance. In addition, other data that needs to be shared among different program modules can also be defined as global variables, and there are no restrictions on this.
[0068] According to an embodiment of the present disclosure, in order to protect the global variable from being modified arbitrarily, access modifiers such as extern, static, and public static final can be used to control the access rights of the global variable.
[0069] According to an embodiment of the present disclosure, when defining a global variable, it is necessary to ensure that the global variable uses an appropriate data type and initial value, and it is necessary to ensure that the global variable is correctly initialized before use to avoid undefined behavior.
[0070] According to an embodiment of the present disclosure, the global variable can also be encapsulated, and a secure and controllable interface can be provided for the module obtained after encapsulation to hide the implementation details of the program.
[0071] According to an embodiment of the present disclosure, a target query statement is obtained based on the report period information, so that the target report data obtained by querying the database using the target query statement is timely.
[0072] According to an embodiment of the present disclosure, determining report generation prompt information based on target report data, a model prompt template, and report format information includes: adding the target report data to the model prompt template to obtain model prompt information; and generating report generation prompt information according to the model prompt information and the report format information.
[0073] According to an embodiment of the present disclosure, the identifier of the target report data can be used to add the target report data to the model prompt template. Specifically, the identifier of the target report data can be used in the model prompt template to reserve a place for the target report data. After the target report data is retrieved, the target report data is added to the model prompt template through the identifier to obtain model prompt information.
[0074] According to an embodiment of the present disclosure, since the report format information is relatively independent, the model prompt information and the report format information can be directly concatenated by character concatenation, which can save computing resources compared with the method of adding by identifier.
[0075] According to an embodiment of the present disclosure, on the basis of the model prompt information including the target report data, the report generation prompt information is concatenated to obtain the report generation prompt information, so that the obtained report generation prompt information can effectively guide the large language model to output a report with a relatively fixed format and timeliness.
[0076] In the case where the report type information is an investment report, the report generation prompt information can be "The weighted average of the Shanghai Stock Exchange pledged treasury bond repurchase rates GC001, GC007, and GC014 on the same day is 0.3, 0.4, and 0.5 respectively, up 0.1, down 0.05, and unchanged compared with the previous day. Output according to the market short-term capital interest rate prediction format, and do not output other content."
[0077] Figure 3 Schematically shows a data flow diagram for determining report generation prompt information according to an embodiment of the present disclosure.
[0078] As Figure 3 shown, based on the report generation instruction 310, the report type information 320, the report period information 330, and the report format information 340 are determined. Based on the report type information 320, a model prompt template 350 matching the report type information 320 is obtained.
[0079] According to an embodiment of the present disclosure, the model prompt template 350 is filled based on the report period information 330 to obtain model prompt information 360. Specifically, the target data in the database is queried based on the report period information 330 and the model prompt template 350, and the target data is added to the model prompt template 350 to obtain model prompt information 360.
[0080] According to an embodiment of the present disclosure, based on the model prompt information 360 and the report format information 340, the report generation prompt information 370 is obtained. Specifically, the model prompt information 360 and the report format information 340 can be concatenated to obtain the report generation prompt information 370.
[0081] According to an embodiment of the present disclosure, the target report data is added to the model prompt template to obtain the model prompt information, including: inputting the target period data and the baseline period data into the index determination function to output the target index data; inputting the target index data into the conclusion generation function to output the target conclusion information; and adding the target conclusion information to the model prompt template to obtain the model prompt information.
[0082] According to an embodiment of the present disclosure, the model prompt template includes an index determination function and a conclusion generation function, and the target report data includes the target period data and the baseline period data.
[0083] According to an embodiment of the present disclosure, the index determination function can perform index calculation based on the target period data and the baseline period data to obtain the target index data.
[0084] According to an embodiment of the present disclosure, the baseline period data is the historical data of the target period data, and the target index data is used to represent the change amount of the target period data relative to the baseline period data. For example, when the target period data is 0.4 and the baseline period data is 0.1, the target index data can be 0.3. When the target period data is 0.2 and the baseline period data is 0.3, the target index data can be -0.1.
[0085] According to an embodiment of the present disclosure, the conclusion generation function can obtain the target conclusion information based on the target index data. For example, when the target index data is 0.3, the target conclusion information can be an increase of 0.3; when the target index data is -0.1, the target conclusion information can be a decrease of 0.1.
[0086] According to an embodiment of the present disclosure, when adding the target conclusion information to the model prompt template, the target conclusion information can be added to the model prompt template according to the identifier of the target conclusion information.
[0087] According to an embodiment of the present disclosure, since a large amount of time is consumed for data analysis and conclusion giving when manually writing a report, data analysis can be performed in the model prompt information and a brief conclusion can be given to guide the large language model to output a report containing conclusive content, improving the efficiency and the accuracy of the report content at the same time.
[0088] According to an embodiment of the present disclosure, a brief conclusion is given in the model prompt information through the index determination function and the conclusion generation function, improving the efficiency and accuracy of the generated report.
[0089] According to an embodiment of the present disclosure, inputting target indicator data into a conclusion generation function to output target conclusion information, including: determining a target conclusion determination statement that matches the target indicator data from multiple conclusion determination statements; and determining the conclusion information in the target conclusion determination statement as the target conclusion information.
[0090] According to an embodiment of the present disclosure, the conclusion generation function includes multiple conclusion determination statements, and the conclusion determination statements include conclusion information.
[0091] According to an embodiment of the present disclosure, when determining a target conclusion determination statement from multiple conclusion determination statements, it can be done by means of rule matching. Specifically, according to the value of the target indicator data, a target conclusion determination statement that matches the value of the target indicator data can be determined.
[0092] According to an embodiment of the present disclosure, the conclusion information can be a brief conclusion obtained by analyzing the target indicator data. For example, if the multiple conclusion determination statements are increase, flat, and decrease respectively, then when the value of the target indicator data is -0.1, the conclusion information in the target conclusion determination statement that matches the target indicator data is decrease.
[0093] According to an embodiment of the present disclosure, by setting the conclusion generation function in a model prompt template, brief but timely target conclusion information can be obtained based on the target report data, thereby guiding the large language model to output complex conclusion content, improving efficiency and at the same time improving the timeliness of the report generated by the large language model.
[0094] According to an embodiment of the present disclosure, a statistical chart can also be generated based on the target report data and added to the target report.
[0095] Figure 4 Schematically shows a structural diagram of a report generation system according to a specific embodiment of the present disclosure.
[0096] As Figure 4 shown, the report generation system includes a data extraction module 410, a data storage module 420, a data usage module 430, and a workbench 440. The data extraction module 410 includes an interface call function and a robotic process automation function. The data storage module 420 includes a wide table storage function. The data usage module 430 includes a data maintenance workbench, and the data maintenance workbench includes a data table construction function and a permission management function. The workbench 440 includes an intelligent report generation function.
[0097] According to an embodiment of the present disclosure, the interface call function and the robotic process automation function in the data fetching module 410 can be used to obtain data from an external data source and store the obtained data in the data storage module 420. The wide table storage function in the data storage module 420 can store data using a wide table, facilitating the data fetching module 430 to obtain data. The data maintenance workbench in the data using module 430 is used to maintain the data required for the workbench. Specifically, the data table construction function can obtain data from the data storage module 420 and construct a data table, and the permission management function can be used to manage the data access permissions of users. Users can use the intelligent report generation function through the workbench 440. Among them, the intelligent report generation function can include a basic function and a component management function. The basic function can be used to implement functions related to report generation, and the component management function can be used to manage the components required for report generation.
[0098] According to an embodiment of the present disclosure, the basic function can include a report generation function, a template editing function, a component insertion function, a permission management function, etc. Specifically, the report generation function can be used to generate a report, the template editing function can be used to edit a model prompt template, the component insertion function can be used to add new components, and the permission management can be used to set user permissions.
[0099] According to an embodiment of the present disclosure, the component management function can include a data table management function, a template management function, a visualization management function, a model management function, etc.
[0100] According to an embodiment of the present disclosure, the data table management function can be used to manage the data tables in the data maintenance workbench, such as calling, processing, and outputting the data tables in the data maintenance workbench. The template management function can be used to manage the model prompt templates, such as adding, querying, deleting, and modifying the model prompt templates. The visualization management function can be used to manage the visualization charts obtained from the data in the data maintenance workbench, such as generating, calling, and outputting the visualization charts. The model management function can be used to manage large language models, such as adding large language models that match different report types.
[0101] According to an embodiment of the present disclosure, before inputting the report generation prompt information into the large language model, it further includes: The method further includes: displaying the report generation prompt information on a terminal corresponding to the user; in response to a modification operation of the user on the report generation prompt information, obtaining the modified report generation prompt information modified by the user from the terminal; and using the modified report generation prompt information to replace the report generation prompt information.
[0102] According to an embodiment of the present disclosure, the obtained report generation prompt information can also be displayed on the terminal corresponding to the user. In the case where the user confirms to use the report generation prompt information, subsequent operations are performed using the report generation prompt information; in the case where the user modifies the report generation prompt information, the modified report generation prompt information is used to replace the report generation prompt information for subsequent operations.
[0103] Figure 5 Schematically shows a flowchart of a report generation method according to a specific embodiment of the present disclosure.
[0104] As Figure 5 shown, the report generation method includes operations S510 to S570.
[0105] In operation S510, a report generation instruction is received.
[0106] According to an embodiment of the present disclosure, the report generation instruction is sent by the user's terminal. Specifically, the user can click the generation button, and the terminal sends a report generation instruction to the server after the user clicks the generation button.
[0107] In operation S520, report generation prompt information is output.
[0108] According to an embodiment of the present disclosure, the server generates report generation prompt information according to the report generation instruction and displays the report generation prompt information on the user's terminal.
[0109] In operation S530, it is determined whether the user modifies the report generation prompt information. If it is determined that the user modifies the report generation prompt information, operation S540 is executed; otherwise, operation S550 is executed.
[0110] In operation S540, the modified report generation prompt information is obtained.
[0111] In operation S550, the target report is output. If it is determined that the user modifies the report generation prompt, the target report is generated based on the modified report generation prompt information; otherwise, the target report is generated based on the report generation prompt information. After generating the target report, the target report is displayed on the user terminal.
[0112] In operation S560, it is determined whether the user clicks to regenerate. If it is determined that the user clicks to regenerate, operation S550 is executed; otherwise, operation S570 is executed.
[0113] In operation S570, the target report is submitted.
[0114] According to an embodiment of the present disclosure, the user can click the submit button on the terminal, and the server submits the target report.
[0115] According to an embodiment of the present disclosure, by allowing a user to modify the report generation prompt information and using the modified report generation prompt information to generate a report, the user experience can be further improved, and a report that meets the user's needs can be obtained.
[0116] According to an embodiment of the present disclosure, a reinforcement learning with human feedback (RLHF) fine-tuning method can be adopted to optimize the large language model. Before applying the large language model to generate a report, the large language model can be pre-trained. Specifically, the model prompt template, report period information, report type information, report format information, etc. can be converted into feature vectors and stored in the vector data; the encoder-decoder (transformer) architecture is used to weight the feature vectors to obtain weighted feature vectors, so that the large language model can better understand the input and output content.
[0117] According to an embodiment of the present disclosure, after applying the large language model to generate a report, the large language model can also be continuously optimized. Specifically, after generating the target report, if the user directly uses the target report, the report generation prompt information and the target report are used as positive samples to optimize the large language model. If the user chooses to regenerate the report, the report generation prompt information and the target report are used as negative samples to optimize the large language model. If the user modifies the report generation prompt information and directly uses the target report, the modified report generation prompt information and the target report are used as positive samples to optimize the large language model. If the user modifies the report generation prompt information and chooses to regenerate the report, the modified report generation prompt information and the target report are used as negative samples to optimize the large language model.
[0118] According to an embodiment of the present disclosure, when optimizing the large language model, the optimization process is as shown in the following formulas (1) to (4):
[0119]
[0120] Among them, is the expected return starting from time t, is the reward obtained at time t + k + 1, is the discount factor, which is used to adjust the current value of future rewards, is the optimal value function in state , is the optimal action value function of taking action in state , is the probability of taking action from state to transfer to state and obtaining reward , It is the reward adjusted according to user feedback. It is the user's evaluation of the action .
[0121] Based on the above report generation method, the present disclosure also provides a report generation device. The following will be combined with Figure 6 to describe this device in detail.
[0122] Figure 6 Schematically shows a structural block diagram of a report generation device according to an embodiment of the present disclosure.
[0123] As Figure 6 shown, the report generation device 600 of this embodiment includes an information determination module 610, a template determination module 620, a prompt determination module 630, and a report output module 640.
[0124] The information determination module 610 is configured to, in response to receiving a report generation instruction issued by a user's terminal device, determine report type information, report period information, and report format information of the report to be generated based on the report generation instruction. In one embodiment, the information determination module 610 may be configured to perform the operation S210 described above, which will not be elaborated here.
[0125] The template determination module 620 is configured to determine a model prompt template that matches the report type information based on the report type information. In one embodiment, the template determination module 620 may be configured to perform the operation S220 described above, which will not be elaborated here.
[0126] The prompt determination module 630 is configured to determine report generation prompt information based on the model prompt template, report period information, and report format information. In one embodiment, the prompt determination module 630 may be configured to perform the operation S230 described above, which will not be elaborated here.
[0127] The report output module 640 is configured to input the report generation prompt information into a large language model and output a target report. In one embodiment, the report output module 640 may be configured to perform the operation S240 described above, which will not be elaborated here.
[0128] According to an embodiment of the present disclosure, the prompt determination module 630 includes a data query sub-module and a prompt determination sub-module.
[0129] The data query sub-module is configured to query target report data that matches the model prompt template and report period information in a database.
[0130] The prompt determination sub-module is configured to determine report generation prompt information based on the target report data, model prompt template, and report format information.
[0131] According to an embodiment of the present disclosure, the data query sub-module includes a statement acquisition unit, a time period addition unit, and a data query unit.
[0132] The statement acquisition unit is configured to acquire an initial query statement that matches the model prompt template.
[0133] The time period addition unit is configured to add the report time period information to the initial query statement to obtain a target query statement.
[0134] The data query unit is configured to query the database using the target query statement to obtain target report data.
[0135] According to an embodiment of the present disclosure, the prompt determination sub-module includes a data addition unit and a prompt generation unit.
[0136] The data addition unit is configured to add the target report data to the model prompt template to obtain model prompt information.
[0137] The prompt generation unit is configured to generate report generation prompt information according to the model prompt information and the report format information.
[0138] According to an embodiment of the present disclosure, the model prompt template includes an index determination function and a conclusion generation function, and the target report data includes target time period data and reference time period data.
[0139] According to an embodiment of the present disclosure, the data addition unit includes an index output sub-unit, a conclusion generation sub-unit, and a conclusion addition sub-unit.
[0140] The index output sub-unit is configured to input the target time period data and the reference time period data into the index determination function and output target index data, where the reference time period data is historical data of the target time period data, and the target index data is used to characterize the change amount of the target time period data relative to the reference time period data.
[0141] The conclusion generation sub-unit is configured to input the target index data into the conclusion generation function and output target conclusion information.
[0142] The conclusion addition sub-unit is configured to add the target conclusion information to the model prompt template to obtain model prompt information.
[0143] According to an embodiment of the present disclosure, the conclusion generation function includes a plurality of conclusion determination statements, and the conclusion determination statements include conclusion information. The conclusion generation sub-unit is configured to determine a target conclusion determination statement that matches the target index data from the plurality of conclusion determination statements; and determine the conclusion information in the target conclusion determination statement as the target conclusion information.
[0144] According to an embodiment of the present disclosure, the report generation device 600 further includes a prompt display module, a prompt acquisition module, and a prompt replacement module.
[0145] A prompt display module, configured to display the report generation prompt information on a terminal corresponding to a user.
[0146] A prompt acquisition module, configured to, in response to a modification operation of a user on the report generation prompt information, acquire the modified report generation prompt information modified by the user from the terminal.
[0147] A prompt replacement module, configured to replace the report generation prompt information with the modified report generation prompt information.
[0148] According to an embodiment of the present disclosure, any multiple modules among the information determination module 610, the template determination module 620, the prompt determination module 630, and the report output module 640 may be combined and implemented in one module, or any one of them may be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules may be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the information determination module 610, the template determination module 620, the prompt determination module 630, and the report output module 640 may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner that can integrate or package circuits, etc., implemented by hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in any suitable combination of several of them. Alternatively, at least one of the information determination module 610, the template determination module 620, the prompt determination module 630, and the report output module 640 may be at least partially implemented as a computer program module, and when the computer program module runs, it can execute the corresponding functions.
[0149] Figure 7 A block diagram of an electronic device suitable for implementing the report generation method according to an embodiment of the present disclosure is schematically shown.
[0150] As Figure 7As shown, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage section 708 into a random access memory (RAM) 703. The processor 701 can include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application-specific integrated circuit (ASIC)), etc. The processor 701 can also include on-board memory for caching purposes. The processor 701 can include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0151] In the RAM 703, various programs and data required for the operation of the electronic device 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. The processor 701 performs various operations of the method flow according to an embodiment of the present disclosure by executing the program in the ROM 702 and / or the RAM 703. It should be noted that the program can also be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 can also perform various operations of the method flow according to an embodiment of the present disclosure by executing the program stored in one or more memories.
[0152] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, and the input / output (I / O) interface 705 is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the I / O interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read from it can be installed into the storage portion 708 as needed.
[0153] The present disclosure also provides a computer-readable storage medium, which may be included in the device / device / system described in the above embodiments; or may exist separately and not be assembled into the device / device / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to an embodiment of the present disclosure is implemented.
[0154] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include one or more memories other than the ROM 702 and / or RAM 703 and / or ROM 702 and RAM 703 described above.
[0155] An embodiment of the present disclosure further includes a computer program product, which includes a computer program that contains program code for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program code is used to enable the computer system to implement the item recommendation method provided by the embodiment of the present disclosure.
[0156] When the computer program is executed by the processor 701, it executes the above functions defined in the system / apparatus of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, apparatuses, modules, units, etc. may be implemented by computer program modules.
[0157] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0158] In such an embodiment, the computer program may be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, it executes the above functions defined in the system of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. may be implemented by computer program modules.
[0159] According to embodiments of the present disclosure, program code for executing the computer programs provided by the embodiments of the present disclosure may be written in any combination of one or more programming languages. Specifically, these computing programs may be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The programming languages include, but are not limited to, programming languages such as Java, C++, Python, the "C" language, or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0160] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, may be implemented by a dedicated hardware-based system for performing the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0161] Those skilled in the art will appreciate that the features recited in the various embodiments and / or claims of the present disclosure may be combined or combined in various ways, even if such combinations or combinations are not explicitly recited in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recited in the various embodiments and / or claims of the present disclosure may be combined and combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0162] The embodiments of the present disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments have been described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and these substitutions and modifications should fall within the scope of the present disclosure.
Claims
1. A report generation method, characterized in that: The method comprises: In response to receiving a report generation instruction issued by a terminal device of a user, determining report type information, report period information and report format information of a report to be generated based on the report generation instruction; Based on the report type information, determining a model prompt template matching the report type information; Determining report generation prompt information based on the model prompt template, the report period information, and the report format information; and The report generation prompt information is input into the large language model, and a target report is output.
2. The method according to claim 1, characterized in that The step of determining report generation prompt information based on the model prompt template, the report period information, and the report format information: Searching a database for target report data that matches the model prompt template and the report period information; as well as Report generation prompt information is determined based on the target report data, the model prompt template and the report format information.
3. The method according to claim 2, characterized in that The querying of the target report data matching the model prompt template and the report period information from the database includes: Obtaining an initial query statement that matches the model prompt template; Adding the reporting period information to the initial query statement to obtain a target query statement; and The target query statement is used to query the database to obtain the target report data.
4. The method according to claim 2, characterized in that: The step of determining report generation prompt information based on the target report data, the model prompt template and the report format information includes: Adding the target report data to the model prompt template to obtain model prompt information; and Generate report generation prompt information according to the model prompt information and the report format information.
5. The method according to claim 4, characterized in that The model prompt template includes an indicator determination function and a conclusion generation function, the target report data includes target period data and reference period data, and the target report data is added to the model prompt template to obtain model prompt information, including: Inputting the target period data and the reference period data into the indicator determination function, and outputting the target indicator data, wherein the reference period data is the historical data of the target period data, and the target indicator data is used to characterize the change amount of the target period data relative to the reference period data; Inputting the target indicator data into the conclusion generation function and outputting target conclusion information; and The target conclusion information is added to the model prompt template to obtain the model prompt information.
6. The method according to claim 5, characterized in that The conclusion generation function includes a plurality of conclusion determination statements, and the conclusion determination statements include conclusion information. The target indicator data is input into the conclusion generation function, and the target conclusion information is output, including: Determining a target conclusion determination statement that matches the target indicator data from the plurality of conclusion determination statements; and The conclusion information in the target conclusion determination statement is determined to be the target conclusion information.
7. The method according to claim 1, characterized in that The method further comprises: Displaying the report generation prompt information on a terminal corresponding to the user; In response to a user's modification operation on the report generation prompt information, acquiring from the terminal the modified report generation prompt information after the user's modification operation; and The report generation prompt information is replaced by the modified report generation prompt information.
8. A report generating device, characterized in that: The device comprises: an information determination module, configured to, in response to receiving a report generation instruction issued by a user's terminal device, determine report type information, report period information, and report format information of a report to be generated based on the report generation instruction; A template determination module, used to determine a model prompt template matching the report type information based on the report type information; a prompt determination module, configured to determine report generation prompt information based on the model prompt template, the report period information and the report format information; and The report output module is used to input the report generation prompt information into the large language model and output the target report.
9. An electronic device, comprising: one or more processors; a storage device for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.