Question and answer intelligent agent-based knowledge retrieval method and device, equipment and medium
By using a knowledge retrieval method based on question-answering agents, metadata is automatically obtained and database operation statements are generated, solving the problem of time-consuming and labor-intensive conversion of descriptive information into database operation statements, and achieving efficient and accurate generation of database operation statements.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING VOLCANO ENGINE TECH CO LTD
- Filing Date
- 2026-05-09
- Publication Date
- 2026-07-14
AI Technical Summary
In existing technologies, the process of converting caliber description information into database operation statements is time-consuming, labor-intensive, and has high human resource costs. In particular, when the caliber description information is unclear, the workload is large and the efficiency is low.
A knowledge retrieval method based on question-answering agents is adopted. By obtaining the definition information, the question-answering agent is used to determine the metadata requirements, the tool is called to obtain the metadata, and database operation statements are generated based on the metadata and definition information.
It enables automatic acquisition of metadata and automatic generation of database operation statements, improving the flexibility of metadata acquisition and the accuracy of database operation statements, reducing noise from irrelevant information, and improving work efficiency.
Smart Images

Figure CN122387997A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a knowledge retrieval method based on a question-answering agent, a knowledge retrieval device based on a question-answering agent, an electronic device, and a non-transitory computer-readable storage medium. Background Technology
[0002] To ensure that data remains consistent in meaning, calculation, comparison, and reproducibility across different systems, personnel, and times, standardized descriptive information can be used to regulate data processing logic. For example, database manipulation statements can be used to extract data from the database and then process that data to implement the processing logic.
[0003] Typically, data professionals need to translate this descriptive information into database operation statements based on historical experience and business knowledge. This process is usually time-consuming, labor-intensive, and has high human resource costs. Summary of the Invention
[0004] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] At least one scenario provides a knowledge retrieval method based on a question-answering agent, comprising: acquiring caliber description information; and providing the caliber description information to the question-answering agent, acquiring a first database operation statement generated by the question-answering agent through a first processing of the caliber description information, the first database operation statement corresponding to the caliber description information, and the first database operation statement being used for knowledge retrieval; wherein the first processing includes: determining the requirement information of first metadata based on the caliber description information, the first metadata including the metadata required to generate the first database operation statement; based on the requirement information, at least invoking a tool to acquire the first metadata; and generating the first database operation statement based on the first metadata and the caliber description information.
[0006] At least one other scenario provides a knowledge retrieval device based on a question-answering agent, comprising: an information acquisition module configured to acquire caliber description information; and a statement acquisition module configured to: provide the caliber description information to the question-answering agent, acquire a first database operation statement generated by the question-answering agent through a first processing of the caliber description information, the first database operation statement corresponding to the caliber description information, and the first database operation statement being used for knowledge retrieval; wherein the first processing includes: determining the requirement information of first metadata based on the caliber description information, the first metadata including the metadata required to generate the first database operation statement; at least invoking a tool to acquire the first metadata based on the requirement information; and generating the first database operation statement based on the first metadata and the caliber description information.
[0007] At least one scenario provides an electronic device comprising: a processor; and a memory storing one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to perform the knowledge retrieval method based on a question-answering agent provided in at least one scenario herein.
[0008] At least one further embodiment provides a non-transitory computer-readable storage medium for non-transitory storage of computer-readable instructions, wherein the knowledge retrieval method based on question-answering agents provided in at least one embodiment of this paper is implemented when the computer-readable instructions are executed by a processor.
[0009] At least one scenario provides a computer program product, including a computer program / instruction that, when run on a computer, causes the computer to perform the knowledge retrieval method based on a question-answering agent provided in at least one scenario herein. Attached Figure Description
[0010] The above and other features, advantages, and aspects of the various scenarios described below will become more apparent when taken in conjunction with the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0011] Figure 1 The diagram illustrates an application scenario of a knowledge retrieval method and apparatus based on a question-answering agent, provided in at least one of the following situations:
[0012] Figure 2 The flowchart illustrates a knowledge retrieval method based on a question-answering agent for at least one scenario.
[0013] Figure 3 The schematic diagram illustrates the principle of obtaining the first metadata in at least one scenario;
[0014] Figure 4 The diagram illustrates the principle of generating database operation statements in at least one scenario.
[0015] Figure 5 The illustration shows a schematic diagram of the principle of generating database operation statements in at least another scenario;
[0016] Figure 6 This diagram illustrates the workflow of a question-answering agent generating database operation statements corresponding to caliber description information.
[0017] Figure 7 The schematic diagram illustrates the structural block diagram of a knowledge retrieval device based on a question-answering agent, provided in at least one scenario; and
[0018] Figure 8 A schematic diagram of an electronic device suitable for implementing a knowledge retrieval method based on a question-answering agent is shown. Detailed Implementation
[0019] The present invention will now be described in more detail with reference to the accompanying drawings. While some aspects of the present invention are illustrated in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the aspects set forth herein; rather, these aspects are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the accompanying drawings and aspects are for illustrative purposes only and are not intended to limit the scope of this invention.
[0020] It should be understood that the steps described in the method embodiments herein may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this document is not limited in this respect.
[0021] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one situation" means "at least one situation"; the term "another situation" means "at least one additional situation"; the term "some situations" means "at least some situations". Definitions of other terms will be given in the following description.
[0022] It should be noted that the concepts of "first" and "second" mentioned in this article are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions performed by these devices, modules or units or their interdependencies.
[0023] It should be noted that the terms "one" and "more" used in this document are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0024] The names of messages or information exchanged between multiple devices in the embodiments herein are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0025] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition, use, storage or deletion of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0026] It is understood that before using the technical solutions provided in each scenario in this article, relevant users should be informed of the type, scope of use, and usage scenarios of the information involved in this article and their authorization should be obtained through appropriate means in accordance with relevant laws and regulations. Relevant users may include any type of rights holder, such as individuals, enterprises, or groups.
[0027] After the business department provides the descriptive information, data professionals need to confirm the business meaning of the fields / indicators involved in the descriptive information based on historical experience and business knowledge, clarify the calculation logic, and align the data sources to obtain the metadata required to convert the descriptive information into database operation statements. However, this process is often time-consuming and labor-intensive, especially when the descriptive information provided by the business department is unclear. The amount of information that data professionals need to query will increase significantly, and the workload will increase significantly, which will undoubtedly reduce the efficiency of converting database operation statements.
[0028] To at least partially address at least some of these technical problems, this paper provides a knowledge retrieval method based on a question-answering agent in at least one scenario. The method includes: acquiring caliber description information; providing the caliber description information to the question-answering agent, and acquiring a first database operation statement generated by the question-answering agent through a first processing of the caliber description information, the first database operation statement corresponding to the caliber description information and used for knowledge retrieval; wherein the first processing includes: determining requirement information for first metadata based on the caliber description information, the first metadata including metadata required to generate the first database operation statement; based on the requirement information, at least invoking a tool to acquire the first metadata; and generating a first database operation statement corresponding to the caliber description information based on the first metadata and the caliber description information.
[0029] Based on the question-answering agent-based knowledge retrieval method provided in at least one of the embodiments described herein, at least one of the embodiments described herein also provides a question-answering agent-based knowledge retrieval device, electronic device, and non-transient computer-readable storage medium.
[0030] This paper presents a knowledge retrieval method based on a question-answering agent, which provides descriptive information to the agent. The agent then determines the metadata needed to generate database operation statements based on this descriptive information. This method obtains the metadata by calling a tool and generates the database operation statements based on the metadata. This enables automatic acquisition of metadata and automatic generation of database operation statements. Furthermore, obtaining metadata by calling a tool allows for the acquisition of more targeted information, improving the flexibility of metadata acquisition and avoiding noise caused by irrelevant information, thus improving the accuracy of the obtained database operation statements.
[0031] The following detailed description, with reference to the accompanying drawings, illustrates the situation described in this article and provides some examples.
[0032] Figure 1 The diagram illustrates an application scenario of a knowledge retrieval method and apparatus based on a question-answering agent, provided in at least one scenario.
[0033] like Figure 1 As shown, this application scenario 100 can involve terminal device 110 and user 120. Terminal device 110 can be various electronic devices capable of providing an interactive interface, such as smart wearable devices, smart appliances, smart cars, mobile phones, tablets, laptops, or desktop computers.
[0034] For example, terminal device 110 has a client application installed. This client application includes at least an Artificial Intelligence (AI) application, or a client application providing AI-related mini-programs, or a client application providing intelligent agents. An intelligent agent is, for example, an entity / program based on AI technology that possesses autonomous perception, decision-making, and execution capabilities. User 120 can input caliber description information through the client application to clarify at least part of the data meaning, statistical scope, business boundaries, etc. The client application can process this caliber description information to obtain database operation statements corresponding to the caliber description information and output these database operation statements for user 120 to view. The caliber description information input by user 120 is not necessarily clear, complete, or unambiguous; it can be understood as information explaining the data caliber. Data caliber includes, for example, the statistical rules and definition standards of the data. If the data caliber is different, the data results obtained by executing the database operation statements for the same business will be different.
[0035] In at least one case, such as Figure 1As shown, application scenario 100 may also involve server 130, which can be a background management server that supports the operation of client applications installed in terminal device 110. The background management server can be used to run intelligent agents. Server 130 can be, for example, a server for local area network or wide area network, or a cloud server, etc. This article does not limit it.
[0036] In at least one scenario, terminal device 110 can send the caliber description information input by user 120 through a client application to server 130. Server 130 processes the caliber description information, generates a database operation statement corresponding to the caliber description information, and returns the database operation statement to terminal device 110 for display. In at least another scenario, terminal device 110 can also respond to user operations by initiating a knowledge retrieval request to a knowledge base or database based on the database operation statement, in order to retrieve the data required by the user from the database or knowledge base.
[0037] For example, the knowledge retrieval method based on question-answering agents provided in at least one of the scenarios described in this paper can be implemented in software, hardware, firmware, or any combination thereof.
[0038] For example, the question-answering agent-based knowledge retrieval method provided in at least one scenario of this paper is applicable to a terminal device or server. This terminal device or server can load and execute the question-answering agent-based knowledge retrieval method, and this paper does not impose any limitations on this. For example, the terminal device or server may include a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processor (DSP), Neural Processing Unit (NPU), or other processing units with data processing capabilities and / or instruction execution capabilities, storage units, etc. The terminal device or server may also have an operating system and various types of application programming interfaces (APIs) (e.g., OpenGL (Open Graphics Library), Metal, etc.), etc., installed, and implement the question-answering agent-based knowledge retrieval method provided in each scenario of this paper by running code or instructions.
[0039] The following will combine Figures 2-6 The knowledge retrieval method based on question-answering agents provided in at least one of the scenarios described in this paper is described in detail.
[0040] Figure 2 A flowchart illustrating a knowledge retrieval method based on a question-answering agent is shown in at least one scenario.
[0041] In at least one of the following circumstances, such as Figure 2As shown, the knowledge retrieval method based on question-answering agents includes steps S210 to S220.
[0042] Step S210: Obtain caliber description information.
[0043] Step S220: Provide the caliber description information to the question-answering agent, and obtain the first database operation statement generated by the question-answering agent through the first processing of the caliber description information. The first database operation statement corresponds to the caliber description information and is used for knowledge retrieval. The first processing includes steps S221 to S223.
[0044] Step S221: Based on the caliber description information, determine the requirement information of the first metadata, which includes the metadata required to generate the first database operation statement.
[0045] Step S222: At least call the tool to obtain the first metadata.
[0046] Step S223: Generate the first database operation statement based on the first metadata and caliber description information.
[0047] In at least one scenario, the caliber description information can be either input text information or text information obtained by converting input speech information. Calibration description information describes the caliber of data, including, for example, information explaining at least one of the following: the meaning of data, indicators, fields, statistical range, calculation rules, time dimension, business boundaries, and units.
[0048] In at least one scenario, descriptive information can be input into the question-answering agent, which then outputs the first database operation statement. The agent, for example, is a large model agent, a smart system with a large model as its core decision-making unit. It possesses autonomous perception, goal understanding, task planning, tool invocation, execution feedback, and self-correction capabilities, enabling it to independently complete complex tasks without gradual human intervention. A large model, for example, refers to a basic artificial intelligence model trained on massive amounts of data with a huge parameter scale. Its core function is to serve as the core engine for information processing and knowledge computation, capable of understanding natural language, generating content, performing logical reasoning, and parsing code. Large models include, for example, any one or a combination of large language models, large visual models, large audio models, and multimodal large models. A question-answering agent is, for example, an agent capable of engaging in dialogue with the user; this is not limited to this definition in this paper.
[0049] In at least one scenario, the caliber description information and the system prompt can be concatenated into an input sequence in a fixed format. This input sequence is then fed into a question-answering agent, which outputs a first database operation statement. The system prompt, for example, is a pre-defined instructional text used to define the agent's identity, behavioral rules, output format, constraints, and interaction logic, serving as the basic constraints and instructions for the large model to perform its tasks. For instance, the question-answering agent performs initial processing on the caliber description information based on the system prompt.
[0050] For example, system prompts include task description information and execution rule information. Task description information, for instance, describes the basic definition of the task that converts descriptive information into database operation statements. Execution rule information, such as the specific steps for executing the task, tool invocation rules, and output rules, guides the question-answering agent to more accurately and efficiently invoke tools and output content that better meets user needs.
[0051] In at least one context, metadata can be understood as data that describes data. The requirement information for the first metadata includes at least one of the following: the type of the first metadata, the source scope of the metadata, and the granularity of the metadata. This requirement information can serve as the basis for obtaining the first metadata. The metadata required to generate the first database operation statement includes at least one of the following: database structure metadata, semantic metadata, or database environment information. Database structure metadata includes at least one of the following: table structure, relationships between tables, and constraints. Table structure includes, for example, table name, list name, and column data types. Semantic metadata includes, for example, field aliases, table aliases, field descriptions, and business rules. A field alias can be understood as a natural language alias for a field; a table alias can be understood as the commonly used name of a table; a field description can be understood as the business meaning of the field, such as the description of the sales_amount field as "single sales amount"; business rules include at least one of the following: data range rules or aggregation rules. Aggregation rules include, for example, rules for summation, averaging, or maximum value.
[0052] In at least one scenario, if the definition is set as "find customers whose sales exceeded 1 million in 2023," then the required metadata information includes, for example: metadata field name: sales revenue; time range of sales revenue: 2023; value range of sales revenue: greater than 1 million; data object: sales details table, etc. It is understood that the above definition and the first metadata requirement information are merely examples to aid understanding of this document, and this document does not impose any limitations on them.
[0053] In at least one context, the tools invoked by the agent can refer to all callable functional components, including application programming interfaces (APIs), plugins, services, and functional modules. For example, the tools invoked by a question-answering agent when obtaining initial metadata may include at least one of a database retrieval tool, a table parsing tool, or a data reading tool. A database retrieval tool may be used to retrieve data tables included in a database; a table parsing tool may be used to parse the data tables to obtain their structure; and a data reading tool may be used to read the values of fields from the data table based on their names.
[0054] In at least one scenario, the tools that the question-answering agent needs to invoke are determined, for example, by the agent's requirements based on the first metadata and the tool invocation rules described in the system prompts. For instance, if the first metadata includes metadata of table structure types, the tools that need to be invoked include database retrieval tools and table parsing tools.
[0055] In at least one scenario, before obtaining the first metadata, the caliber description information can be parsed to obtain the metadata required to generate the first database operation statement, which is included in the caliber description information. In at least one scenario, all metadata other than the metadata included in the caliber description information from all metadata required to generate the first database operation statement can be used as the first metadata.
[0056] In at least one scenario, the metadata included in the caliber description information and the acquired first metadata can constitute a metadata dataset. The question-answering agent can generate a first database operation statement based on this metadata dataset and the syntax rules of database operation statements. For example, a database operation statement is an executable text instruction that follows the syntax rules of a Database Manipulation Language (MQL) and is used to perform operations such as querying, adding, modifying, deleting, and creating / deleting structures on a database (or its data or objects). The database operation language can be Structured Query Language (SQL) or Meta Query Language (MQL), etc.
[0057] In at least one scenario, the first database operation statement is, for example, a query statement, a data write / update statement, or a data definition statement. In at least another scenario, the first database operation statement is a data retrieval SQL statement. A data retrieval SQL statement is, for example, a Structured Query Language (SQL) statement used to extract, filter, process, and statistically analyze data from a database. Its core purpose is to transform raw data stored in the database into valuable information according to business needs. For example, this first database operation statement is used for knowledge retrieval. Knowledge retrieval, for example, refers to the process of quickly finding and obtaining knowledge, information, or answers related to user needs from structured or unstructured knowledge bases, databases, etc.
[0058] This paper presents a knowledge retrieval method based on a question-answering agent, which provides descriptive information to the agent. The agent then determines the metadata needed to generate database operation statements based on this descriptive information. This method obtains the metadata by calling a tool, and generates database operation statements based on the metadata and descriptive information. This enables automatic acquisition of metadata and automatic generation of database operation statements. Furthermore, obtaining metadata by calling a tool allows for the acquisition of more targeted information, improving the flexibility of metadata acquisition and avoiding the acquisition of irrelevant information that could generate noise, thus improving the accuracy of the obtained database operation statements.
[0059] In at least one scenario, if all the metadata required to generate the first database operation statement can be obtained by parsing the caliber description information, then the question-answering agent can directly generate the first database operation statement based on the metadata included in the caliber description information without needing to call tools to obtain the metadata. For example, if the caliber description information is set as "total GMV (Gross Merchandise Volume) of live streams in the past 10 days, averaged using the payment amount field of the xx dataset, and filtered by the live stream field," then all the metadata required to generate the first database operation statement includes: XX dataset, payment amount, whether it is a live stream, time range: the difference between the current time and the time interval of 10 days, filtering condition: live stream scenario, aggregation logic: SUM (payment amount), AVG (payment amount). All of this metadata can be obtained by parsing the caliber description information. It is understood that the above caliber description information and metadata are only examples to facilitate understanding of this article, and this article does not limit them.
[0060] In at least one scenario, after determining the requirement information for the first metadata, the question-answering agent can first determine the first tool to be invoked from among multiple preset tools based on the requirement information and generate first invocation information for the first tool. Subsequently, the first tool is invoked based on the first invocation information, and the first feedback information returned by the first tool is obtained. Finally, the first metadata is obtained based at least on the first feedback information.
[0061] In at least one scenario, the first tool to be invoked can be determined based on the tool functions of multiple preset tools and the requirement information of the first metadata, and the first invocation information for the first tool can be generated according to the invocation logic of the first tool and the requirement information of the first metadata.
[0062] In at least one scenario, the tool functions and invocation logic that a question-answering agent can invoke can be configured through system prompts, tool configurations, tool metadata, etc. For example, a tool schema can be integrated into the system prompts, enabling the question-answering agent to generate compliant invocation information (also known as tool invocation instructions) based on the schema specification. A tool schema is, for example, structured information describing the tool's functions, invocation format, parameter structure, parameter types, constraints, return format, etc.
[0063] In at least one scenario, multiple pre-defined tools, including a dataset retrieval tool, are configured to retrieve a first dataset matching a first search term and return the dataset identifier of the first dataset. The invocation information for the dataset retrieval tool includes the first search term. The dataset retrieval tool functions to retrieve datasets related to the search term. Its invocation logic involves inputting the search term and outputting the dataset identifier, which may be at least one of the following: dataset name, storage location, etc. In at least some scenarios, the input search term may be at least one of the following: dataset alias, field name, etc. For example, the dataset retrieval tool can match the search term with the description information of multiple datasets, and select the dataset with the highest match between its description information and the search term as the first dataset. By setting up a dataset retrieval tool, ambiguity can be eliminated in some colloquial information within the descriptive information, thereby facilitating the acquisition of more accurate metadata and improving the accuracy of generated database operation statements. For example, by setting the definition information to include the colloquial name of the dataset or an incorrect representation of the dataset, compared to directly identifying the dataset based on the colloquial name or the incorrect representation, retrieving the dataset by calling a dataset retrieval tool can avoid the inaccuracy of the dataset due to the ambiguity of the colloquial name or the incorrect representation, and can realize the reasoning verification of the definition information.
[0064] In at least one scenario, multiple pre-defined tools, such as a similar field retrieval tool, are configured to retrieve similar fields of a first field and return the similar fields. The invocation information for the similar field retrieval tool includes the first field. For example, the function of the similar field retrieval tool is to retrieve similar fields of an input field, and the invocation logic is to input the field and output the similar fields. In at least one scenario, the input to the similar field retrieval tool is, for example, the field name of the first field, and the output of the similar field retrieval tool is, for example, the field name of the similar field. In at least another scenario, the information output by the similar field retrieval tool may also include the data source where the similar field resides, such as a data table or dataset, to facilitate locating the similar field.
[0065] In at least one scenario, multiple pre-defined tools, including an operation statement acquisition tool, are configured to acquire and return a second database operation statement corresponding to a second field, serving as reference information for the question-answering agent to generate a first database operation statement. The invocation information for the operation statement acquisition tool includes the second field and the identification information of the data source containing the second field. The second database operation statement carries the data retrieval logic for the second field. For example, the operation statement acquisition tool may function to acquire the data retrieval logic SQL for a specific field in the construction SQL of a specific data source. This tool can provide the data retrieval logic SQL for a specific field as a reference for the question-answering agent to generate the target field's caliber SQL. For example, this operation statement acquisition tool can be implemented using a syntax parser or a large model. The invocation logic involves inputting the field and the identification information of the data source containing the field, and outputting the data retrieval logic SQL for the field. The data retrieval logic SQL can be understood as an executable SQL statement obtained by transforming business / analysis requirements; this SQL statement itself carries the specific data retrieval logic.
[0066] In at least one scenario, multiple pre-defined tools, including a metadata acquisition tool, are configured to acquire and return a third field in a data table associated with the caliber description information. The invocation information for the metadata acquisition tool includes the identification information of the data table. The functionality of this metadata acquisition tool includes, for example, providing the table structure of the dataset. The table structure of the dataset includes, for example, a set of fields, field types, data table description information, dataset partitions, and the dataset's primary key. For example, when the caliber description information specifies the source table of the data, the metadata acquisition tool can be used to acquire the fields in the source table and determine which fields are useful for generating database operation statements based on the caliber description information. The invocation logic of this metadata acquisition tool is as follows: input the identification information of the data table, and output the fields in the data table used to participate in the generation of database operation statements. For example, a question-answering agent can, even when the caliber description information only provides data table and other data source information but not the fields used for calculation, understand the structure of the data table by invoking this metadata acquisition tool and determine the fields required for the calculation logic. This reduces the requirement for the completeness of the caliber description information while generating database operation statements.
[0067] For example, the metadata acquisition tool is also configured to: determine the data processing function for the third field based on its type, and return the function information of the data processing function so that the question-answering agent can process the third field based on the data processing function. For example, if the third field is of type map, and includes multiple subfields (e.g., color and size subfields), the data processing function for the third field can include the `get_json_object` function to retrieve the color and / or size subfields from the third field. The function information can be the function name of the data processing function. In this way, the subfields in the third field can be obtained more accurately to generate database operation statements based on those subfields. By returning the function information of the processing function, the question-answering agent can have a clearer understanding of the data table construction, thereby facilitating the generation of more accurate database operation statements.
[0068] In at least one scenario, multiple pre-defined tools, including a field value acquisition tool, are configured to acquire and return a value example of a fourth field, with the invocation information for the field value acquisition tool including the fourth field. For example, the function of the field value acquisition tool is to acquire sample values of a field to enable the question-answering agent to better understand the internal structure of the dataset. For example, when a subfield of a mapping type field is the data source, the field value acquisition tool can be used to acquire the specific structure of the mapping type field. In at least another scenario, the invocation logic of the field value acquisition tool includes, for example, inputting a field and outputting a value example of the field. In some scenarios, at least when the input field is a mapping type field, in addition to the input field, function information for a data processing function targeting that field can also be passed in, so that the field value acquisition tool can acquire a value example of the field based on the data processing function, thereby improving the accuracy of the acquired value example.
[0069] In at least one scenario, multiple pre-defined tools may include at least two of the aforementioned dataset retrieval tools, similar field retrieval tools, operation statement acquisition tools, metadata acquisition tools, and field value acquisition tools. This allows the question-answering agent to process various types of descriptive information to generate database operation statements corresponding to different types of descriptive information. For example, when the question-answering agent determines that the calculation logic for a field in the descriptive information is missing or unclear, it can invoke the similar field retrieval tool and the operation statement acquisition tool to use the database operation statements corresponding to similar fields as reference information to determine the calculation logic of the field in the descriptive information, thereby generating the database operation statement corresponding to the descriptive information. Therefore, by setting up similar field retrieval tools and operation statement acquisition tools, database operation statements can be generated even when the calculation logic for a field in the descriptive information is missing or unclear, which helps improve the robustness of the question-answering agent.
[0070] In at least one scenario, when the first metadata includes multiple metadata, the question-answering agent can simultaneously invoke at least two tools to retrieve the multiple metadata in parallel. In this scenario, the first tool may include at least two of a plurality of preset tools.
[0071] In at least one scenario, after determining the first tool and the first invocation information for the first tool, the first invocation information is passed in, for example, by invoking the invocation interface provided by the first tool, and the invocation result returned by the invocation interface is received, with the invocation result serving as feedback information. For example, the first invocation information is generated by the core decision unit of the question-answering agent, and this first invocation information can be provided to the executor in the question-answering agent. The executor invokes the first tool based on the first invocation information and obtains the first feedback information returned by the first tool. Subsequently, the first feedback information can be input into the core decision unit, which parses the first feedback information to obtain the metadata included in the first feedback information. For example, the first metadata includes the metadata obtained by parsing the first feedback information.
[0072] Figure 3 The diagram illustrates the principle of obtaining the first metadata in at least one scenario.
[0073] In at least one scenario, when obtaining the first metadata based on at least the first feedback information, it can be first determined whether the first feedback information meets preset conditions. If the preset conditions are met, a second tool among multiple preset tools can be determined based on the first feedback information and the demand information, and second call information for the second tool can be generated. The second tool is then called based on the second call information to obtain the second feedback information returned by the second tool. Finally, the first metadata is obtained based on at least the first and second feedback information.
[0074] In at least one case, such as Figure 3 As shown, step S222, which involves calling a tool to obtain the first metadata, includes steps S3221 to S3224.
[0075] Step S3221: Based on the requirement information, determine the tool that needs to be called from among multiple preset tools and generate the calling information for that tool.
[0076] Step S3222: Invoke the tool based on the invocation information and obtain the feedback information returned by the tool.
[0077] Step S3223: Determine whether the feedback information meets the preset conditions. The feedback information in this step can be, for example, the feedback information obtained in step S3222, or all the feedback information obtained at the current moment. If the feedback information meets the preset conditions, return to step S3221; otherwise, proceed to step S3224.
[0078] Step S3224: Obtain first metadata based at least on the returned feedback information.
[0079] In at least one scenario, after receiving the returned feedback information, all the feedback information can be parsed to obtain the metadata included in the feedback information. Then, it is determined whether this metadata completely covers the first metadata. If not, the feedback information is determined to meet a preset condition. Otherwise, the feedback information is determined not to meet the preset condition, and all the first metadata is selected from the metadata included in the feedback information to obtain the first metadata.
[0080] In at least one scenario, upon returning to step S3221, step S3221 can determine the tool to be invoked based on the already obtained feedback information and demand information. For example, based on the already obtained feedback information, metadata not covered by the feedback information in the first metadata can be determined, and the tool to be invoked can be determined based on the demand information of the uncovered metadata. For example, the first preset condition includes: the first metadata includes metadata other than the metadata in the feedback information. In this scenario, metadata that still needs to be acquired can be determined first based on the obtained feedback information, and the tool to be invoked can be determined based on the demand information of the metadata that still needs to be acquired.
[0081] In at least one scenario, the first preset condition includes, for example, that the first tool returning the first feedback information includes a preceding tool, which includes the tool called earlier among two tools called in a call sequence. For example, when there is a dependency between the acquisition of at least two metadata items included in the first metadata, and the at least two dependent data items require different tools to be called for acquisition, or when the metadata in the first feedback information is intermediate data, and is data that the acquisition of a certain metadata item in the first metadata depends on, when determining the tool to be called based on the already obtained feedback information and requirement information, the tool to be called can be determined to be the tool called later among the two tools called in a call sequence. For example, the first tool is, for example, the tool called earlier among the two tools called in a call sequence (also called a preceding tool), and the second tool is, for example, the tool called later among the at least two tools.
[0082] In at least one scenario, the first preset condition includes, for example, that the correlation between the first feedback information and the demand information is lower than a predetermined correlation. For example, after obtaining the first feedback information, the matching degree between the metadata in the first feedback information and the demand information of the first metadata can be determined, and the correlation between the first feedback information and the demand information can be determined based on the matching degree. For example, the matching degree and the correlation are positively correlated. If the correlation is lower than the predetermined correlation, it indicates that the first feedback information is inaccurate. Then, when returning to the execution step S3221, the question-answering agent can re-determine the calling information of the called tool (first tool) based on the first feedback information and the demand information, and determine that the tool to be called is the first tool. By setting this preset condition, the question-answering agent can, for example, perform quality judgment and supplementation on the retrieved information. Compared with the technical solution of retrieving metadata based on the retrieval template, it can improve the flexibility and accuracy of obtaining metadata, thereby improving the accuracy of the generated database operation statements and improving the robustness of the question-answering agent.
[0083] In at least one of the following situations, the preset conditions mentioned in step S3223 include, for example, at least two of the following preset conditions described above: the tool returning feedback information includes a preceding tool, and the preceding tool includes the tool called first among two tools called in the order of invocation; the correlation between the feedback information and the demand information is lower than a predetermined correlation; the first metadata includes other metadata besides the metadata in the feedback information. By setting at least two preset conditions, the question-answering agent can dynamically adjust the metadata acquisition channel, thereby avoiding redundant noise while ensuring that the most complete metadata can be obtained by calling the tool, which is beneficial to improving the robustness of the question-answering agent and improving the accuracy of the generated database operation statements.
[0084] In at least one scenario, when determining which tool needs to be invoked, in addition to referring to the feedback and requirement information already obtained, the tool schemas of multiple preset tools are also referenced.
[0085] In at least one scenario, in the implementation of at least calling a tool to obtain the first metadata, the preset conditions may include, for example, that the number of feedback messages obtained is less than a predetermined number, or that new metadata belonging to the first metadata can be obtained based on the feedback messages obtained by calling the tool. The tool calls can be stopped when the number of tool calls is excessive or when no more new metadata can be obtained through tool calls. In this way, the tool calling logic of the question-answering agent can be constrained, avoiding redundant, repetitive, or unintentional tool calls, thereby reducing system overhead.
[0086] Figure 4 The diagram illustrates the principle of generating database operation statements in at least one scenario.
[0087] In at least one scenario, the step of invoking a tool to obtain first metadata based on the requirement information can first involve invoking the tool to obtain second metadata based on the requirement information. Subsequently, in response to the requirement that the metadata needed to generate the first database operation statement includes third metadata in addition to the second metadata, interactive guidance information for the third metadata is generated and output. Based on the response information input to the interactive guidance information, the third metadata is obtained. Through this at least one scenario, even when the descriptive information is insufficient and the complete metadata required to generate the database operation statement cannot be obtained even by invoking the tool, proactive clarification from the user can be sought, thereby facilitating the smooth generation of the database operation statement and improving its accuracy.
[0088] In at least one scenario, the second metadata obtained by calling the tool can be, for example, at the end of the process. Figure 3 The loop shown uses metadata derived from the acquired feedback information. For example, the acquired feedback information is parsed to obtain the metadata included in the acquired feedback information, and then metadata belonging to the first metadata is filtered out from this metadata to obtain the second metadata.
[0089] In at least one scenario, the interactive guidance information includes, for example, the requirement information of third-party metadata, such as the type and name of the third-party metadata, to guide the provider of the descriptive information (e.g., a user) to input the third-party metadata. For instance, the interactive guidance information is generated by the question-answering agent based on the requirement information corresponding to the third-party metadata in the requirement information of the first-party metadata. After obtaining the interactive guidance information, it can be output through the interactive interface of the question-answering agent. The response information input through the interactive interface after outputting the interactive guidance information is taken as the response information. The question-answering agent can parse this response information to obtain the metadata included in the response information, which serves as the third-party metadata.
[0090] In at least one scenario, after parsing the metadata included in the response information, the question-answering agent can match this metadata with the required information of third-party metadata to determine whether the response information is accurate. If it is inaccurate, it can continue to generate and output interaction guidance information until the third-party metadata can be obtained based on the input response information.
[0091] In at least one scenario, taking the question-answering agent as the large model agent as an example, the principle for obtaining the first metadata is as follows: Figure 4As shown. After obtaining the caliber description information 402 provided by user 410, the caliber description information 402 and the system prompt word 401 are input into the large model 421, which serves as the core decision-making unit of the question-answering agent. The large model 421 outputs the first metadata requirement information and the tool call information. Based on the tool call information, the question-answering agent executes step S422 to obtain information through environmental interaction. For example, based on the tool call information, it calls at least one of the following tools: dataset retrieval tool 431, similar field retrieval tool 432, operation statement acquisition tool 433, metadata acquisition tool 434, and field value acquisition tool 435, and obtains the feedback information returned by the at least one tool. Then, it parses the feedback information to obtain the metadata in the feedback information. For example, the question-answering agent can obtain metadata through multiple rounds of environmental interaction. Subsequently, the question-answering agent performs a completeness check on the obtained metadata, that is, checks whether the obtained metadata can cover all the metadata required to generate the database operation statement corresponding to the caliber description information. If the acquired metadata is incomplete, the question-answering agent executes step S423 to generate interaction guidance information and output the interaction guidance information to guide the user 410 to input response information 403 in response to the interaction guidance information. The response information is then input into the large model 421, which processes the response information to obtain the uncovered metadata. If the acquired metadata is complete, the question-answering agent executes step S424 to generate database operation statements corresponding to the caliber description information based on the acquired metadata.
[0092] In at least one scenario, during the process of the question-answering agent obtaining uncovered metadata (such as the aforementioned third metadata) based on the response information, step S422 can be executed again. For example, based on the response information and the requirement information for the third data, the tool to be invoked and the invocation information for that tool can be determined. The tool can then be invoked based on the invocation information to obtain feedback information, and the third metadata can be obtained based on the feedback information. In this way, even when the response information provided by user 410 is only the basis for obtaining the third metadata, the third metadata can be obtained by invoking the tool, thereby improving the interaction efficiency with the user, reducing the human cost required to generate database operation statements, and further enhancing the intelligence of the question-answering agent.
[0093] Figure 5 The diagram illustrates the principle of generating database operation statements in at least one other scenario.
[0094] In at least one scenario, context data can also be provided to the question-answering agent as reference information for generating database operation statements, thereby improving the accuracy of the generated statements. For example, context data can be a combination of historical information used to support current decisions during task execution, reasoning, or tool invocation by the question-answering agent.
[0095] In at least one scenario, the contextual data provided to the question-answering agent may be, for example, data associated with the object providing the descriptive information, such as business knowledge associated with that object. For instance, contextual data may include knowledge content actively accumulated and refined by the object itself, stored in an updatable form such as documents. For instance, contextual data may include business knowledge recalled based on the object's attribute information, such as business knowledge of the business line to which the object belongs. For instance, contextual data may include preference information extracted from the historical interaction information between the object and the question-answering agent. It is understood that the above contextual data is merely an example to aid understanding of this document. Depending on implementation needs, contextual data may include at least two types of data from the above examples, or other data besides those mentioned in the examples; this document does not limit this.
[0096] In at least one scenario, after obtaining the caliber description information, first contextual data can be obtained based on the caliber description information. This first contextual data is associated with the object that provided the caliber description information. Subsequently, based on the first contextual data and the first system prompt, a context-enhanced second system prompt is obtained. When obtaining the first database operation statement, the caliber description information and the second system prompt are provided to the question-answering agent, and the first database operation statement generated by the question-answering agent is obtained. This allows the question-answering agent to perform a first processing on the caliber description information based on the second system prompt, thereby generating a more accurate first database operation statement.
[0097] In at least one case, such as Figure 5As shown, after user 510 provides the caliber description information 502, for example, using user 510's identification information as a query condition, data associated with user 510 is retrieved from the knowledge base as context data 504. Subsequently, this context data 504 or the calling information of this context data 504 is added to the pre-set system prompt words to obtain the context-enhanced system prompt word 501. Subsequently, the system prompt word 501 and the caliber description information 502 are provided to the large model 521, which serves as the core decision-making unit of the question-answering agent. The question-answering agent then executes steps S522-S524 based on the information output by the large model 521. This involves calling at least one of the following tools to obtain metadata: dataset retrieval tool 531, similar field retrieval tool 532, operation statement acquisition tool 533, metadata acquisition tool 534, and field value acquisition tool 535. If the metadata obtained through the tool is complete, a database operation statement is generated. If the metadata obtained through the tool is incomplete, interactive guidance information is generated and output. Based on the user 510's response information 503 to the interactive guidance information, any supplementary metadata (such as the aforementioned third metadata) is obtained. For example, the implementation principles of steps S522-S524 are similar to those of steps S422-S424 described above, and will not be repeated here.
[0098] In at least one scenario presented in this paper, by providing contextual data to the question-answering agent, the agent can process the caliber description information based on the contextual data when generating database operation statements. This allows for a better understanding of the caliber description information, thereby improving the accuracy of the required information in the first metadata and enhancing the accuracy and efficiency of the generated database operation statements.
[0099] To better understand the principles behind question-answering agents generating database operation statements, the following will combine... Figure 6 The workflow for the question-answering agent to generate database operation statements corresponding to the caliber description information is described. It is understandable that... Figure 6 The workflow shown is for illustrative purposes only and is not intended to limit the scope of this article.
[0100] like Figure 6As shown, the acquired caliber description information 601 is set as "total number of XX users in YY region". After providing this caliber description information to the question-answering agent, the agent generates, for example, a decision result 611 of "no data source specified, find similar fields to assist in generation", and determines the tool to be called as the similar field retrieval tool 621 based on this decision result, and generates the call information of the similar field retrieval tool 621, which includes, for example, "total number of XX users in YY region". Subsequently, the question-answering agent calls the similar field retrieval tool 621 based on this call information and obtains feedback information 602 returned by the similar field retrieval tool 621, which includes, for example, "Table ZZ, number of XX users in the region". After obtaining the feedback information 602, the question-answering agent generates, for example, a decision result 612 of "view database operation statements for similar fields" based on the feedback information 602 and the caliber description information, and determines the tool to be called as the operation statement acquisition tool 622 based on this decision result, and generates the call information of the operation statement acquisition tool 622, which includes, for example, "Table ZZ, number of XX users in the region". Subsequently, the question-answering agent invokes the operation statement acquisition tool 622 based on the invocation information, and obtains feedback information 603 returned by the operation statement acquisition tool 622. This feedback information 603 includes, for example, the database operation statement "select XX from a" for similar fields. 'a' is, for example, the data table where field XX is located. After obtaining the feedback information 603, the question-answering agent obtains a decision result 613 based on the feedback information 603 and the caliber description information, for example, the generated database operation statement "select XX from a".
[0101] Based on the knowledge retrieval method based on question-answering agents provided in at least one aspect of this paper, this paper also provides a knowledge retrieval device based on question-answering agents, which will be combined with the following... Figure 7 This knowledge retrieval device based on a question-answering agent is described in detail.
[0102] Figure 7 A schematic diagram illustrates the structure of a knowledge retrieval device based on a question-answering agent, provided in at least one scenario.
[0103] like Figure 7As shown, the knowledge retrieval device 700 based on a question-answering agent includes an information acquisition module 710 and a statement acquisition module 720. These units or modules can be implemented using hardware (e.g., circuit) modules or software modules, as are the cases described below. For example, these units or modules can be implemented using a central processing unit (CPU), a general-purpose graphics processing unit (GPGPU), a graphics processing unit (GPU), a tensor processor (TPU), a field-programmable gate array (FPGA), or other forms of processing units with data processing and / or instruction execution capabilities, along with corresponding computer instructions.
[0104] The information acquisition module 710 is configured to acquire caliber description information. For example, the information acquisition module 710 can be configured to execute step S210 described above. The specific implementation principle can be referred to the relevant description of step S210, and will not be repeated here.
[0105] The statement acquisition module 720 is configured to provide the caliber description information to the question-answering agent, and to acquire a first database operation statement generated by the question-answering agent through a first processing of the caliber description information. The first database operation statement corresponds to the caliber description information and is used for knowledge retrieval. The first processing includes: determining the requirement information of first metadata based on the caliber description information, the first metadata including the metadata required to generate the first database operation statement; based on the requirement information, at least calling a tool to obtain the first metadata; and generating the first database operation statement based on the first metadata and the caliber description information. For example, the statement acquisition module 720 can be configured to execute step S220 described above. The specific implementation principle can be referred to the relevant description of step S220. The first operation includes steps S221 to S223 described above. The specific implementation principle can be referred to the relevant description of steps S221 to S223, which will not be repeated here.
[0106] In at least one scenario, the knowledge retrieval device based on a question-answering agent may further include a data acquisition module and a prompt word acquisition module. The data acquisition module is configured to acquire first context data based on caliber description information, the first context data being associated with the object providing the caliber description information. The prompt word acquisition module is configured to obtain context-enhanced second system prompt words based on the first context data and the first system prompt words. Specifically, the aforementioned statement acquisition module 720 is configured, for example, to provide the caliber description information and the second system prompt words to the question-answering agent, and to acquire a first database operation statement generated by the question-answering agent, wherein the question-answering agent performs a first processing on the caliber description information based on the second system prompt words.
[0107] It should be noted that, for clarity and brevity, this document does not present all the constituent units of the knowledge retrieval device 700 based on a question-answering intelligent agent. To achieve the necessary functions of the information display device, those skilled in the art can provide and configure other constituent units (not shown) according to specific needs; this document does not impose any limitations on this.
[0108] This document also provides an electronic device in at least one embodiment, comprising: a processor; a memory storing one or more computer program instructions; wherein the one or more computer program instructions are executed by the processor to implement the knowledge retrieval method based on a question-answering agent provided in any embodiment of this document.
[0109] For example, the processor can be a central processing unit (CPU), a digital signal processor (DSP), a graphics processing unit (GPU), a general-purpose graphics processing unit (GPGPU), or other forms of processing unit with data processing capabilities and / or instruction execution capabilities. It can be a general-purpose processor or a dedicated processor and can control other components in the electronic device to perform the desired functions.
[0110] For example, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, which a processing device may execute to implement the functions described in at least one of the embodiments herein (implemented by the processing device) and / or other desired functions, such as a knowledge retrieval method based on a question-answering agent. Various application programs and various data may also be stored in the computer-readable storage medium, such as caliber description information, context data, feedback information, and requirements information of primary metadata.
[0111] The following is for reference. Figure 8 This document illustrates a schematic diagram of the structure of an electronic device (e.g., a terminal device or a server) 800 suitable for implementing at least one of the embodiments described herein. The terminal device in at least one embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of at least one of the situations described herein.
[0112] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 into a random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device 800. The processing device 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0113] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic device 800 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 An electronic device 800 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0114] Specifically, according to the context of this document, the process described in the above-referenced flowchart can be implemented as a computer software program. For example, the context includes a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. In such a case, the computer program can be downloaded and installed from a network via communication device 809, or installed from storage device 808, or installed from ROM 802. When the computer program is executed by processing device 801, it performs the functions defined in the method of at least one scenario of this document.
[0115] It should be noted that the computer-readable medium described above can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this document, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0116] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0117] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0118] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: acquire caliber description information; and provide the caliber description information to a question-answering agent, acquiring a first database operation statement generated by the question-answering agent through a first processing of the caliber description information, the first database operation statement corresponding to the caliber description information and used for knowledge retrieval; wherein the first processing includes: determining the requirement information of first metadata based on the caliber description information, the first metadata including the metadata required to generate the first database operation statement; based on the requirement information, at least invoking a tool to acquire the first metadata; and generating the first database operation statement based on the first metadata and the caliber description information.
[0119] Computer program code for performing the operations described herein may be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0120] The flowcharts and block diagrams in the accompanying figures illustrate the architecture, functionality, and operation of possible implementations of the systems, methods, and computer program products according to the various scenarios described herein. In this respect, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the figures. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0121] The units or modules described in at least one of the scenarios herein can be implemented in software or hardware. The names of the units or modules do not, in some cases, constitute a limitation on the unit or module itself.
[0122] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0123] In the context of this document, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0124] Based on one or more scenarios described in this paper, Example 1 provides a knowledge retrieval method based on a question-answering agent, including:
[0125] Obtain caliber description information; and
[0126] The caliber description information is provided to the question-answering agent, and a first database operation statement is obtained by the question-answering agent through a first processing of the caliber description information. The first database operation statement corresponds to the caliber description information and is used for knowledge retrieval.
[0127] The first process includes:
[0128] Based on the caliber description information, the requirement information of the first metadata is determined, and the first metadata includes the metadata required to generate the first database operation statement;
[0129] Based on the aforementioned requirement information, at least the tool should be invoked to obtain the first metadata; and
[0130] Based on the first metadata and the caliber description information, the first database operation statement is generated.
[0131] Based on one or more scenarios described herein, Example 2 provides, as in Example 1, at least the invocation of a tool to obtain the first metadata based on the required information, including:
[0132] Based on the aforementioned requirement information, the tool is invoked to obtain the second metadata;
[0133] In response to the fact that the metadata required to generate the first database operation statement includes third metadata in addition to the second metadata, interactive guidance information for the third metadata is generated and output; and
[0134] The third metadata is obtained based on the response information to the input of the interactive guidance information.
[0135] Based on one or more scenarios described herein, Example 3 provides, as in Example 1, at least the invocation of a tool to obtain the first metadata based on the required information, including:
[0136] Based on the required information, determine the first tool that needs to be called from among multiple preset tools and generate first call information for the first tool;
[0137] Based on the first invocation information, the first tool is invoked, and the first feedback information returned by the first tool is obtained; and
[0138] The first metadata is obtained based at least on the first feedback information.
[0139] According to one or more scenarios in this document, Example 4 provides the method described in Example 3 for obtaining the first metadata based at least on the first feedback information, including:
[0140] In response to the first feedback information satisfying the preset conditions, based on the first feedback information and the demand information, a second tool is determined from the plurality of preset tools and a second invocation information for the second tool is generated;
[0141] Based on the second invocation information, the second tool is invoked, and the second feedback information returned by the second tool is obtained; and
[0142] The first metadata is obtained based at least on the first feedback information and the second feedback information.
[0143] Based on one or more scenarios described herein, Example 5 provides that the preset conditions described in Example 4 include at least one of the following:
[0144] The first tool that returns the first feedback information includes a pre-processing tool, which includes the tool that is called first among two tools called in the order of invocation;
[0145] The correlation between the first feedback information and the demand information is lower than the predetermined correlation; or
[0146] The first metadata includes other metadata besides the metadata in the first feedback information.
[0147] Based on one or more scenarios in this paper, Example 6 provides that the knowledge retrieval method in Example 1 also includes:
[0148] Based on the caliber description information, first context data is obtained, wherein the first context data is associated with the object providing the caliber description information; and
[0149] Based on the first context data and the first system prompt, a second system prompt with enhanced context is obtained.
[0150] The step of providing the caliber description information to the question-answering agent and obtaining the first database operation statement generated by the question-answering agent through a first processing of the caliber description information includes:
[0151] The caliber description information and the second system prompt word are provided to the question-and-answer agent, and the first database operation statement generated by the question-and-answer agent is obtained, wherein the question-and-answer agent performs the first processing on the caliber description information based on the second system prompt word.
[0152] Depending on one or more scenarios described herein, Example 7 provides that the tools invoked in Example 1 to retrieve the first metadata include at least one of the following:
[0153] A dataset retrieval tool is configured to retrieve a first dataset that matches a first search term and return the dataset identifier of the first dataset, wherein the invocation information for the dataset retrieval tool includes the first search term;
[0154] A similar field retrieval tool is configured to retrieve similar fields of a first field and return the similar fields; wherein, the invocation information for the similar field retrieval tool includes the first field;
[0155] An operation statement acquisition tool is configured to acquire and return a second database operation statement corresponding to the second field, as reference information for the question-answering agent to generate the first database operation statement. The invocation information for the operation statement acquisition tool includes the second field and the identification information of the data source where the second field is located. The second database operation statement carries the data retrieval logic for the second field.
[0156] Meta-information acquisition tool is configured to acquire and return a third field in a data table that is associated with the caliber description information, wherein the invocation information for the meta-information acquisition tool includes the identification information of the data table;
[0157] A field value retrieval tool is configured to retrieve a value example of a fourth field and return the value example, wherein the invocation information for the field value retrieval tool includes the fourth field.
[0158] Depending on one or more scenarios described herein, Example 8 provides that the metadata acquisition tool described in Example 7 is further configured as follows:
[0159] Based on the type of the third field, a data processing function is determined for the third field, and the function information of the data processing function is returned so that the question-answering agent can process the third field based on the data processing function.
[0160] Based on one or more scenarios described herein, Example 9 provides a knowledge retrieval device based on a question-answering agent, comprising:
[0161] The information acquisition module is configured to: acquire caliber description information; and
[0162] The statement acquisition module is configured to: provide the caliber description information to the question-answering agent, acquire the first database operation statement generated by the question-answering agent through a first processing of the caliber description information, wherein the first database operation statement corresponds to the caliber description information and is used for knowledge retrieval.
[0163] The first process includes:
[0164] Based on the caliber description information, the requirement information of the first metadata is determined, and the first metadata includes the metadata required to generate the first database operation statement;
[0165] Based on the aforementioned requirement information, at least the tool should be invoked to obtain the first metadata; and
[0166] Based on the first metadata and the caliber description information, the first database operation statement is generated.
[0167] According to one or more scenarios described herein, Example 10 provides an electronic device comprising:
[0168] Processor; and
[0169] Memory, which stores one or more computer program instructions;
[0170] The one or more computer program instructions are executed by the processor to implement the knowledge retrieval method based on question-answering agents provided in at least one of the scenarios described herein.
[0171] According to one or more scenarios described herein, Example 11 provides a computer-readable storage medium that non-transitory stores computer-readable instructions, wherein the computer-readable instructions, when executed by a processor, implement the knowledge retrieval method based on a question-answering agent provided in at least one scenario of this document.
[0172] The above description is merely a preferred embodiment and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this document is not limited to technical solutions formed by specific combinations of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions described herein.
[0173] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain contexts, multitasking and parallel processing may be advantageous. Similarly, while some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of this paper. Certain features described in the context of a single case can also be implemented in combination within that single case. Conversely, various features described in the context of a single case can also be implemented individually or in any suitable sub-combination in multiple cases.
[0174] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A knowledge retrieval method based on a question-answering agent, comprising: Obtain caliber description information; as well as The caliber description information is provided to the question-answering agent, and a first database operation statement is obtained by the question-answering agent through a first processing of the caliber description information. The first database operation statement corresponds to the caliber description information and is used for knowledge retrieval. The first process includes: Based on the caliber description information, the requirement information of the first metadata is determined, and the first metadata includes the metadata required to generate the first database operation statement; Based on the aforementioned requirement information, at least the tool should be invoked to obtain the first metadata; and Based on the first metadata and the caliber description information, the first database operation statement is generated.
2. The knowledge retrieval method according to claim 1, wherein, Based on the demand information, at least the following steps are taken: Invoking a tool to obtain the first metadata: Based on the aforementioned requirement information, the tool is invoked to obtain the second metadata; In response to the fact that the metadata required to generate the first database operation statement includes third metadata in addition to the second metadata, interactive guidance information for the third metadata is generated and output; and The third metadata is obtained based on the response information to the input of the interactive guidance information.
3. The knowledge retrieval method according to claim 1, wherein, Based on the demand information, at least the following steps are taken: Invoking a tool to obtain the first metadata: Based on the required information, determine the first tool that needs to be called from among multiple preset tools and generate first call information for the first tool; Based on the first invocation information, the first tool is invoked, and the first feedback information returned by the first tool is obtained; and The first metadata is obtained based at least on the first feedback information.
4. The knowledge retrieval method according to claim 3, wherein, The process of obtaining the first metadata based at least on the first feedback information includes: In response to the first feedback information satisfying the preset conditions, based on the first feedback information and the demand information, a second tool is determined from the plurality of preset tools and a second invocation information for the second tool is generated; Based on the second invocation information, the second tool is invoked, and the second feedback information returned by the second tool is obtained; and The first metadata is obtained based at least on the first feedback information and the second feedback information.
5. The knowledge retrieval method according to claim 4, wherein, The preset conditions include at least one of the following: The first tool that returns the first feedback information includes a pre-processing tool, which includes the tool that is called first among two tools called in the order of invocation; The correlation between the first feedback information and the demand information is lower than the predetermined correlation. or The first metadata includes other metadata besides the metadata in the first feedback information.
6. The knowledge retrieval method according to claim 1 further includes: Based on the caliber description information, first context data is obtained, and the first context data is associated with the object that provides the caliber description information; as well as Based on the first context data and the first system prompt, a second system prompt with enhanced context is obtained. The step of providing the caliber description information to the question-answering agent and obtaining the first database operation statement generated by the question-answering agent through a first processing of the caliber description information includes: The caliber description information and the second system prompt word are provided to the question-answering agent, and the first database operation statement generated by the question-answering agent is obtained, wherein the question-answering agent performs the first processing on the caliber description information based on the second system prompt word.
7. The knowledge retrieval method according to claim 1, wherein, The tools invoked when retrieving the first metadata include at least one of the following: A dataset retrieval tool is configured to retrieve a first dataset that matches a first search term and return the dataset identifier of the first dataset, wherein the invocation information for the dataset retrieval tool includes the first search term; A similar field retrieval tool is configured to retrieve similar fields of a first field and return the similar fields; wherein, the invocation information for the similar field retrieval tool includes the first field; An operation statement acquisition tool is configured to acquire and return a second database operation statement corresponding to the second field, as reference information for the question-answering agent to generate the first database operation statement. The invocation information for the operation statement acquisition tool includes the second field and the identification information of the data source where the second field is located. The second database operation statement carries the data retrieval logic for the second field. Meta-information acquisition tool is configured to acquire and return a third field in a data table that is associated with the caliber description information, wherein the invocation information for the meta-information acquisition tool includes the identification information of the data table; A field value retrieval tool is configured to retrieve a value example of a fourth field and return the value example, wherein the invocation information for the field value retrieval tool includes the fourth field.
8. The knowledge retrieval method according to claim 7, wherein, The metadata acquisition tool is also configured to: Based on the type of the third field, a data processing function is determined for the third field, and the function information of the data processing function is returned so that the question-answering agent can process the third field based on the data processing function.
9. A knowledge retrieval device based on a question-answering intelligent agent, comprising: The information acquisition module is configured to acquire caliber description information; as well as The statement acquisition module is configured to: provide the caliber description information to the question-answering agent, acquire a first database operation statement generated by the question-answering agent through a first processing of the caliber description information, wherein the first database operation statement corresponds to the caliber description information and is used for knowledge retrieval; The first process includes: Based on the caliber description information, the requirement information of the first metadata is determined, and the first metadata includes the metadata required to generate the first database operation statement; Based on the aforementioned requirement information, at least the tool should be invoked to obtain the first metadata; and Based on the first metadata and the caliber description information, the first database operation statement is generated.
10. An electronic device, comprising: processor; as well as Memory, which stores one or more computer program instructions. The one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium for non-transitory storage of computer-readable instructions, wherein, The method described in any one of claims 1 to 8 is implemented when the computer-readable instructions are executed by a processor.