Data retrieval output method based on large language model
By generating prompt words and inputting large language models, SQL search statements are automatically obtained, which solves the problem of high SQL generation threshold in the existing technology, and realizes efficient query and user-friendly interface of the database.
Patent Information
- Application Number
- CN202411675167.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-14
AI Technical Summary
In the prior art, the generation threshold for SQL search statements is relatively high, and users need to design the SQL language by themselves, which is difficult to use.
By obtaining the search input content input by the user, analyzing and generating prompt words, and entering a large language model to obtain SQL search statements, automatic query of the database is realized.
It lowers the threshold for generating SQL search statements, improves user experience, and realizes efficient query of databases.
Smart Images

Figure CN119621749A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database retrieval, and in particular to a data retrieval output method based on a large language model. Background Art
[0002] Structured Query Language (SQL) is a special-purpose programming language. It is a database query and programming language used to access data and query, update, and manage relational database systems. SQL is a high-level non-procedural programming language that allows users to work on high-level data structures. It does not require users to specify the storage method for data, nor does it require users to understand the specific data storage method. Therefore, different database systems with completely different underlying structures can use the same SQL as the interface for data input and management. SQL statements can be nested, which makes it extremely flexible and powerful. Large Language Model (LLM) refers to a deep learning model trained with a large amount of text data that can generate natural language text or understand the meaning of language text. Large language models can handle a variety of natural language tasks, such as text classification, question-answering, and dialogue, and are an important path to artificial intelligence. At present, large language models use Transformer architecture and pre-training objectives (such as Language Modeling) similar to small models. The difference from small models is the increase in model size, training data, and computing resources.
[0003] In the prior art, SQL has been widely used in various database systems to store production data and provide corresponding query tools. For example, Chinese patent CN202210121511.3 discloses a query method and system based on structured query language SQL, which parses the SQL statement input by the user to obtain the table name, column name and mapping conditions to be queried in the SQL statement; if the table name to be queried is the table name of the logical table in the database, the logical table is queried according to the table name to be queried and the mapping conditions, and the logical table query result is obtained and displayed; if the table name to be queried is not the table name of the logical table in the database, and the table name to be queried matches the table name, related table and column name recorded in the logical table, and the mapping conditions match, then the sample table address is returned; if they do not match, the encapsulation table and the logical table are constructed according to the table name to be queried and the mapping conditions, and the original table data is overwritten according to the table ID; the sample table data is queried according to the column name, and the sample table query result is returned and displayed. Data in multiple heterogeneous data sources can be quickly queried.
[0004] However, during the actual implementation process, the inventors found that this type of technical solution usually requires users to design the SQL language themselves during application, which has a certain usage threshold. Summary of the invention
[0005] In view of the above problems existing in the prior art, a data retrieval and output method based on a large language model is now provided.
[0006] The specific technical solutions are as follows:
[0007] A data retrieval output method based on a large language model, comprising:
[0008] Step S1: obtaining search input content input by the user, and generating prompt words according to the search input content;
[0009] Step S2: inputting the prompt word into a large language model to obtain an SQL search statement fed back by the large language model;
[0010] Step S3: Use the SQL search statement to perform a search to obtain data output results.
[0011] On the other hand, the step S1 comprises:
[0012] Step S11: obtaining the search input content, and identifying search-related content from the search input content;
[0013] Step S12: searching and obtaining a prompt word template according to the search related content;
[0014] Step S13: assembling the prompt word according to the search-related content and the prompt word template to obtain the prompt word.
[0015] On the other hand, the step S11 comprises:
[0016] Step S121: preprocessing the search input content to obtain preprocessed content;
[0017] Step S122: performing semantic recognition on the preprocessed content to obtain retrieval semantics;
[0018] Step S123: Generate the search-related content according to the search semantics.
[0019] On the other hand, the step S13 comprises:
[0020] Step S131: Generate a search vector based on the search related content;
[0021] Step S132: obtaining additional description content by matching the search vector in a vector database;
[0022] Step S123: inputting the search-related content and the additional description content into the prompt word template to obtain the prompt word.
[0023] On the other hand, the step S2 comprises:
[0024] Step S21: inputting the prompt word into a large language model to obtain output content of the large language model;
[0025] Step S22: searching and obtaining a statement identifier from the output content;
[0026] Step S23: extracting the SQL search statement according to the statement identifier.
[0027] On the other hand, the step S3 comprises:
[0028] Step S31: using the SQL search statement to search and obtain search results;
[0029] Step S32: extracting data to be displayed from the search results;
[0030] Step S33: generating a rendering chart based on the data to be displayed as the data output result.
[0031] On the other hand, the method for implementing the above data retrieval and output includes:
[0032] A prompt word generation module, wherein the prompt word generation module obtains search input content input by the user and generates prompt words according to the search input content;
[0033] A model interaction module, the model interaction module is connected to the prompt word generation module, and the model interaction module inputs the prompt word into a large language model to obtain an SQL search statement fed back by the large language model;
[0034] A data output module, wherein the data output module is connected to the model interaction module, and the data output module uses the SQL search statement to perform a search to obtain a data output result.
[0035] On the other hand, the prompt word generation module includes:
[0036] A search identification module, wherein the search identification module obtains the search input content and identifies search-related content from the search input content;
[0037] A template search module, the template search module is connected to the search and identification module, and the template search module searches for a prompt word template according to the search-related content;
[0038] An assembling module, wherein the assembling module is connected to the template searching module, and the assembling module assembles the prompt word according to the search related content and the prompt word template to obtain the prompt word.
[0039] On the other hand, the model interaction module includes:
[0040] A model output module, wherein the model input module inputs the prompt word into a large language model to obtain output content of the large language model;
[0041] An identifier search module, the identifier search module is connected to the model input module, and the identifier search module searches for a statement identifier from the output content;
[0042] A statement extraction module is connected to the identifier search module, and the statement extraction module extracts the SQL search statement according to the statement identifier.
[0043] On the other hand, the data output module comprises:
[0044] A database search module, wherein the database search module uses the SQL search statement to perform a search to obtain a search result;
[0045] A data extraction module, the data extraction module is connected to the database retrieval module, and the data extraction module extracts the data to be displayed from the retrieval results;
[0046] A result rendering module is connected to the data extraction module, and the result rendering module generates a rendering chart based on the data to be displayed as the data output result.
[0047] The above technical solution has the following advantages or beneficial effects:
[0048] In view of the high threshold for generating SQL search statements in the prior art, this solution introduces the analysis and processing of the search input content entered by the user, and assists in the effective construction of prompt words with information in the form of DDL, which is then input into a large language model to obtain accurate SQL statements to query the database, reducing the difficulty of use. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The embodiments of the present invention will be described more fully with reference to the attached drawings, which are provided for illustration and description only and are not intended to limit the scope of the present invention.
[0050] Figure 1 It is an overall schematic diagram of an embodiment of the present invention;
[0051] Figure 2 This is a schematic diagram of step S1 in an embodiment of the present invention;
[0052] Figure 3 This is a schematic diagram of step S11 in an embodiment of the present invention;
[0053] Figure 4 This is a schematic diagram of step S13 in an embodiment of the present invention;
[0054] Figure 5 This is a schematic diagram of step S2 in an embodiment of the present invention;
[0055] Figure 6 This is a schematic diagram of step S3 in an embodiment of the present invention;
[0056] Figure 7 A schematic diagram of a system in an embodiment of the present invention;
[0057] Figure 8 This is a schematic diagram of a prompt word generation module in an embodiment of the present invention;
[0058] Fig. 9 This is a schematic diagram of a model interaction module in an embodiment of the present invention;
[0059] Fig.10 Schematic diagram of a data output module in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0061] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0062] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0063] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0064] The present invention comprises:
[0065] A data retrieval output method based on a large language model, such as Figure 1 As shown, including:
[0066] Step S1: obtaining the search input content input by the user, and generating prompt words according to the search input content;
[0067] Step S2: inputting the prompt word into the large language model to obtain an SQL search statement fed back by the large language model;
[0068] Step S3: Use SQL search statements to search and obtain data output results.
[0069] Specifically, in response to the problem of high threshold for generating SQL search statements in the prior art, this solution introduces the analysis and processing of the search input content entered by the user, and assists in the effective construction of prompt words with information in the form of DDL, which is then input into a large language model to obtain accurate SQL statements to query the database, and then obtain the data output results and render them on the front-end page, thereby achieving better data retrieval and usage effects.
[0070] In the implementation process, the above data retrieval output method is mainly configured in a specific computer system as a software embodiment. In the prior art, although there are certain cases of using large language models to assist in building codes, such technical solutions are mainly implemented manually, that is, users construct questions and prompt words according to actual needs, and interact with large language models to obtain the desired code examples. Such technical solutions are usually inconvenient to use.
[0071] To solve this problem, this solution uses the Dify platform. Specifically, based on the big data model, the Dify (open source community version) platform as the base, and the functions of Text2SQL and pyecharts, through the study of the Dify source code, a method for implementing the above data retrieval and output on the Dify platform is proposed.
[0072] First, the relevant tools need to be integrated on the Dify platform. Dify provides an open solution for tool integration, which can be implemented through the OpenAIPlugin specification. The tool code exists as part of the Dify project. There are rigid requirements for the storage location of the tool code, which must be placed in the api / core / tools / provider / builtin directory. All tools need to inherit from the BuiltinTool class.
[0073] After obtaining the large language model, the Text2SQL tool was introduced to execute SQL statements. The initial concept and idea of the Text2SQL tool integration is that the tool itself has the ability to configure the data source. The backend connects to the database through the Python drivers of various databases through the data source configuration, and then extracts the SQL statements according to the specified format of the output of the LLM model node, executes the SQL, and finally formats the SQL execution results, that is, the data, into JSON for front-end rendering and output.
[0074] In one embodiment, Figure 2 As shown, step S1 includes:
[0075] Step S11: obtaining search input content, and identifying search-related content from the search input content;
[0076] Step S12: Find and obtain a prompt word template according to the search related content;
[0077] Step S13: Assembling prompt words according to the search related content and the prompt word template.
[0078] Specifically, in order to achieve a better large model prompt effect, in this embodiment, the search input content is first obtained, and then the search-related content is identified from the search input content in combination with semantic recognition technology, and irrelevant items in the user input are removed. The search-related content is then classified, and the category of the search object pointed to by the search-related content is determined, and the prompt word template is found and obtained. Finally, the prompt word is assembled according to the search-related content and the prompt word template.
[0079] In one embodiment, step S11 includes:
[0080] Step S121: preprocessing the search input content to obtain preprocessed content;
[0081] Step S122: performing semantic recognition on the preprocessed content to obtain retrieval semantics;
[0082] Step S123: Generate search-related content according to the search semantics.
[0083] Specifically, in order to effectively extract the search-related content, in this embodiment, the search input content is first preprocessed to obtain the preprocessed content, including formatting the text, removing punctuation and paragraphs, introducing codes, etc. Subsequently, semantic recognition is performed on the preprocessed content, and some features thereof are extracted to obtain the search semantics. Finally, the search-related content is generated according to the search semantics.
[0084] In one embodiment, step S13 includes:
[0085] Step S131: Generate a search vector based on the search related content;
[0086] Step S132: obtaining additional description content by matching the search vector from the vector database;
[0087] Step S123: inputting the search-related content and the additional description content into a prompt word template to obtain a prompt word.
[0088] Specifically, in order to achieve a better prompt effect for large models, in this embodiment, corresponding additional description content is pre-compiled around various search requirements. When the search-related content is extracted, a search vector is first generated based on the semantic features of the search-related content, and additional description content is obtained by matching in the vector database based on the vector search. Finally, the search-related content and the additional description content are input into the prompt word template for assembly, thereby adding additional description information to the prompt word, achieving a better prompt effect for the large model.
[0089] It should be pointed out that the accuracy of SQL statement generation is highly related to the reasoning ability of LLM itself and the accuracy of prompt words in facing problems. Model ability is definitely the key point of Text2SQL implementation, and prompt words are also indispensable for guiding LLM to form correct reasoning. In specific implementation, templates are generally used to implement the prompt word framework, and then the Agent fills in the specific placeholders. The following is a typical prompt word example:
[0090] “You’re a database expert;
[0091] Please answer the user's questions based on the database selected by the user and the partial table structure definition of the database;
[0092] Data table name:
[0093] {db_name};
[0094] Table structure definition:
[0095] {table_info};
[0096] constraint:
[0097] 1. Please understand the user's intention based on the user's question, and use the given table structure definition to create a grammatically correct {dialect} sql. If sql is not required, directly answer the user's question.
[0098] 2. Unless the user specifies in the question the exact number of rows he or she wishes to obtain, the network will limit the query to at most {top_k} results.
[0099] 3. You can only use the tables provided in the table structure information to generate SQL. If you cannot generate SQL based on the provided table structure, please say: "The provided table structure information is insufficient to generate SQL queries." It is prohibited to fabricate information at will.
[0100] 4. Please be careful not to make mistakes in the relationship between tables and columns when generating SQL.
[0101] 5. Please check the correctness of the SQL and optimize the query performance if it is correct.
[0102] 6. Please select the best one from the following display methods to render the data, and put the type name into the name parameter value in the required format.
[0103] If you can't find the most suitable one, use "table" as the display method. The available data display methods are as follows: {display_type}
[0104] User Question:
[0105] {user_input}
[0106] Please think step by step and reply according to the following JSON format:
[0107] {
[0108] "thoughts": "thoughts summary to say to user",
[0109] "sql":"SQL Query io run",
[0110] "display_type":"Data display method",
[0111] }
[0112] Make sure it returns correct json and can be parsed by Python json.loads method"
[0113] In one embodiment, step S2 includes:
[0114] Step S21: inputting the prompt word into the large language model to obtain output content of the large language model;
[0115] Step S22: searching for a sentence identifier from the output content;
[0116] Step S23: extracting the SQL search statement according to the statement identifier.
[0117] Specifically, in order to achieve better SQL search statement extraction effect, in this embodiment, after the prompt word is input into the large language model, the output content of the large language model can be obtained. Since the corresponding identifier is designed in the prompt word template, the statement identifier can be searched and then the SQL search statement can be extracted.
[0118] In one embodiment, step S3 includes:
[0119] Step S31: Using SQL search statements to search and obtain search results;
[0120] Step S32: extracting data to be displayed from the search results;
[0121] Step S33: generating a rendering chart based on the data to be displayed as a data output result.
[0122] Specifically, in order to achieve a better display effect, in this embodiment, firstly, an SQL search statement is input into the corresponding script, thereby automatically searching the SQL database to obtain the search results. Subsequently, the data to be displayed is extracted from the search results, and the data to be displayed is input into the rendering engine, and after the rendered chart is obtained, it is output to the front-end page for display.
[0123] Specifically, during the application process, the output process is implemented based on Pyecharts. The integration of the Pyecharts tool is similar to the Text2SQL tool. The pyecharts.charts library is imported in the back end. In order to simplify the implementation and code routing, each chart is independently made into a tool. First, the unified JSON data is formatted in accordance with the specific pyecharts chart, and the corresponding data format of the corresponding chart is generated (also in JSON format), and then handed over to pyecharts for rendering.
[0124] In Dify's preview mode, its front-end display is implemented using a Markdown plug-in, while the output of Pyecharts is a static web page. Markdown only supports the display of a link in a web page, and does not support the direct display of a static web page, so it is necessary to make certain adjustments to Dify's preview mode. In addition to the Markdown plug-in, a layer of routing is added for the back-end output through the matching and extraction function of regular expressions. If it is detected that the output is a static web page of Pyecharts, it is routed to a specific display mode. If not, the Markdown plug-in rendering method is used by default.
[0125] In addition, with the help of Dify's visual workflow orchestration method, user input (questions), RAG (Retrieval-Augmented Generation), LLM reasoning, Text2SQL execution tools and pyecharts tools are jointly orchestrated to form an integrated closed-loop operation of question-answering.
[0126] In one embodiment, the method for implementing the above data retrieval and output includes:
[0127] The prompt word generation module 1 obtains the search input content input by the user and generates prompt words according to the search input content;
[0128] Model interaction module 2, model interaction module 2 is connected to prompt word generation module 1, and model interaction module 2 inputs prompt words into the large language model to obtain SQL search statements fed back by the large language model;
[0129] Data output module 3, data output module 3 is connected to model interaction module 2, and data output module 3 uses SQL search statement to search to obtain data output results.
[0130] Specifically, in response to the problem of high threshold for generating SQL search statements in the prior art, this embodiment introduces a prompt word generation module 1 to analyze and process the search input content entered by the user, and assists in the effective construction of prompt words with information in the form of DDL. Subsequently, the model interaction module 2 is input into a large language model to obtain accurate SQL statements to query the database, and then the data output results are obtained. The data output module 3 renders and displays them on the front-end page, thereby achieving better data retrieval and usage effects.
[0131] In one embodiment, the prompt word generation module 1 includes:
[0132] A search identification module 11, the search identification module 11 obtains search input content, and identifies search-related content from the search input content;
[0133] The template search module 12 is connected to the search and identification module 11, and the template search module 12 searches for a prompt word template according to the search related content;
[0134] The assembling module 13 is connected to the template searching module 12, and the assembling module 13 assembles the prompt word according to the retrieved relevant contents and the prompt word template.
[0135] Specifically, in order to achieve a better large model prompt effect, in this embodiment, the retrieval recognition module 11 obtains the retrieval input content, and then combines the semantic recognition technology to identify the retrieval-related content from the retrieval input content, removing irrelevant items in the user input. Then the template search module 12 classifies the retrieval-related content, determines the category of the retrieval object pointed to by the retrieval-related content, and searches for the prompt word template. Finally, the assembly module 13 assembles the prompt word according to the retrieval-related content and the prompt word template.
[0136] In one embodiment, the model interaction module 2 includes:
[0137] The model output module 21, the model input module 21 inputs the prompt word into the large language model to obtain the output content of the large language model;
[0138] An identifier search module 22, the identifier search module 22 is connected to the model input module 21, and the identifier search module 22 searches for a sentence identifier from the output content;
[0139] The statement extraction module 23 is connected to the identifier search module 22, and the statement extraction module 23 extracts the SQL search statement according to the statement identifier.
[0140] Specifically, in order to achieve better SQL search statement extraction effect, in this embodiment, after the model output module 21 inputs the prompt word into the large language model, the output content of the large language model can be obtained. Since the corresponding identifier is designed in the prompt word template, the identifier search module 22 can search for the statement identifier, and then the statement extraction module 23 extracts the SQL search statement.
[0141] In one embodiment, the data output module 3 includes:
[0142] A database search module 31, wherein the database search module 31 uses an SQL search statement to search and obtain search results;
[0143] A data extraction module 32, the data extraction module 32 is connected to the database retrieval module 31, and the data extraction module 32 extracts the data to be displayed from the retrieval results;
[0144] The result rendering module 33 is connected to the data extraction module 32 , and the result rendering module 33 generates a rendering chart based on the data to be displayed as a data output result.
[0145] Specifically, in order to achieve a better display effect, in this embodiment, the database search module 31 first uses the SQL search statement to input into the corresponding script, thereby automatically searching the SQL database to obtain the search results. Subsequently, the data extraction module 32 extracts the data to be displayed from the search results, and the result rendering module 33 inputs the data to be displayed into the rendering engine, obtains the rendered chart, and outputs it to the front-end page for display.
[0146] Those skilled in the art will appreciate that various aspects of the present invention, or possible implementations of various aspects, may be specifically implemented as systems, methods, or computer program products. Therefore, various aspects of the present invention, or possible implementations of various aspects, may take the form of complete hardware embodiments, complete software embodiments (including firmware, resident software, etc.), or embodiments of combined software and hardware aspects, all collectively referred to herein as "circuits," "modules," or "systems." In addition, various aspects of the present invention, or possible implementations of various aspects, may take the form of computer program products, which refer to computer instructions stored in a memory.
[0147] The memory may be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or apparatuses, or any suitable combination of the foregoing, such as random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable read-only memory (CD-ROM).
[0148] The processor in the computer reads the computer instructions stored in the memory, so that the processor can execute the functional actions specified in each step or the combination of steps in the flowchart; and generate a device for implementing the functional actions specified in each block or the combination of blocks in the block diagram.
[0149] It should be understood that the processor in the computer can be understood as one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components implemented to execute the aforementioned computer instructions.
[0150] Computer instructions can be executed completely on the user's local computer, partially on the user's local computer, as a separate software package, partially on the user's local computer and partially on a remote computer, or completely on a remote computer or server. It should also be noted that in some alternative embodiments, the functions noted in each step in the flow chart or each block in the block diagram may not occur in the order noted in the figure. For example, depending on the functions involved, two steps or two blocks shown in succession may actually be executed roughly simultaneously, or these blocks may sometimes be executed in reverse order.
[0151] The above are only preferred embodiments of the present invention, and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the description and illustrations of the present invention should be included in the protection scope of the present invention.
Claims
1. A data retrieval and output method based on a large language model, characterized in that: include: Step S1: obtaining search input content input by the user, and generating prompt words according to the search input content; Step S2: inputting the prompt word into a large language model to obtain an SQL search statement fed back by the large language model; Step S3: Use the SQL search statement to perform a search to obtain data output results.
2. The data retrieval and output method according to claim 1, characterized in that: The step S1 comprises: Step S11: obtaining the search input content, and identifying search-related content from the search input content; Step S12: searching and obtaining a prompt word template according to the search related content; Step S13: assembling the prompt word according to the search-related content and the prompt word template to obtain the prompt word.
3. The data retrieval and output method according to claim 2, characterized in that: The step S11 comprises: Step S121: preprocessing the search input content to obtain preprocessed content; Step S122: performing semantic recognition on the preprocessed content to obtain retrieval semantics; Step S123: Generate the search-related content according to the search semantics.
4. The data retrieval and output method according to claim 1, characterized in that: The step S13 comprises: Step S131: Generate a search vector based on the search related content; Step S132: obtaining additional description content by matching the search vector in a vector database; Step S123: inputting the search-related content and the additional description content into the prompt word template to obtain the prompt word.
5. The data retrieval and output method according to claim 1, characterized in that: The step S2 comprises: Step S21: inputting the prompt word into a large language model to obtain output content of the large language model; Step S22: searching for a statement identifier from the output content; Step S23: extracting the SQL search statement according to the statement identifier.
6. The data retrieval and output method according to claim 1, characterized in that: The step S3 comprises: Step S31: using the SQL search statement to search and obtain search results; Step S32: extracting data to be displayed from the search results; Step S33: generating a rendering chart based on the data to be displayed as the data output result.
7. A data retrieval and output system based on a large language model, characterized in that: The method for implementing the data retrieval and output according to any one of claims 1 to 6 comprises: A prompt word generation module, wherein the prompt word generation module obtains search input content input by the user and generates prompt words according to the search input content; A model interaction module, the model interaction module is connected to the prompt word generation module, and the model interaction module inputs the prompt word into a large language model to obtain an SQL search statement fed back by the large language model; A data output module, wherein the data output module is connected to the model interaction module, and the data output module uses the SQL search statement to perform a search to obtain a data output result.
8. The data retrieval and output system according to claim 7, characterized in that: The prompt word generation module includes: A search identification module, wherein the search identification module obtains the search input content and identifies search-related content from the search input content; A template search module, the template search module is connected to the search and identification module, and the template search module searches for a prompt word template according to the search-related content; An assembling module, wherein the assembling module is connected to the template searching module, and the assembling module assembles the prompt word according to the search related content and the prompt word template to obtain the prompt word.
9. The data retrieval and output system according to claim 7, characterized in that: The model interaction module includes: A model output module, wherein the model input module inputs the prompt word into a large language model to obtain output content of the large language model; An identifier search module, the identifier search module is connected to the model input module, and the identifier search module searches for a statement identifier from the output content; A statement extraction module is connected to the identifier search module, and the statement extraction module extracts the SQL search statement according to the statement identifier.
10. The data retrieval and output system according to claim 7, characterized in that: The data output module comprises: A database search module, wherein the database search module uses the SQL search statement to search and obtain search results; A data extraction module, the data extraction module is connected to the database retrieval module, and the data extraction module extracts the data to be displayed from the retrieval result; A result rendering module is connected to the data extraction module, and the result rendering module generates a rendering chart based on the data to be displayed as the data output result.
Citation Information
Patent Citations
Query method and system based on structured query language (SQL)
CN114625732A
Cited By
Teaching field data acquisition method based on data medium table and related device
CN120196726A