Question and answer data processing method and device, storage medium and electronic equipment
By preprocessing and data filtering of the resources of the large model system and inputting them into the large language model, the problems of stability and accuracy of the large model system are solved and the user experience is improved.
Patent Information
- Application Number
- CN202411496604.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-28
AI Technical Summary
The stability of the large model system is low, and the results obtained in scenarios requiring accurate data are not accurate, and the user experience is poor.
By preprocessing the resources of the target project, filtering data that matches the user's question information, and entering it into a preset large language model to generate answer resources.
It improves the stability of the large model system and obtains higher accuracy in precise data scenarios, significantly improving the user experience.
Smart Images

Figure CN119537525A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of traffic technology, and in particular to a question-and-answer data processing method and device, a storage medium and an electronic device. Background Art
[0002] The technology of large language models (abbreviated as large models) is experiencing rapid development. With the improvement of computing power and the increase of data availability, large models have been able to handle more and more complex tasks. The current large models have limited understanding and reasoning capabilities, and the agent development model commonly used in the industry cannot stably complete the interaction between applications and large models, making the overall stability of the information system unable to meet the requirements of the production environment, and prone to dead loops. In addition, the accuracy of the results obtained by large models in scenarios requiring accurate data is not high, and the user experience is poor. Summary of the invention
[0003] The embodiments of the present application provide a question-and-answer data processing method and device, a storage medium, and an electronic device to at least solve the technical problems in the related art that the stability of the large model system is low, the results obtained in scenarios requiring accurate data are not accurate, and the user experience is poor.
[0004] According to one aspect of an embodiment of the present application, a question and answer data processing method is provided, including: preprocessing resources corresponding to a target project to obtain preprocessed data; receiving question information input by a user for the target project, and screening matching data that matches the question information from the preprocessed data; obtaining target input information based on the question information, inputting the target input information and the matching data into a preset large language model, and obtaining answer resources generated by the preset large language model.
[0005] According to another aspect of an embodiment of the present application, a question and answer data processing device is also provided, including: a preprocessing unit, used to preprocess the resources corresponding to the target project to obtain preprocessed data; a screening unit, used to receive question information input by a user for the target project, and screen matching data that matches the question information from the preprocessed data; an acquisition unit, used to acquire target input information based on the question information, input the target input information and the matching data into a preset large language model, and acquire answer resources generated by the preset large language model.
[0006] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the question and answer data processing method through the computer program.
[0007] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned question and answer data processing method when running.
[0008] In an embodiment of the present application, a method is adopted in which resources corresponding to a target project are preprocessed to obtain preprocessed data; question information input by a user for the target project is received, and matching data matching the question information is screened from the preprocessed data; target input information is obtained based on the question information, and the target input information and the matching data are input into a preset large language model to obtain answer resources generated by the preset large language model; in the above method, matching data matching the question information is screened out in advance from the preprocessed data, and then the answer corresponding to the question raised by the user can be accurately obtained according to the matching data, which not only improves the stability of the large model system, but also meets the demand for obtaining high-precision results in accurate data scenarios, significantly improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0010] Figure 1 is a schematic diagram of an application environment of an optional question-answer data processing method according to an embodiment of the present application;
[0011] Figure 2 is a schematic diagram of an application environment of another optional question-and-answer data processing method according to an embodiment of the present application;
[0012] Figure 3 is a flowchart of an optional question-and-answer data processing method according to an embodiment of the present application;
[0013] Figure 4 This is a system interface display diagram of an optional question-and-answer data processing system according to an embodiment of the present application;
[0014] Figure 5 is another optional question and answer data processing system interface display diagram according to an embodiment of the present application;
[0015] Figure 6 is another optional question and answer data processing system interface display diagram according to an embodiment of the present application;
[0016] Figure 7 is an architectural diagram of another optional question-answer data processing system according to an embodiment of the present application;
[0017] Figure 8 is a flowchart of another optional question-and-answer data processing method according to an embodiment of the present application;
[0018] Fig. 9 is a flowchart of another optional question-and-answer data processing method according to an embodiment of the present application;
[0019] Fig.10 is a schematic structural diagram of an optional question-answer data processing device according to an embodiment of the present application;
[0020] Fig.11 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] According to one aspect of an embodiment of the present application, a method for processing question and answer data is provided. Optionally, as an optional implementation, the method for processing question and answer data can be applied to, but is not limited to, Figure 1In the application environment shown. The application environment includes: a terminal device 102 for human-computer interaction with a user, a network 104, and a server 106. A user 108 can perform human-computer interaction with the terminal device 102, and a question-and-answer data processing application client runs in the terminal device 102. The above-mentioned terminal device 102 includes a human-computer interaction screen 1022, a processor 1024, and a memory 1026. The human-computer interaction screen 1022 is used to display the question information input by the user and the answer resources generated by the system; the processor 1024 is used to obtain the resources corresponding to the target project. The memory 1026 is used to store the resources corresponding to the target project, as well as the question information input by the user and the answer resources generated by the system.
[0024] In addition, the server 106 includes a database 1062 and a processing engine 1064. The database 1062 is used to store resources corresponding to the target project, as well as question information input by the user and answer resources generated by the system. The processing engine 1064 is used to pre-process the resources corresponding to the target project to obtain pre-processed data; receive question information for the target project input by the user, and filter matching data matching the question information from the pre-processed data; obtain target input information based on the question information, input the target input information and the matching data into a preset large language model, and obtain answer resources generated by the preset large language model; and send the above answer resources to the client of the above terminal device 102.
[0025] In one or more embodiments, the question-and-answer data processing method of the present application can be applied to Figure 2 In the application environment shown. Figure 2 As shown, human-computer interaction can be performed between user 202 and user device 204. User device 204 includes memory 206 and processor 208. In this embodiment, user device 204 can refer to but not be limited to executing the operations executed by the above-mentioned terminal device 102 to display question information and corresponding answer resources.
[0026] Optionally, the terminal device 102 and the user device 204 include but are not limited to mobile phones, tablet computers, laptop computers, PCs, vehicle-mounted electronic devices, wearable devices and other terminals, and the network 104 may include but is not limited to wireless networks or wired networks. Among them, the wireless network includes: WIFI and other networks that realize wireless communication. The wired network may include but is not limited to: wide area network, metropolitan area network, local area network. The server 106 may include but is not limited to any hardware device that can perform computing. The server may be a single server, or a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0027] As an optional implementation, Figure 3 As shown, the embodiment of the present application provides a question-answer data processing method, comprising the following steps:
[0028] S302, pre-processing the resources corresponding to the target project to obtain pre-processed data.
[0029] Specifically, the execution subject in the embodiment of the present application can be a system including a large language model, and the above-mentioned target project can be any application or service. In the process of preprocessing the target project, the system first creates relevant corpus data (resources) for a project and defines the scope of corpus analysis for the project. According to different types of corpus, the system vectorizes the relevant content and stores it in the vector library to obtain preprocessed data, for example, it can include the following processing processes:
[0030] For document corpus, including different types of documents such as txt, doc, pdf, etc., this application uses Chinese word segmentation and Chinese vector model to vectorize the document content.
[0031] For database corpora, the system lists the tables in the database, and users can select the tables that need to be supported. The system vectorizes the table description and table field description.
[0032] For interface corpora, the system vectorizes the interface description and the field descriptions of the interface input and output parameters.
[0033] S304: receiving question information regarding the target project input by a user, and screening matching data matching the question information from the pre-processed data.
[0034] Specifically, after receiving the question information input by the user for the target project, the embodiment of the present application obtains the existing corpus corresponding to the target project according to the identifier, and vectorizes the user's question information to obtain the vector corresponding to the question information, because the above question information contains the identifier of the target project to be asked. The system combines the overview of the existing corpus with the user's question, performs vector space matching between the existing corpus and the user's question information, and fills the prompt word template with the overview of the corpus (matching data) that is closest to the matching result and the user's question information, and submits the prompt word to the large model for analysis.
[0035] S306, obtaining target input information based on the question information, inputting the target input information and the matching data into a preset large language model, and obtaining an answer resource generated by the preset large language model.
[0036] Specifically, in the embodiment of the present application, the above-mentioned answer resources include program codes, answer texts or charts, etc. Figure 4As shown, assuming that the above question information only involves text display, the big model obtains the text answer corresponding to the question information based on the matching data. When the question information involves chart display, the big model obtains the program code corresponding to the question information based on the matching data, and the system executes the generated program code to obtain the displayed chart information. The above program code can include the code corresponding to any programming language.
[0037] In an embodiment of the present application, a method is adopted in which resources corresponding to a target project are preprocessed to obtain preprocessed data; question information input by a user for the target project is received, and matching data matching the question information is screened from the preprocessed data; target input information is obtained based on the question information, and the target input information and the matching data are input into a preset large language model to obtain answer resources generated by the preset large language model; in the above method, matching data matching the question information is screened out in advance from the preprocessed data, and then the answer corresponding to the question raised by the user can be accurately obtained according to the matching data, which not only improves the stability of the large model system, but also meets the demand for obtaining high-precision results in accurate data scenarios, significantly improving the user experience.
[0038] In one or more embodiments, the acquiring target input information based on the question information, inputting the target input information and the matching data into a preset large language model, and acquiring an answer resource generated by the preset large language model includes:
[0039] Creating target input information according to a preset prompt word template and the question information;
[0040] The target input information and the matching data are input into a preset large language model, and an answer resource corresponding to the target input information and the matching data and generated by the large language model is obtained.
[0041] Specifically, in one embodiment, the preset prompt word template may include the following content, for example:
[0042] code_template=[
[0043] ('system',
[0044] """Suppose you are a programmer, and based on the user's question, you perform the following actions:
[0045] 1. Analyze the original data that the user needs to query or the instructions that need to be executed;
[0046] 2. Write XX function to obtain the original data required by the user, or execute relevant instructions, and organize the returned results in the format of js on;
[0047] XX function must be defined as "def_exec()->str"
[0048] In your XX function, you can directly call the following predefined functions
[0049] SQL execution function: def_sql_executor_func(data_source_id: int, sql: str)->list[dict] - used to execute SQL statements in the corresponding data source and return the execution results in list[dict] format Interface call function: def_http_executor_func(interface_id: int, json_param: str)->s tr - pass in parameters in json format, call the interface of the corresponding ID, and return the execution result string of the interface. The following is the database and interface information that may be used by the calling tool:
[0050] Database information:
[0051] {db_info}
[0052] Interface information:
[0053] {interface_info}
[0054] Notice:
[0055] 1. Only one section of XX program code can be output, placed between ```XX and ```
[0056] 2. Try to replace the field names with Chinese explanations with Chinese names according to the explanations of the fields.
[0057] 3. The complete XX function must be output without any omissions
[0058] 4. The return value of the XX program code is the data required by the user or the expected result
[0059] 5. The code must be based on known information and cannot be made up by yourself
[0060] 6. As a function running on the server side, it does not respond to the user's drawing needs, but only returns the underlying data required to support the drawing
[0061] 7. The current time is: {now}
[0062] 8. Do not try to call the interface directly, use the _http_executor_func function to call the interface
[0063] """),
[0064] ('human','{user_input}') ]
[0066] According to the above prompt word template and the question information, the target input information is created, and the target input information and the matching data are input into the preset large language model, such as Figure 6 As shown, the target code generated by the preset large language model can be obtained.
[0067] In one or more embodiments, the answer resource includes text information and a service call interface, and obtaining the answer resource generated by the preset large language model includes at least one of the following:
[0068] Determining that the target input information corresponds to a document output type, and obtaining text information generated by the large language model according to the target input information and the matching data;
[0069] Specifically, if the question information only involves text display, the big model obtains the text answer corresponding to the question information according to the matching data. The target input information may include, for example, user question information, database information corresponding to the target project, interface information, preset prompt word template, and context information. Figure 4 As shown, the question information includes: the work order number of the event with the highest rescue cost in 2024. The large model obtains the text answer corresponding to the question information based on the matching data, including: the work order number of the event with the highest rescue cost in 2024 is 1770317468699463682. The details are as follows: Work order number: 1770317468699463682.
[0070] Determine that the target input information corresponds to a code output type, obtain the target code generated by the preset large language model, and generate the service call interface corresponding to the question information based on the target code.
[0071] When the target input information corresponds to the code output type, such as Figure 6 As shown, the target input information includes the question information: How many traffic incidents have occurred this year that have applied for rescue? The information is displayed in a bar chart according to the units to which it belongs, and the target code generated by the preset large language model is obtained for display. Based on the target code, the service call interface corresponding to the question information can be published. When there is a subsequent question information such as: How many traffic incidents have occurred this year that have applied for rescue? The service call interface can be directly called to obtain the following information: Figure 4 Results are shown in the graph.
[0072] In one or more embodiments, the generating the service calling interface corresponding to the question information based on the target code includes:
[0073] Displaying the target code, and debugging the target code to obtain a debug code;
[0074] Based on the debugging code, the service calling interface corresponding to the question information is generated.
[0075] Specifically, in the embodiment of the present application, the service call interface may be an HTTP interface, and the user clicks to view the log through the system's dialogue page, such as Figure 6 As shown in the figure, the client of the system displays the code generated during the interaction. The user clicks the release interface to enter the code debugging page. The user can manually modify the code through the debugging page; in addition, Figure 5 As shown, you can also use natural language instructions to let the big model assist in modifying the code; for example, adjust the code to improve the window input: modify this function to use the year as a parameter. If the year is None, get the year of the current time.
[0076] The system runs the generated code according to the test run instructions entered by the user through the debugging page. After the test is correct, the HTTP interface can be directly generated for third-party calls.
[0077] In one or more embodiments, the question and answer data processing method further includes:
[0078] Executing the target code, and inputting the execution result and the question information into the preset large language model for packaging;
[0079] Display the encapsulated answer resources.
[0080] Specifically, in the embodiments of the present application, Figure 4 As shown, when the question information involves chart display, the big model obtains the program code corresponding to the question information based on the matching data. After the system executes the generated program code, it can obtain the displayed chart information (answer resource). The above program code can include the code corresponding to any programming language.
[0081] In the above packaging process, the following prompt word template can be used to package the execution result and the question information:
[0082]
[0083]
[0084] In one or more embodiments, the resource includes at least one of a document resource, database information, and a service interface, and the resource corresponding to the target project is preprocessed to obtain preprocessed data, including at least one of the following:
[0085] Using Chinese word segmentation and Chinese vector models, convert each document in the document resource into a text vector to obtain preprocessed data;
[0086] Acquire first text information corresponding to the table and field in the database information, convert the first text information into a text vector, and obtain preprocessed data;
[0087] The second text information corresponding to the service interface information in the service interface is obtained, and the second text information is converted into a text vector to obtain preprocessed data.
[0088] Specifically, for document-type corpora, including different types of documents such as txt, doc, pdf, etc., this application uses Chinese word segmentation and Chinese vector model to vectorize the document content to obtain the text vector corresponding to the document-type corpus.
[0089] For database corpora, the system lists the tables in the database, and users can select the tables that need to be supported. The system vectorizes the table description and the table field description to obtain the vector corresponding to the database information.
[0090] For interface corpora, the system vectorizes the description of the interface and the field descriptions of the interface input and output parameters to obtain the vector corresponding to the service interface.
[0091] In one or more embodiments, the filtering matching data matching the question information from the preprocessed data includes: acquiring a first number of tables corresponding to the preprocessed data and a second number of service interfaces corresponding to the preprocessed data;
[0092] According to the sum of the first number and the second number, matching data matching the question information is acquired.
[0093] Specifically, in one example, acquiring matching data matching the question information according to the sum of the first quantity and the second quantity includes:
[0094] When the sum is less than a first preset threshold, determining the preprocessed data as the matching data;
[0095] When the sum is greater than or equal to the first preset threshold and less than a second preset threshold, inputting the description of the table and the description of the service interface into the preset large language model to obtain first data output by the preset large language model, and determining the first data as the matching data;
[0096] When the sum value is greater than or equal to the second preset threshold, the question information and the preprocessed data are semantically matched, and the preprocessed data of the second preset threshold and the question information that are matched are sent to the preset large language model to obtain second data output by the preset large language model, and the second data is determined as the matching data.
[0097] In the embodiment of the present application, taking the first preset threshold as 5 and the second preset threshold as 15 as an example; when the total number of tables and service interfaces T<=5, no filtering is performed, and the pre-processed data is directly determined as the matching data.
[0098] When 5<=T<=15, the resource description (table description or interface description) and user question information are directly sent to the large language model, and the preprocessed data is filtered through the large language model.
[0099] For example, matching data is obtained by filtering preprocessed data using the following prompt word template.
[0100] """
[0101] You are a backend programmer and you know the following interface information / database table information:
[0102] ```json
[0103] {data}
[0104] ```
[0105] Among them, interfaces is a list of interfaces, datasources is a list of database tables, and each element of the list has three attributes: id (interface ID or data source ID), name (interface name or data table name), desc (interface description or data table description)
[0106] Please retain the interface / database table elements that can answer the user's questions based on the user's questions, and return them in the same json format
[0107] """),
[0108] ('human', '{user_input}') ]
[0110] When T>15, the user's question information and resources are matched with semantic vectors, and the resource descriptions and user questions of the top 15 matching results are sent to the big model, and the preprocessed data is filtered through the big model to obtain matching data.
[0111] Based on the above embodiments, in an application embodiment, the present application also provides a question-answering data processing system, such as Figure 7 As shown, the system includes a presentation layer, an application layer, a coordination layer and basic services, as well as a unified authority platform and a naming and configuration service (NACOS), wherein the presentation layer includes front-end pages and back-end pages, the application layer includes service modules, logic modules and background modules. The coordination layer includes a model module, and the basic service layer includes a basic large model, a relational database and a vector database.
[0112] In an application embodiment, if Figure 8 As shown, the above-mentioned question and answer data processing method includes:
[0113] 1. Input the question information entered by the user into the service module;
[0114] 2. The service module sends the question information, project, and user role to the logic module;
[0115] 3. The logic module sends the preset domain to which the query question belongs to the model module. The model module mainly provides functions such as information question and answer / data query / function query / service access, etc.
[0116] 4. The model module returns the domain to which the user's question information belongs to the logic module;
[0117] 5. The logic module matches the user's question information with the corresponding data through the data module;
[0118] 6. The data module returns the matching result of the vector data corresponding to the user authority to the logic module;
[0119] 7. The logic module converts the user's question information into vector data and inputs it into the model module;
[0120] 8. The model module feeds back the answer resource, SQL statement or service request body, etc. to the logic module.
[0121] 9. The logic module determines the authority of the current user and executes the query request pronunciation return result according to the user's authority;
[0122] 10. The logic module sends the returned result to the service module;
[0123] 11. The service module will return the result to the user.
[0124] In an application embodiment, the question and answer data processing method further includes the following steps:
[0125] S1. Initialization step: The user logs in to the question-answering data processing system, creates a project, and creates project-related resources, such as database information, HTTP interface information, etc.;
[0126] S2. The system vectorizes resources: The system vectorizes text related to resources and stores it in a vector database. For databases, the related text includes table descriptions, notes on each field, etc. For HTTP interfaces, the related text includes interface descriptions, request and response descriptions, etc.
[0127] S3. Users ask questions in natural language through the system: After the system has processed the relevant resources of the project, users can ask questions related to the project through the system;
[0128] S4. The system filters resources based on the question: The system filters the total number of resources T (total number of tables and interfaces) entered according to different strategies to obtain the data corresponding to the user's question information:
[0129] 1. When T<=5, no filtering is performed;
[0130] 2. When 5<=T<=15, the resource description (table description or interface description) and user question are directly sent to the big model and filtered through the big language model;
[0131] 3. When T>15, the user questions and resources are matched by semantic vectors, and the resource descriptions and user questions of the top 15 matching results are sent to the big model for filtering through the big language model;
[0132] S5. The big language model writes program code (such as Python) for the user's question: The system sends the detailed information of the matching resources (table field description, interface request and response description, etc.) plus the user's question to the big model, requiring the big model to write code to solve the user's question;
[0133] S6. The system executes the code and returns it to the user: The system dynamically executes the code written by the large model, sends the execution result + user question to the large language model again, and returns it to the user as the final result after being packaged by the large language model;
[0134] S7. User adjusts the code: The user views the program code generated by this conversation through the system page and adjusts the code as needed. The system supports the big model to assist the user in adjusting the code through natural language and supports testing the code through the system.
[0135] S8. The user publishes the code as an interface: After the user has tested the code and found no problems, the system can directly publish the code as an interface, and generate relevant descriptions of the interface, interface calling examples and other information through the large model.
[0136] In an application embodiment, if Fig. 9 As shown, the above question and answer data processing method also includes:
[0137] 1. The system executes the task of regularly updating data.
[0138] 2. Query the user's question processing records to be processed in the system project by project; for example, including the records of processing documents, processing data sources, processing interfaces, etc.
[0139] 3. Modify the corresponding vector library records according to the above question processing records;
[0140] 4. Then refresh the data source and read the metadata, which includes tables and views;
[0141] 5. Then compare the local records with the updated data source and update the metadata and vector library.
[0142] Compared with the prior art, the embodiments of the present application combine the natural language understanding and reasoning capabilities of a large language model. Through the interaction between people and the large model, the certainty and reliability of the large language model in dealing with precise problems can be improved. The understanding and reasoning capabilities of the large model can be fully utilized, and the efficiency of low-code development of service interfaces can be improved.
[0143] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0144] According to another aspect of the embodiment of the present application, a question and answer data processing device for implementing the above question and answer data processing method is also provided. Fig.10 As shown, the device comprises:
[0145] A preprocessing unit 1002 is used to preprocess the resources corresponding to the target project to obtain preprocessed data;
[0146] A screening unit 1004 is used to receive question information input by a user for the target project, and screen matching data matching the question information from the pre-processed data;
[0147] The acquisition unit 1006 is used to acquire target input information based on the question information, and input the target input information and the matching data into a preset large language model to acquire an answer resource generated by the preset large language model.
[0148] In an embodiment of the present application, a method is adopted in which resources corresponding to a target project are preprocessed to obtain preprocessed data; question information input by a user for the target project is received, and matching data matching the question information is screened from the preprocessed data; target input information is obtained based on the question information, and the target input information and the matching data are input into a preset large language model to obtain answer resources generated by the preset large language model; in the above method, matching data matching the question information is screened out in advance from the preprocessed data, and then the answer corresponding to the question raised by the user can be accurately obtained according to the matching data, which not only improves the stability of the large model system, but also meets the demand for obtaining high-precision results in accurate data scenarios, significantly improving the user experience.
[0149] In one or more embodiments, the acquisition unit 1006 includes:
[0150] A creation module, used to create target input information according to a preset prompt word template and the question information;
[0151] The first acquisition module is used to input the target input information and the matching data into a preset large language model, and obtain an answer resource generated by the large language model and corresponding to the target input information and the matching data.
[0152] In one or more embodiments, the answer resource includes text information and a service calling interface, and the acquisition module includes at least one of the following:
[0153] A first acquisition subunit is used to determine that the target input information corresponds to a document output type, and acquire text information generated by the large language model according to the target input information and the matching data;
[0154] The second acquisition subunit is used to determine that the target input information corresponds to a code output type, obtain the target code generated by the preset large language model, and generate the service call interface corresponding to the question information based on the target code.
[0155] In one or more embodiments, the second acquisition subunit includes:
[0156] A display submodule, used for displaying the target code and debugging the target code to obtain a debug code;
[0157] A generating submodule is used to generate the service calling interface corresponding to the question information based on the debugging code.
[0158] In one or more embodiments, the question and answer information processing apparatus further includes:
[0159] An execution unit, used for executing the target code, and inputting the execution result and the question information into the preset large language model for packaging;
[0160] The display unit is used to display the encapsulated answer resources.
[0161] In one or more embodiments, the resource includes at least one of a document resource, database information, and a service interface, and the preprocessing unit 1002 includes at least one of the following:
[0162] A first conversion module, configured to convert each document in the document resource into a text vector by using Chinese word segmentation and a Chinese vector model to obtain preprocessed data;
[0163] A second conversion module, used for acquiring first text information corresponding to the table and field in the database information, converting the first text information into a text vector to obtain preprocessed data;
[0164] The third conversion module is used to obtain second text information corresponding to the service interface information in the service interface, convert the second text information into a text vector, and obtain preprocessed data.
[0165] In one or more embodiments, the screening unit 1004 includes:
[0166] A second acquisition module, used to acquire a first number of tables corresponding to the preprocessed data, and a second number of service interfaces corresponding to the preprocessed data;
[0167] A third acquisition module is used to acquire matching data matching the question information according to the sum of the first number and the second number.
[0168] In one or more embodiments, the screening unit 1004 includes:
[0169] A first determination module, configured to determine the pre-processed data as the matching data when the sum value is less than a first preset threshold;
[0170] a second determining module, configured to, when the sum is greater than or equal to the first preset threshold and less than a second preset threshold, input the description of the table and the description of the service interface into the preset large language model to obtain first data output by the preset large language model, and determine the first data as the matching data;
[0171] The third determination module is used to perform semantic matching on the question information and the preprocessed data when the sum value is greater than or equal to the second preset threshold, and to send the matched preprocessed data of the second preset threshold and the question information to the preset large language model to obtain second data output by the preset large language model, and determine the second data as the matching data.
[0172] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned question and answer data processing method is also provided. The electronic device may be Fig.11 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig.11 As shown, the electronic device includes a memory 1102 and a processor 1104. The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps in any of the above method embodiments through the computer program.
[0173] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0174] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0175] S1, preprocessing the resources corresponding to the target project to obtain preprocessed data;
[0176] S2, receiving question information input by a user for the target project, and screening matching data matching the question information from the pre-processed data;
[0177] S3, obtaining target input information based on the question information, inputting the target input information and the matching data into a preset large language model, and obtaining an answer resource generated by the preset large language model.
[0178] Alternatively, a person skilled in the art may understand that: Fig.11 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig.11 The electronic device and the electronic equipment described above are not limited in structure. Fig.11 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig.11 Different configurations shown.
[0179] Among them, the memory 1102 can be used to store software programs and modules, such as the program instructions / modules corresponding to the question and answer data processing method and device in the embodiment of the present application. The processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, that is, realizing the above-mentioned question and answer data processing method. The memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1102 may further include a memory remotely arranged relative to the processor 1104, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1102 can be specifically, but not limited to, used to store resources corresponding to the target project, as well as the question information input by the user and the answer resources generated by the system. As an example, such as Fig.11 As shown, the memory 1102 may include, but is not limited to, the preprocessing unit 1002, the screening unit 1004, and the acquiring unit 1006 in the question and answer data processing device. In addition, it may also include, but is not limited to, other module units in the question and answer data processing device, which will not be described in detail in this example.
[0180] Optionally, the transmission device 1106 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 11011 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1106 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0181] In addition, the electronic device further includes: a display 1108 for displaying resources corresponding to the target project, as well as question information input by the user and answer resources generated by the system; and a connection bus 1110 for connecting various module components in the electronic device.
[0182] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0183] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned question-answer data processing method, wherein the computer program is configured to perform the steps of any one of the above-mentioned method embodiments when it is run.
[0184] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0185] S1, preprocessing the resources corresponding to the target project to obtain preprocessed data;
[0186] S2, receiving question information input by a user for the target project, and screening matching data matching the question information from the pre-processed data;
[0187] S3, obtaining target input information based on the question information, inputting the target input information and the matching data into a preset large language model, and obtaining an answer resource generated by the preset large language model.
[0188] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0189] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0190] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.
[0191] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0192] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0193] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0194] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0195] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A question-answer data processing method, characterized in that: include: Preprocess the resources corresponding to the target project to obtain preprocessed data; receiving question information input by a user for the target project, and screening matching data matching the question information from the pre-processed data; Target input information is obtained based on the question information, the target input information and the matching data are input into a preset large language model, and an answer resource generated by the preset large language model is obtained.
2. The method according to claim 1, characterized in that The step of acquiring target input information based on the question information, inputting the target input information and the matching data into a preset large language model, and acquiring an answer resource generated by the preset large language model includes: Creating target input information according to a preset prompt word template and the question information; The target input information and the matching data are input into a preset large language model, and an answer resource corresponding to the target input information and the matching data and generated by the large language model is obtained.
3. The method according to claim 1, characterized in that The answer resource includes text information and a service call interface, and obtaining the answer resource generated by the preset large language model includes at least one of the following: Determining that the target input information corresponds to a document output type, and obtaining text information generated by the large language model according to the target input information and the matching data; Determine that the target input information corresponds to a code output type, obtain the target code generated by the preset large language model, and generate the service call interface corresponding to the question information based on the target code.
4. The method according to claim 3, characterized in that The generating the service calling interface corresponding to the question information based on the target code includes: Displaying the target code, and debugging the target code to obtain a debug code; Based on the debugging code, the service calling interface corresponding to the question information is generated.
5. The method according to claim 3 or 4, characterized in that: The method further comprises: Executing the target code, and inputting the execution result and the question information into the preset large language model for packaging; Display the encapsulated answer resources.
6. The method according to any one of claims 1 to 4, characterized in that: The resource includes at least one of a document resource, database information, and a service interface. The resource corresponding to the target project is preprocessed to obtain preprocessed data, including at least one of the following: Using Chinese word segmentation and Chinese vector models, convert each document in the document resource into a text vector to obtain preprocessed data; Acquire first text information corresponding to the table and field in the database information, convert the first text information into a text vector, and obtain preprocessed data; Acquire second text information corresponding to the service interface information in the service interface, convert the second text information into a text vector, and obtain preprocessed data; The step of screening the matching data matching the question information from the pre-processed data includes: Acquire a first number of tables corresponding to the preprocessed data and a second number of service interfaces corresponding to the preprocessed data; According to the sum of the first number and the second number, matching data matching the question information is acquired.
7. The method according to claim 6, characterized in that The acquiring, according to the sum of the first quantity and the second quantity, matching data matching the question information includes: When the sum is less than a first preset threshold, determining the preprocessed data as the matching data; When the sum is greater than or equal to the first preset threshold and less than a second preset threshold, inputting the description of the table and the description of the service interface into the preset large language model to obtain first data output by the preset large language model, and determining the first data as the matching data; When the sum value is greater than or equal to the second preset threshold, the question information and the preprocessed data are semantically matched, and the preprocessed data of the second preset threshold and the question information that are matched are sent to the preset large language model to obtain second data output by the preset large language model, and the second data is determined as the matching data.
8. A question-answer data processing device, characterized in that: include: A preprocessing unit, used for preprocessing resources corresponding to the target project to obtain preprocessed data; A screening unit, configured to receive question information input by a user for the target project, and screen matching data matching the question information from the pre-processed data; An acquisition unit acquires target input information based on the question information, inputs the target input information and the matching data into a preset large language model, and acquires an answer resource generated by the preset large language model.
9. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
Citation Information
Cited By
Intelligent agent question answering system and method based on engineering project
CN121350319A