Query method, device and equipment based on AI, RPA and AI Agent
Through AI, RPA and AI Agent technologies, the initial query statement is processed, the target query statement is generated and the results are obtained, which solves the problem of low efficiency in database query statement generation in the existing technology, and realizes efficient and accurate database information extraction.
Patent Information
- Application Number
- CN202411111614.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-29
AI Technical Summary
The prior art is inefficient and inconvenient in generating database query statements, and is not effective, especially in the rapid and accurate extraction of useful information in large databases.
Using query methods based on artificial intelligence (AI), robot process automation (RPA) and digital labor platform intelligent assistant (AI Agent), we obtain the initial query statement, process it into an initial semantic vector, determine the target data table information, and generate the target query The statement is finally obtained by the AI Agent.
It realizes the convenient generation of query statements, improves the generation efficiency and effect, reduces the dependence on manual writing and debugging, and significantly improves the accuracy and efficiency of query.
Smart Images

Figure CN119046427A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of artificial intelligence (AI), robotic process automation (RPA) and artificial intelligence agent (AI agent), and in particular to a query method, device and equipment based on AI, RPA and AI agent. Background Art
[0002] Robotic Process Automation (RPA) uses specific "robot software" to simulate human operations on computers and automatically execute process tasks according to rules.
[0003] Artificial Intelligence (AI) is a technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.
[0004] The artificial intelligence agent (AI agent) of the digital labor platform can perceive the environment, make decisions and perform actions. The difference from traditional artificial intelligence is that it has the ability to think and act independently and can call tools to complete given goals. AI Agent is based on large language models (LLM) as its core computing engine, which enables it to have conversations, perform tasks, reason and show a certain degree of autonomy. It has the ability to understand, perceive, plan, remember and use tools independently, and can automatically perform complex tasks. Specifically, the AI agent, an intelligent assistant composed of multiple AI capabilities driven by LLM, can interact with employees in natural language, understand employees' instructions and needs, and provide feedback and responses; it can master domain knowledge related to the business to complete complex professional work; it can decompose complex tasks into several executable tasks and use data and tools to complete tasks; it can also collaborate with employees, and AI agents can also collaborate to complete complex tasks, so as to enable digital employees to achieve a leap from automation to intelligence, help employees complete their work more efficiently, and fully realize human-machine collaboration.
[0005] In a data-driven business environment, extracting useful information from large databases quickly and accurately is crucial for business decision-making. In related technologies, query statements are generated by manual writing, visual tools, templates, and wizards, and the query statements can be used to query information from the database. In this way, the query statement generation process is not convenient, efficient, and effective. Summary of the invention
[0006] The embodiments of the present disclosure provide a query method, apparatus and device based on AI, RPA and AI Agent to solve one of the technical problems existing in the related technologies. The technical solution is as follows:
[0007] In a first aspect, an embodiment of the present disclosure provides a query method based on AI, RPA, and AI Agent, including:
[0008] Get the initial query statement;
[0009] Process the initial query statement based on AI to obtain the initial semantic vector;
[0010] Process the initial semantic vector and initial query statement based on AI to determine the target data table information;
[0011] Based on AI processing of the initial semantic vector and target data table information, the target query statement is obtained;
[0012] Obtain the target query results corresponding to the target query statement based on AI Agent.
[0013] In a second aspect, an embodiment of the present disclosure provides a query device based on AI, RPA, and AI Agent, including:
[0014] A first acquisition module, used to acquire an initial query statement;
[0015] The first processing module is used to process the initial query statement based on AI to obtain an initial semantic vector;
[0016] The second processing module is used to process the initial semantic vector and the initial query statement based on AI to determine the target data table information;
[0017] The third processing module is used to process the initial semantic vector and the target data table information based on AI to obtain the target query statement;
[0018] The second acquisition module is used to acquire the target query result corresponding to the target query statement based on the AI Agent.
[0019] In a third aspect, an embodiment of the present disclosure provides an electronic device, the electronic device comprising: a memory and a processor. The memory and the processor communicate with each other through an internal connection path, the memory is used to store instructions, the processor is used to execute the instructions stored in the memory, and when the processor executes the instructions stored in the memory, the processor executes the method in any one of the above-mentioned embodiments.
[0020] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the method in any one of the above-mentioned embodiments is executed.
[0021] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method in any one of the above-mentioned aspects when executed by a processor.
[0022] The advantages or beneficial effects of the above technical solution include at least:
[0023] By obtaining the initial query statement and processing the initial query statement based on AI, the initial semantic vector is obtained, the initial semantic vector and the initial query statement are processed based on AI to determine the target data table information, the initial semantic vector and the target data table information are processed based on AI to obtain the target query statement, and the target query result corresponding to the target query statement is obtained based on AI Agent. Based on AI, RPA and AI Agent technologies, query statements can be generated conveniently and the generation efficiency and effect can be improved.
[0024] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present disclosure will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in accordance with the present disclosure and should not be regarded as limiting the scope of the present disclosure.
[0026] Figure 1 is a flowchart of a query method based on AI, RPA and AI Agent provided by an embodiment of the present disclosure;
[0027] Figure 2 is a flowchart of a query method based on AI, RPA and AI Agent provided by another embodiment of the present disclosure;
[0028] Figure 3 is a flowchart of a query method based on AI, RPA and AI Agent provided by another embodiment of the present disclosure;
[0029] Figure 4 is an application schematic diagram of an embodiment of the present disclosure;
[0030] Figure 5 is a structural diagram of a query device based on AI, RPA and AI Agent provided by an embodiment of the present disclosure;
[0031] Figure 6 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0032] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present disclosure, and cannot be understood as limiting the present disclosure.
[0033] In a data-driven business environment, extracting useful information from large databases quickly and accurately is crucial for business decision-making. In related technologies, query statements are generated by manual writing, visual tools, templates, and wizards, and the query statements can be used to query information from the database. In this way, the query statement generation process is not convenient, efficient, and effective.
[0034] In order to solve at least one of the above-mentioned problems, the embodiments of the present disclosure propose a query method, device and equipment based on artificial intelligence (AI), robotic process automation (RPA) and artificial intelligence agent (AI agent) of the digital labor platform.
[0035] These and other aspects of the embodiments of the present disclosure will be apparent with reference to the following description and drawings. In these descriptions and drawings, some specific implementations of the embodiments of the present disclosure are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present disclosure, but it should be understood that the scope of the embodiments of the present disclosure is not limited thereto. On the contrary, the embodiments of the present disclosure include all changes, modifications and equivalents that fall within the spirit and connotation of the appended claims.
[0036] Before describing the embodiments of the present disclosure in detail, for ease of understanding, common technical terms are first introduced:
[0037] In the description of the present disclosure, the term "plurality" refers to two or more.
[0038] In the description of the present disclosure, the term “initial query statement” refers to a query statement in a natural language.
[0039] In the description of the present disclosure, the term “initial semantic vector” refers to a vector containing semantic features in an initial query statement, and the initial semantic vector can represent the semantic information carried by the initial query statement.
[0040] In the description of the present disclosure, the term “initial field information” refers to information of fields in an initial query statement that are strongly associated with semantic meanings.
[0041] In the description of the present disclosure, the term "field encoding" refers to the result content obtained by encoding the initial field.
[0042] In the description of this disclosure, the term "target data table" refers to the data table from which the query results are to be read, determined based on the semantic meaning of the initial query statement. The term "target data table information" refers to information related to the target data table, such as the storage location of the target data table, the table name, the relationship between tables, etc.
[0043] In the description of this disclosure, the term "target query statement" refers to a structured query statement determined based on the semantic meaning carried by the initial query statement. The target query statement can be recognized by a machine and compared with at least one data table in a database to query and obtain a target query result.
[0044] In the description of the present disclosure, the term "target query result" refers to a result obtained based on a target query statement.
[0045] In the description of the present disclosure, the term "reference data table information" refers to data table information used as a candidate for target data table information.
[0046] In the description of the present disclosure, the term “first reference data table information” refers to reference data table information determined based on an initial semantic vector.
[0047] In the description of the present disclosure, the term “second reference data table information” refers to reference data table information determined based on an initial query statement.
[0048] In the description of the present disclosure, the term “first quantity” refers to the quantity of first reference data table information that needs to be determined.
[0049] In the description of the present disclosure, the term “second quantity” refers to the quantity of second reference data table information that needs to be determined.
[0050] In the description of the present disclosure, the term "context semantics" refers to the logical semantics, transition semantics, etc. of the context between different initial field information carried in the initial semantic vector.
[0051] Figure 1 It is a flowchart of a query method based on artificial intelligence (AI), robotic process automation (RPA) and digital labor platform intelligent assistant (AI Agent) provided by an embodiment of the present disclosure.
[0052] In a possible implementation method provided by an embodiment of the present disclosure, the present disclosure takes the query method based on AI, RPA and AI Agent as an example, and the query device based on AI, RPA and AI Agent is configured in the query device based on AI, RPA and AI Agent. The query device based on AI, RPA and AIAgent can be applied to any electronic device with computing capabilities.
[0053] The electronic device may be a personal computer, a mobile terminal, a service end (or server), etc. The mobile terminal may be, for example, a mobile phone, a tablet computer, a personal digital assistant, or other hardware device with various operating systems.
[0054] In another possible implementation of the embodiments of the present disclosure, the query method based on AI, RPA and AI Agent can be applied to AI Agent, wherein the AI Agent can run in any electronic device with computing capabilities.
[0055] In another possible implementation of the embodiments of the present disclosure, the query method based on AI, RPA and AI Agent can be applied to a Robotic Process Automation (RPA) robot, wherein the RPA robot can run in any electronic device with computing capabilities.
[0056] like Figure 1 As shown, the query method based on AI, RPA and AI Agent may include the following steps S101 to S105:
[0057] Step S101: Obtain an initial query statement.
[0058] In the description of the present disclosure, the term "initial query statement" refers to a query statement in natural language. For example, the initial query statement can be a query statement in natural language parsed from the query voice input by the user collected by the electronic device, and there is no limitation on this.
[0059] In some embodiments, a query device based on AI, RPA and AI Agent may collect an initial query statement entered by a user, or may receive an initial query statement sent by a third-party device, or may parse the context of a conversation to determine a natural language query statement that may trigger a database query as the initial query statement, without limitation.
[0060] Step S102: Process the initial query statement based on AI to obtain an initial semantic vector.
[0061] In the description of the present disclosure, the term “initial semantic vector” refers to a vector containing semantic features in an initial query statement, and the initial semantic vector can represent the semantic information carried by the initial query statement.
[0062] In some embodiments, after obtaining the initial query statement, the initial query statement can be processed based on AI to obtain an initial semantic vector. For example, semantic features can be identified from the initial query statement based on AI, and the semantic features can be vectorized to obtain an initial semantic vector; or semantic labels can be obtained based on AI, and corresponding semantic label values can be identified from the initial semantic vector based on the semantic labels, and the semantic label values can be vectorized to obtain an initial semantic vector, or the initial query statement can be processed based on AI to obtain an initial semantic vector in any other possible manner, without limitation.
[0063] In some embodiments, in the process of implementing AI-based processing of the initial query statement to obtain the initial semantic vector, at least one initial field information may be identified from the initial query statement based on the first language model; each initial field information is encoded to obtain a corresponding field code; and the initial semantic vector is generated according to the at least one field code. This improves the efficiency and accuracy of initial semantic vector recognition.
[0064] In the description of the present disclosure, the term “initial field information” refers to information of fields in an initial query statement that are strongly associated with semantic meanings.
[0065] In the description of the present disclosure, the term "field encoding" refers to the result content obtained by encoding the initial field.
[0066] Among them, the first large language model (LLM) has the ability to identify the initial semantic vector corresponding to the initial query statement. The first large language model can be pre-trained. During the training process, a large amount of text data (including sample query statements and sample semantic vectors corresponding to the sample query statements) can be used to train the deep learning model, so that the trained first large language model can understand the semantic meaning of the initial query statement and can obtain the initial semantic vector based on the semantic meaning of the initial query statement.
[0067] In the embodiment of the present disclosure, the initial query statement can be input into the first LLM, so that the first LLM can identify one or more initial field information from the initial query statement, and then each initial field information can be encoded separately to obtain a field code corresponding to each initial field information, and an initial semantic vector can be generated according to one or more field codes. For example, if the number of field codes is one, the field code can be encapsulated to obtain an initial semantic vector. If the number of field codes is multiple, multiple field codes can be synthesized to obtain an initial semantic vector. There is no limitation on this.
[0068] Step S103: Process the initial semantic vector and the initial query statement based on AI to determine the target data table information.
[0069] In the description of this disclosure, the term "target data table" refers to the data table from which the query results are to be read, determined based on the semantic meaning of the initial query statement. The term "target data table information" refers to information related to the target data table, such as the storage location of the target data table, the table name, the relationship between tables, etc.
[0070] After obtaining the initial semantic vector, the target data table information can be identified by combining the initial semantic vector and the initial query statement. For example, the target data table information can be determined from the configuration file based on the semantic meaning carried by the initial semantic vector and the query information of the initial query statement; or the semantic meaning and the query information can be automatically compared with a mapping relationship based on AI, and the target data table information corresponding to the semantic meaning and the query information can be determined based on the mapping relationship; or any other possible method can be combined to realize AI-based processing of the initial semantic vector and the initial query statement to determine the target data table information.
[0071] Step S104: Process the initial semantic vector and target data table information based on AI to obtain a target query statement.
[0072] In the description of this disclosure, the term "target query statement" refers to a structured query statement determined based on the semantic meaning carried by the initial query statement. The target query statement can be recognized by a machine and compared with at least one data table in a database to query and obtain a target query result.
[0073] In the description of the present disclosure, the term "target query result" refers to a result obtained based on a target query statement.
[0074] In some embodiments, the query logic can be identified from the initial semantic vector based on the AI reference database query rules, and the storage location, table name, relationship between tables, etc. described by the target data table information can be assembled based on the query logic to obtain the target query statement.
[0075] Step S105: Obtaining a target query result corresponding to the target query statement based on the AI Agent.
[0076] After obtaining the target query statement, the target query statement can be used to perform a query based on the AI Agent trigger. For example, the target query statement can be used to perform a query from a large database based on the AI Agent to obtain the target query result.
[0077] In this embodiment, by obtaining an initial query statement, and processing the initial query statement based on AI, an initial semantic vector is obtained, the initial semantic vector and the initial query statement are processed based on AI to determine the target data table information, the initial semantic vector and the target data table information are processed based on AI to obtain the target query statement, and the target query result corresponding to the target query statement is obtained based on AI Agent. Based on AI, RPA and AI Agent technologies, query statements can be generated conveniently and the generation efficiency and effect can be improved.
[0078] In some embodiments of the present disclosure, before obtaining the target query result corresponding to the target query statement based on the AI Agent, the target query statement can also be syntax checked to obtain the check result, so as to support improving the accuracy of the target query result query.
[0079] For example, the grammar rules supported by the large database may be determined, and the grammar check of the target query statement may be performed based on the grammar rules.
[0080] In some embodiments of the present disclosure, in the process of obtaining a target query result corresponding to a target query statement based on an AI Agent, in response to a check result indicating that the syntax check of the target query statement has passed, the target query result corresponding to the target query statement can be obtained based on the AI Agent, and in response to a check result indicating that the syntax check of the target query statement has not passed, the target query statement is updated to obtain a new target query statement, until the syntax check of the new target query statement passes, and the target query result corresponding to the new target query statement is obtained based on the AI Agent. This improves the effect of automated query.
[0081] Figure 2 It is a flowchart of a query method based on AI, RPA and AI Agent provided by another embodiment of the present disclosure.
[0082] like Figure 2 As shown, the query method based on AI, RPA and AI Agent may include the following steps S201 to S207:
[0083] Step S201: Obtain an initial query statement.
[0084] Step S202: Process the initial query statement based on AI to obtain an initial semantic vector.
[0085] For the description of steps S201 - S202 , please refer to the above embodiment, which will not be repeated here.
[0086] Step S203: Process the initial semantic vector based on AI to obtain a first number of first reference data table information.
[0087] In the description of the present disclosure, the term "reference data table information" refers to data table information used as a candidate for target data table information.
[0088] In the description of the present disclosure, the term “first reference data table information” refers to reference data table information determined based on an initial semantic vector.
[0089] In the description of the present disclosure, the term “second reference data table information” refers to reference data table information determined based on an initial query statement.
[0090] In the description of the present disclosure, the term “first quantity” refers to the quantity of first reference data table information that needs to be determined.
[0091] In the description of the present disclosure, the term “second quantity” refers to the quantity of second reference data table information that needs to be determined.
[0092] In some embodiments, the initial semantic vector can be initially identified based on AI to determine the first number of first reference data table information that matches the initial semantic vector. For example, the first number of first reference data table information can be determined from a configuration file based on the semantic meaning carried by the initial semantic vector; or the first number of first reference data table information that matches the semantic meaning carried by the initial semantic vector can be determined from a vector library, without limitation.
[0093] Optionally, in some embodiments, in the process of implementing AI-based processing of the initial semantic vector to obtain the first number of first reference data table information, multiple candidate semantic vectors may be obtained from the semantic representation vector library, wherein each candidate semantic vector has corresponding candidate data table information, and the similarity between the initial semantic vector and each candidate semantic vector is determined based on the first language model, the multiple similarities are sorted, and the first number of first similarities ranked first are selected, and the candidate data table information corresponding to the candidate semantic vector to which the first similarity belongs is used as the first reference data table information. This effectively improves the accuracy and efficiency of obtaining the first reference data table information.
[0094] The semantic representation vector library may be pre-built. For example, the candidate data table information may be parsed to obtain one or more candidate field information, and each candidate field information may be encoded to obtain a corresponding candidate field encoding. Then, the one or more candidate field encodings may be processed to obtain a candidate semantic vector. After forming a candidate semantic vector corresponding to each candidate data table information, a semantic representation vector library may be built based on multiple candidate semantic vectors.
[0095] The semantic representation vector library can be used to match the first reference data table information. The semantic representation vector library can be stored in a background server, and there is no limitation on this.
[0096] In some embodiments, the similarity between the initial semantic vector and each candidate semantic vector can be analyzed based on the first largest language model, and then, a candidate semantic vector corresponding to each similarity among the first number of similarities ranked in the front can be selected from multiple candidate data vectors, and the candidate data table information corresponding to the selected candidate semantic vector can be used as the first reference data table information.
[0097] In some embodiments, the first LLM may also have the ability to analyze the similarity between the initial semantic vector and each candidate semantic vector, and the ability to sort multiple similarities and select a first number of candidate semantic vectors from multiple candidate semantic vectors based on the similarities. The first large language model may be pre-trained. During the training process, a large amount of text data (including sample semantic vectors and sample data table information corresponding to the sample semantic vectors) may be used to train the deep learning model until the deep learning model converges. The trained model is used as the first LLM, and there is no restriction on this.
[0098] Step S204: Process the initial query statement based on AI to obtain a second number of second reference data table information.
[0099] In some embodiments, the initial query statement can be initially identified based on AI to determine a second number of second reference data table information matching the initial query statement. For example, the second number of second reference data table information can be retrieved from the configuration file based on the context information carried by the initial query statement, and this is not limited.
[0100] Optionally, in some embodiments, in the process of implementing AI-based processing of the initial query statement to obtain the second number of second reference data table information, the initial query statement may be input into the second largest language model to obtain the second number of second reference data table information output by the second largest language model, wherein the second largest language model has modeled and learned the mapping relationship between the initial query statement and the second number of second reference data table information, thereby effectively improving the accuracy and efficiency of obtaining the second reference data table information.
[0101] Among them, the large language model used to identify the second reference data table information can be called the second largest language model. The second largest language model has modeled and learned the mapping relationship between the initial query statement and the second number of second reference data table information. For example, the second largest language model can be pre-trained, for example, based on the sample query statement, based on the sample data table information that can be obtained by the sample query statement, the deep learning model can be trained until the deep learning model converges, and the trained deep learning model is used as the second largest language model.
[0102] In the embodiment of the present disclosure, the second largest language model and the first largest language model may be the same model or different models, and there is no limitation on this.
[0103] Step S205: performing deduplication processing on the first number of first reference data table information and the second number of second reference data table information, and taking the retained first reference data table information and / or second reference data table information as target data table information.
[0104] After obtaining the first number of first reference data table information and the second number of second reference data table information, the repeated first reference data table information and the second reference data table information can be determined, and the repeated first reference data table information or the second reference data table information can be deleted to obtain the retained first reference data table information and / or the retained second reference data table information, and then, the retained first reference data table information and / or the retained second reference data table information can be used as the target data table information.
[0105] Therefore, in this embodiment, a first number of first reference data table information is obtained by identifying based on the initial semantic vector, and a second number of second reference data table information is obtained by identifying based on the initial query statement. Since the first number of first reference data table information and the second number of second reference data table information are determined respectively based on two methods, and then, the first number of first reference data table information and the second number of second reference data table information are deduplicated, the retained first reference data table information and / or the retained second reference data table information are used as target data table information, so that the recognition of the target data table information is more comprehensive and accurate, and the recognition accuracy of the target data table information can be greatly improved.
[0106] Step S206: Process the initial semantic vector and target data table information based on AI to obtain a target query statement.
[0107] Step S207: Obtaining a target query result corresponding to the target query statement based on the AI Agent.
[0108] For the description of steps S206 - S207 , please refer to the above embodiment for details, which will not be repeated here.
[0109] In this embodiment, by obtaining an initial query statement, and processing the initial query statement based on AI, an initial semantic vector is obtained, the initial semantic vector and the initial query statement are processed based on AI to determine the target data table information, the initial semantic vector and the target data table information are processed based on AI to obtain the target query statement, and the target query result corresponding to the target query statement is obtained based on AI Agent. Based on AI, RPA and AI Agent technology, query statements can be conveniently generated to improve generation efficiency and effect. By identifying based on the initial semantic vector, a first number of first reference data table information is obtained, and by identifying based on the initial query statement, a second number of second reference data table information is obtained. Since the first number of first reference data table information and the second number of second reference data table information are determined based on two methods, the first number of first reference data table information and the second number of second reference data table information are deduplicated, and the retained first reference data table information and / or the retained second reference data table information are used as the target data table information, so that the recognition of the target data table information is more comprehensive and accurate, and the recognition accuracy of the target data table information can be greatly improved.
[0110] Figure 3 It is a flowchart of a query method based on AI, RPA and AI Agent provided by another embodiment of the present disclosure.
[0111] like Figure 3 As shown, the query method based on AI, RPA and AI Agent may include the following steps S301 to S306:
[0112] Step S301: Obtain an initial query statement.
[0113] Step S302: Process the initial query statement based on AI to obtain an initial semantic vector, wherein the initial semantic vector includes: at least one field code, and the field code is obtained by encoding the initial field information in the initial query statement.
[0114] Step S303: Process the initial semantic vector and the initial query statement based on AI to determine the target data table information.
[0115] For the description of steps S301 - S303 , please refer to the above embodiment for details, which will not be repeated here.
[0116] Step S304: Process the initial semantic vector based on AI to identify contextual semantics between different initial field information from the initial semantic vector.
[0117] In the description of the present disclosure, the term "context semantics" refers to the logical semantics, transition semantics, etc. of the context between different initial field information carried in the initial semantic vector.
[0118] For example, the field semantics carried by different initial field information contained in the initial semantic vector can be analyzed to determine the previous semantics, following semantics, and logical semantics and transition semantics between the previous semantics and following semantics associated with the field semantics, thereby obtaining contextual semantics.
[0119] Step S305: Process the target data table information, the initial semantic vector and the context semantics based on the third language model to obtain a target query statement.
[0120] After identifying the contextual semantics between different initial field information from the initial semantic vector, the target data table information, the initial semantic vector and the contextual semantics can be input into the third language model, so that the third language model performs modeling and analysis on the aforementioned various contents to obtain the target query statement.
[0121] Among them, the third language model has learned the mapping relationship between the target data table information, the initial semantic vector, the context semantics and the target query sentence. For example, the third language model can be pre-trained, for example, the deep learning model can be trained based on the sample data table information, the sample semantic vector, the sample context sentence and the sample query sentence until the deep learning model converges, and the trained deep learning model is used as the third language model.
[0122] In the disclosed embodiment, the third largest language model and the first largest language model may be the same model or different models, and there is no limitation on this.
[0123] In the disclosed embodiment, the third largest language model and the second largest language model may be the same model or different models, and there is no limitation on this.
[0124] For example, after obtaining the context semantics, the target data table information, initial semantic vector, and context semantics can be input into the third language model at the same time, so that the third language model analyzes the target data table information, initial semantic vector, and context semantics and outputs the target query statement.
[0125] In some embodiments, the target query statement is a structured query statement, such as a Structured Query Language (SQL) statement.
[0126] In some embodiments, after the third language model outputs the target query statement, the target query statement can be provided to the AI Agent, and the AI Agent executes subsequent steps.
[0127] Step S306: Obtain a target query result corresponding to the target query statement based on the AI Agent.
[0128] In some embodiments, after the AI Agent learns the target query sentence output by the third language model, it can perform a query based on the target query sentence to obtain a target query result.
[0129] In this embodiment, by obtaining an initial query statement, and processing the initial query statement based on AI, an initial semantic vector is obtained, the initial semantic vector and the initial query statement are processed based on AI to determine the target data table information, the initial semantic vector and the target data table information are processed based on AI to obtain the target query statement, and the target query result corresponding to the target query statement is obtained based on AI Agent. Based on AI, RPA and AI Agent technologies, query statements can be generated conveniently to improve generation efficiency and effect. By processing the initial semantic vector based on AI, the contextual semantics between different initial field information can be identified from the initial semantic vector, and the target data table information, the initial semantic vector and the contextual semantics are processed based on the third language model to obtain the target query statement. It can improve the generation accuracy of the target query statement, thereby supporting the query to obtain accurate target query results, so that the target query results are more in line with the query intent of the initial query statement.
[0130] The examples for the above embodiment are as follows:
[0131] Natural language processing technology and big data analysis can be combined to automatically generate SQL query statements using the large language model (LLM). Users only need to enter natural language descriptions to generate corresponding SQL query statements and execute data queries. In addition, after obtaining the query results, the large model can be called to generate user-friendly natural language responses, greatly reducing the threshold for use. Figure 4 As shown, Figure 4 This is a schematic diagram of the application of the embodiment of the present disclosure. The specific implementation process is as follows:
[0132] 1. Offline data preparation.
[0133] Establishment of the semantic representation vector library of the data table: read all tables and their field information in the database, and assemble the information of each table as follows:
[0134] table: student, including the fields: name (student name), id (student id), english_score (English score), math_score (math score), chinese_score (Chinese score);
[0135] table: class, including fields: id (class id), name (class name), grade (grade);
[0136] table: student_class, including fields: id (association id), student_id (student id), class_id (class id). Encode each assembled table information through the language model and save it to the table semantic representation vector library.
[0137] Create a data table name list: read all table names in the database and save them as a list.
[0138] 2. Query online.
[0139] User input of natural language query: The user inputs a natural language query statement on the interface, such as "What is Li San's total score?".
[0140] Get candidate data table list 1: The system calls the trained large language model to convert the natural language query into a query statement semantic vector q, calculates the cosine similarity between the vector q and all vector representations in the data table semantic representation library, and selects the top 5 data tables with the highest similarity as candidate data list 1.
[0141] Get candidate data table list 2: In order to better recall the candidate data list, the prompt project is used to enable the large language model to generate the names of the five data tables that may be needed for the current query. The prompt example is:
[0142] """Based on the following query problem, give 5 data tables that may need to be used in SQL query.
[0143] Question: {What is Li San's total score?}
[0144] Data table name: {student, class, student_class, teacher, ...}
[0145] Related data sheets: """.
[0146] 3. Generate SQL statements.
[0147] De-duplicate candidate data tables 1 and 2 to generate the final data table list, and organize prompts to access the large model to generate corresponding query statements. The prompt example is:
[0148] prompt="'There are three tables: student table, including fields name (student name), id (student id), english_score (English score), math_score (math score), chinese_score (Chinese score); class table, including fields id (class id), name (class name), grade (grade); student_class association table, including fields id (association id), student_id (student id), class_id (class id).
[0149] Please generate the query SQL for the question "What is Li San's total score?" based on the above schema information.
[0150] 4. SQL syntax check.
[0151] Perform syntax check on the generated SQL statements to ensure the correctness of the SQL statements. If the syntax check finds errors in the SQL statements, the error message can be added to the generated prompt to require the large model to correct the SQL statements.
[0152] 5. Execute SQL query.
[0153] If the SQL syntax check passes, the SQL query is executed to query the database and obtain the results.
[0154] 6. Generate natural language results.
[0155] Based on the query results and the initial query, LLM is called to generate natural language results and displayed to the user. Through this process, users do not need to understand complex SQL syntax, but only need to enter natural language queries to quickly obtain the required data.
[0156] The query method based on AI, RPA and AI Agent provided by the present disclosure has good ease of use and greatly reduces the threshold for use. By parsing user intent through LLM, the generated queries are more accurate and human errors are reduced. The time for manual writing and debugging queries is greatly reduced, and work efficiency is improved. It can handle a variety of query requirements, is not restricted by predefined templates, and is more adaptable. By automatically optimizing the generated queries, the database query performance is improved to ensure a quick response. It not only improves the user experience, but also significantly improves the query efficiency and accuracy, providing strong support for the company's data analysis and decision-making.
[0157] The query method based on AI, RPA and AI Agent provided in the embodiments of the present disclosure can be applied to a digital employee development assistant (digital employee development intelligent assistant), wherein the digital employee development assistant has intelligent data processing capabilities and an automated code generation mechanism. It can automatically parse and process complex data sets, reducing reliance on manual programming, thereby reducing labor costs. In addition, the extended command library of the digital employee development assistant can quickly generate computer program code that seamlessly connects with RPA products, improves the code reuse rate, and shortens the development cycle. In addition, the "self-healing" function of the digital employee development assistant can automatically adapt to changes in the user interface, reducing maintenance work and related costs caused by interface updates. When the query method based on AI, RPA and AI Agent is applied to the digital employee development assistant, the digital employee development assistant can conveniently generate query statements and improve generation efficiency and effects with the assistance of AI, RPA and AI Agent technologies.
[0158] Figure 5 It is a structural diagram of a query device based on AI, RPA and AI Agent provided by an embodiment of the present disclosure.
[0159] like Figure 5 As shown, the query device 50 based on AI, RPA and AI Agent includes:
[0160] The first acquisition module 501 is used to acquire an initial query statement.
[0161] The first processing module 502 is used to process the initial query statement based on AI to obtain an initial semantic vector.
[0162] The second processing module 503 is used to process the initial semantic vector and the initial query statement based on AI to determine the target data table information.
[0163] The third processing module 504 is used to process the initial semantic vector and the target data table information based on AI to obtain a target query statement.
[0164] The second acquisition module 505 is used to acquire the target query result corresponding to the target query statement based on the AI Agent.
[0165] In some embodiments of the present disclosure, the device is applied to an RPA robot.
[0166] In some embodiments of the present disclosure, the first processing module is specifically configured to:
[0167] identifying at least one initial field information from the initial query statement based on the first language model;
[0168] Encode each initial field information to obtain the corresponding field code;
[0169] An initial semantic vector is generated according to at least one field encoding.
[0170] In some embodiments of the present disclosure, the second processing module includes:
[0171] A first processing unit, configured to process the initial semantic vector based on AI to obtain a first number of first reference data table information;
[0172] A second processing unit, configured to process the initial query statement based on AI to obtain a second number of second reference data table information;
[0173] The third processing unit is used to perform deduplication processing on the first number of first reference data table information and the second number of second reference data table information, and use the retained first reference data table information and / or second reference data table information as target data table information.
[0174] In some embodiments of the present disclosure, the first processing unit is specifically configured to:
[0175] Acquire multiple candidate semantic vectors from a semantic representation vector library, wherein each candidate semantic vector has corresponding candidate data table information;
[0176] Determine the similarity between the initial semantic vector and each candidate semantic vector based on the first language model;
[0177] Sorting multiple similarities, and selecting a first number of first similarities that are ranked first;
[0178] The candidate data table information corresponding to the candidate semantic vector to which the first similarity belongs is used as the first reference data table information.
[0179] In some embodiments of the present disclosure, the second processing unit is specifically configured to:
[0180] The initial query statement is input into the second largest language model to obtain a second number of second reference data table information output by the second largest language model, wherein the second largest language model has modeled and learned the mapping relationship between the initial query statement and the second number of second reference data table information.
[0181] In some embodiments of the present disclosure, the initial semantic vector includes: at least one field code, where the field code is obtained by encoding initial field information in the initial query statement;
[0182] Wherein, the third processing module is specifically used for:
[0183] Processing the initial semantic vector based on AI to identify contextual semantics between different initial field information from the initial semantic vector;
[0184] The target data table information, initial semantic vector and context semantics are processed based on the third language model to obtain the target query statement.
[0185] In some embodiments of the present disclosure, the apparatus further comprises:
[0186] A checking module is used to perform a syntax check on the target query statement and obtain a check result;
[0187] The second acquisition module is specifically used for:
[0188] In response to the check result indicating that the syntax check of the target query statement passes, obtaining a target query result corresponding to the target query statement based on the AI Agent;
[0189] In response to the check result indicating that the grammatical check of the target query statement fails, the target query statement is updated to obtain a new target query statement, until the grammatical check of the new target query statement passes, and a target query result corresponding to the new target query statement is obtained based on the AI Agent.
[0190] The functions of each module in each device in the embodiments of the present disclosure can be found in the corresponding description of any of the above methods, and will not be repeated here.
[0191] It should be noted here that the query device based on AI, RPA and AI Agent provided by the embodiment of the present disclosure can implement all the method steps implemented by any of the above-mentioned method embodiments, and can achieve the same technical effects. The parts and beneficial effects of this embodiment that are the same as the method embodiment will not be described in detail here.
[0192] In this embodiment, by obtaining an initial query statement, and processing the initial query statement based on AI, an initial semantic vector is obtained, the initial semantic vector and the initial query statement are processed based on AI to determine the target data table information, the initial semantic vector and the target data table information are processed based on AI to obtain the target query statement, and the target query result corresponding to the target query statement is obtained based on AI Agent. Based on AI, RPA and AI Agent technologies, query statements can be generated conveniently and the generation efficiency and effect can be improved.
[0193] Figure 6 FIG. 1 is a block diagram showing a structure of an electronic device according to an embodiment of the present disclosure. Figure 6As shown, the electronic device includes: a memory 610 and a processor 620, and the memory 610 stores a computer program that can be run on the processor 620. When the processor 620 executes the computer program, the query method based on AI, RPA and AI Agent in the above-mentioned embodiment is implemented. The number of the memory 610 and the processor 620 can be one or more. The electronic device also includes: a communication interface 630, which is used to communicate with external devices and perform data exchange transmission.
[0194] If the memory 610, the processor 620 and the communication interface 630 are implemented independently, the memory 610, the processor 620 and the communication interface 630 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0195] Optionally, in a specific implementation, if the memory 610, the processor 620 and the communication interface 630 are integrated on a chip, the memory 610, the processor 620 and the communication interface 630 can communicate with each other through an internal interface.
[0196] An embodiment of the present disclosure provides a computer-readable storage medium storing a computer program, which implements the method provided in any embodiment of the present disclosure when the program is executed by a processor.
[0197] An embodiment of the present disclosure also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes a method provided by any embodiment of the present disclosure.
[0198] The embodiment of the present disclosure also provides a chip, including: an input interface, an output interface, a processor and a memory. The input interface, the output interface, the processor and the memory are connected through an internal connection path. The processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.
[0199] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the advanced RISC machines (ARM) architecture.
[0200] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM).
[0201] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present disclosure is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
[0202] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.
[0203] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0204] Any process or method description described in the flowchart or otherwise herein can be understood to represent a module, segment or portion of code including one or more executable instructions for implementing the steps of a specific logical function or process. And the scope of the preferred embodiments of the present disclosure includes other implementations, in which the functions may not be performed in the order shown or discussed, including in a substantially simultaneous manner or in a reverse order according to the functions involved.
[0205] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0206] It should be understood that the various parts of the present disclosure may be implemented with hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods may be implemented with software or firmware stored in a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method may be completed by instructing the relevant hardware through a program, which may be stored in a computer-readable storage medium, and when the program is executed, includes one or a combination of the steps of the method embodiment.
[0207] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the above-mentioned integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a disk or an optical disk, etc.
[0208] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A query method based on artificial intelligence AI, robotic process automation RPA and digital labor platform intelligent assistant AIAgent, characterized in that: include: Get the initial query statement; Processing the initial query statement based on AI to obtain an initial semantic vector; Processing the initial semantic vector and the initial query statement based on AI to determine target data table information; Processing the initial semantic vector and the target data table information based on AI to obtain a target query statement; A target query result corresponding to the target query statement is obtained based on the AIAgent.
2. The method according to claim 1, characterized in that: The method is performed by an RPA robot.
3. The method according to any one of claims 1 to 2, characterized in that: The AI-based processing of the initial query statement to obtain an initial semantic vector includes: identifying at least one initial field information from the initial query statement based on the first language model; Encode each of the initial field information to obtain a corresponding field code; The initial semantic vector is generated according to at least one of the field codes.
4. The method according to any one of claims 1 to 2, characterized in that: The AI-based processing of the initial semantic vector and the initial query statement to determine target data table information includes: Processing the initial semantic vector based on AI to obtain a first number of first reference data table information; Processing the initial query statement based on AI to obtain a second number of second reference data table information; The first number of first reference data table information and the second number of second reference data table information are deduplicated, and the retained first reference data table information and / or second reference data table information are used as the target data table information.
5. The method according to claim 4, characterized in that The AI-based processing of the initial semantic vector to obtain a first number of first reference data table information includes: Acquire multiple candidate semantic vectors from a semantic representation vector library, wherein each candidate semantic vector has corresponding candidate data table information; Determine the similarity between the initial semantic vector and each candidate semantic vector based on the first language model; Sorting the plurality of similarities, and selecting a first number of first similarities that are ranked first; The candidate data table information corresponding to the candidate semantic vector to which the first similarity belongs is used as the first reference data table information.
6. The method according to claim 4, characterized in that The AI-based processing of the initial query statement to obtain a second number of second reference data table information includes: The initial query statement is input into a second largest language model to obtain a second number of second reference data table information output by the second largest language model, wherein the second largest language model has modeled and learned the mapping relationship between the initial query statement and the second number of second reference data table information.
7. The method according to any one of claims 1-2, characterized in that: The initial semantic vector includes: at least one field code, where the field code is obtained by encoding the initial field information in the initial query statement; The AI-based processing of the initial semantic vector and the target data table information to obtain a target query statement includes: Processing the initial semantic vector based on AI to identify contextual semantics between different initial field information from the initial semantic vector; The target data table information, the initial semantic vector and the context semantics are processed based on the third language model to obtain the target query statement.
8. The method according to any one of claims 1-2, characterized in that: Before obtaining the target query result corresponding to the target query statement based on the AIAgent, the method further includes: Performing a grammar check on the target query statement to obtain a check result; Wherein, obtaining the target query result corresponding to the target query statement based on the AI Agent includes: In response to the check result indicating that the syntax check of the target query statement passes, obtaining a target query result corresponding to the target query statement based on the AI Agent; In response to the check result indicating that the grammatical check of the target query statement fails, the target query statement is updated to obtain a new target query statement, until the grammatical check of the new target query statement passes, and a target query result corresponding to the new target query statement is obtained based on the AIAgent.
9. A query device based on artificial intelligence AI, robotic process automation RPA and digital labor platform intelligent assistant AIAgent, characterized in that: include: A first acquisition module, used to acquire an initial query statement; A first processing module, configured to process the initial query statement based on AI to obtain an initial semantic vector; A second processing module, configured to process the initial semantic vector and the initial query statement based on AI to determine target data table information; A third processing module is used to process the initial semantic vector and the target data table information based on AI to obtain a target query statement; The second acquisition module is used to acquire a target query result corresponding to the target query sentence based on the AIAgent.
10. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Data query method and device based on RPA and AI, medium and computing equipment
CN112069206A
Structured query language generation method and device, electronic equipment and storage medium
CN118093621A
Tool routing method and device
CN118246474A
RPA process execution code generation method and device based on AI and AI Agent
CN118444894A
Adaptive query expression builder for an on-demand data service
US20080195610A1
Cited By
Method and device for generating SQL (Structured Query Language) based on semantic alignment and hierarchical Agent
CN119377255A
Querying system for spatial data based on natural language and querying method for the same
TWI934742B
