Data query method and device, electronic equipment and storage medium

Through the language understanding model, the data query steps are automatically planned, combined with intent identification, indicator mapping and proxy entity scheduling, the problems of low efficiency and high cost of data query in the existing technology are solved, and efficient, flexible and controllable data query is achieved.

CN120277176APending Publication Date: 2025-07-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410011216.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The prior art has problems with multi-table set connections, difficulty in repairing syntax errors, low scalability of execution results, slow processing speed, high error rate, and lack of mature data reading plug-ins during data querying, resulting in low query efficiency and increased cost.

Method used

The language understanding model is used to automatically plan data query steps, and through intent recognition, indicator mapping, proxy entity scheduling and plug-in calls, combined with vector database for querying, to achieve flexible data processing and answer generation.

Benefits of technology

It improves the efficiency of data query, reduces query costs, enhances the flexibility and scalability of query, and ensures the consistency and controllability of answer results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277176A_ABST
    Figure CN120277176A_ABST
Patent Text Reader

Abstract

The invention provides a data query method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining an original question text; identifying an intention of the original question text, and determining a target proxy entity corresponding to the intention from a plurality of candidate proxy entities; based on a pre-configured index mapping table, mapping a plurality of original indexes in the original problem text into a plurality of standard indexes; replacing a plurality of original indexes in the original problem text based on a plurality of standard indexes to obtain a standard problem text; splicing the standard question text with a preset prompt language template to obtain a prompt language text; generating at least one answer material corresponding to the prompt language text through the target agent entity; and generating a target answer result based on the original question text and the at least one answer material. Through the data query method and device, the data query efficiency can be improved, and the data query cost can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to natural language processing technology, and in particular to a data query method, apparatus, electronic device and storage medium. Background Art

[0002] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers in natural language. Natural language processing involves natural language, that is, the language people use in daily life, and is closely related to linguistic research; at the same time, it involves computer science and mathematics. The pre-trained model, an important technology for model training in the field of artificial intelligence, is developed from the large language model in the field of NLP. After fine-tuning, the large language model can be widely applied to downstream tasks. Natural language processing technology usually includes technologies such as text processing, semantic understanding, machine translation, robot question answering, and knowledge graph. Summary of the Invention

[0003] Embodiments of this application provide a data query method, apparatus, electronic device, computer program product and computer-readable storage medium, which can improve the efficiency of data query and reduce the cost of data query.

[0004] The technical solution of the embodiments of this application is implemented as follows:

[0005] Embodiments of this application provide a data query method, the method includes:

[0006] Obtain the original problem text;

[0007] Identify the intention of the original problem text, and determine a target proxy entity corresponding to the intention from multiple candidate proxy entities;

[0008] Based on a pre-configured metric mapping table, map multiple original metrics in the original problem text to multiple standard metrics;

[0009] Based on the multiple standard metrics, replace the multiple original metrics in the original problem text to obtain a standard problem text;

[0010] Concatenate the standard problem text with a pre-set prompt template to obtain a prompt text;

[0011] Generate at least one answer material corresponding to the prompt text through the target proxy entity;

[0012] Generate a target answer result based on the original problem text and the at least one answer material.

[0013] An embodiment of the present application provides a data query device, and the device includes:

[0014] A data acquisition module, configured to acquire an original problem text;

[0015] An intent recognition module, configured to recognize the intent of the original problem text and determine a target proxy entity corresponding to the intent from multiple candidate proxy entities;

[0016] An index mapping module, configured to map multiple original indexes in the original problem text into multiple standard indexes based on a pre-configured index mapping table;

[0017] An index substitution module, configured to substitute the multiple original indexes in the original problem text with the multiple standard indexes to obtain a standard problem text;

[0018] A data splicing module, configured to splice the standard problem text with a pre-set prompt template to obtain a prompt text;

[0019] A material generation module, configured to generate at least one answer material corresponding to the prompt text through the target proxy entity;

[0020] A result generation module, configured to generate a target answer result based on the original problem text and the at least one answer material.

[0021] An embodiment of the present application provides an electronic device, and the electronic device includes:

[0022] A memory, configured to store computer-executable instructions;

[0023] A processor, configured to implement the data query method provided by the embodiment of the present application when executing the computer-executable instructions stored in the memory.

[0024] An embodiment of the present application provides a computer-readable storage medium, storing a computer program or computer-executable instructions, which are configured to implement the data query method provided by the embodiment of the present application when being executed by a processor.

[0025] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions, which are configured to implement the data query method provided by the embodiment of the present application when being executed by a processor.

[0026] The embodiment of the present application has the following beneficial effects:

[0027] By decoupling the task of answering the original question text into the task of generating answer materials through proxy entities with different intents, and then combining the answer materials to generate the answer result, this architecture for decomposing multi-step query answers has good scalability and flexibility. It can be quickly invoked to improve the efficiency of processing the original question text, and is also convenient for subsequent expansion and upgrade;

[0028] Since the intent is corresponding to the proxy entity, it ensures the consistency of the answer materials for the original question text with the same intent, making the answer results with the same intent have good consistency and ensuring the controllability of the answer results;

[0029] By converting the non-standard original metrics in the original question text into standard metrics, it is possible to uniformly and efficiently process the original question texts with different expressions but the same essential intent through proxy entities with different intents, improving the efficiency of processing the original question text. Brief Description of the Drawings

[0030] Figure 1A It is a schematic structural diagram of the data query system 100 provided by an embodiment of the present application;

[0031] Figure 1B It is a schematic structural diagram of a specific application scenario of the data query system 100;

[0032] Figure 2 It is a schematic structural diagram of the server 200 provided by an embodiment of the present application;

[0033] Figure 3A It is a schematic diagram of the first process of the data query method provided by an embodiment of the present application;

[0034] Figure 3B It is a schematic diagram of the second process of the data query method provided by an embodiment of the present application;

[0035] Figure 3C It is a schematic diagram of the third process of the data query method provided by an embodiment of the present application;

[0036] Figure 3D It is a schematic diagram of the fourth process of the data query method provided by an embodiment of the present application;

[0037] Figure 3E It is a schematic diagram of the fifth process of the data query method provided by an embodiment of the present application;

[0038] Figure 3F It is a schematic diagram of the sixth process of the data query method provided by an embodiment of the present application;

[0039] Figure 3G It is a schematic diagram of the seventh process of the data query method provided by an embodiment of the present application;

[0040] Figure 3H It is the eighth process schematic diagram of the data query method provided by the embodiments of the present application;

[0041] Figure 3I It is the ninth process schematic diagram of the data query method provided by the embodiments of the present application;

[0042] Figure 3J It is the tenth process schematic diagram of the data query method provided by the embodiments of the present application;

[0043] Figure 4 It is the question-and-answer schematic diagram of data query provided by the embodiments of the present application;

[0044] Figure 5 It is the process schematic diagram of the proxy entity scheduling module provided by the embodiments of the present application. Detailed implementation manners

[0045] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be construed as limiting the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.

[0046] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments. However, it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0047] If similar descriptions such as "first / second" appear in the application documents, the following explanation is added. In the following description, the terms "first / second / third" involved are only used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first / second / third" can be interchanged with a specific order or sequence when allowed, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0048] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present application belongs. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0049] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are applicable to the following explanations.

[0050] 1) Agent entity, usually refers to an entity that performs specific tasks in a computer system or network. It can be a software program or a hardware device. The role of the agent entity is to represent users or other systems to complete tasks, such as data collection, data processing, decision support, etc. The agent entity can be autonomous, with a certain degree of intelligence and adaptability to perform tasks in different situations. It can be ChatGPT with a certain additional ability.

[0051] 2) Vector database, is a database system specifically used for storing and querying vector data. Compared with traditional databases, vector databases use vectorized computing and can process large-scale complex data at high speed; and can handle high-dimensional data, such as images, audio, and video, etc., to solve the pain points in traditional relational databases; at the same time, vector databases support complex query operations and can also be easily extended to multiple nodes to process larger-scale data.

[0052] 3) Chat Generative Pre-Trained Transformer (ChatGPT), is a specific application based on the Generative Pre-Trained Transformer (GPT) model, which focuses on the field of dialogue systems. ChatGPT, through large-scale pre-training in the early stage, can automatically generate responses that match the user's dialogue content after inputting the dialogue text. Different from traditional dialogue systems, ChatGPT does not require designing specific rules and logics, nor does it require marking data, because it has been trained based on a large amount of data and can automatically learn various rules and logical relationships of language. Through continuous interaction with users, ChatGPT can gradually deepen its understanding of users' intentions and needs, and thus answer users' questions more accurately.

[0053] In the prior art, when performing data queries, the method of converting natural language to database language (SQL, Structured Query Language) is adopted. The user inputs a question, and GPT can automatically select tables and then automatically generate SQL for back-end queries; or use GPT to decompose tasks, understand the artificial intelligence (AI) capabilities of the huggingface community, and allocate tasks, and dispatch the community AI capabilities to complete specific execution operations. Mainly use the modules included in the large language model (LLM, Large Language Model) as the controller. Among them, the LLM can perform the following processing: 1. Task planning: Understand user needs and decompose tasks. 2. Task allocation: According to the model introduction of each model in huggingface, select the model, and then distribute each task to the specific model for execution. 3. Summarize and reply: According to the results returned by each task, summarize and reply to the tasks; or based on the GPT agent, give a corresponding solution plan according to the tasks. For example, if it is necessary to browse the Internet or use new data, its strategy will be adjusted until the task is completed. This method includes 4 components: 1. Architecture: Built through the GPT-4 and GPT-3.5 language models for easy thinking and reasoning. 2. Autonomous iteration: Review work and use historical records to produce more accurate results. 3. Memory management: Integrated with a vector database (a memory storage solution) to retain context and make better decisions. 4. Versatility: Have functions such as file operations, web browsing, and data retrieval; or connect ChatGPT to third-party applications through plugins. These plugins enable ChatGPT to interact with custom APIs, enhance functionality, and be able to perform various operations. For example: The plugins enable ChatGPT to perform the following operations: 1. Retrieve real-time information: sports scores, weather conditions, latest news, etc. 2. Retrieve knowledge base information: game data, personal notes, etc. 3. Assist users in performing operations: book flights, order food, etc.

[0054] In the process of using a database for data queries in the prior art, multi-table set connection problems will occur. When there are syntax errors, they cannot be repaired, and it is easy to select the wrong table, unable to add business logic, with a high error rate and low scalability; in the process of using LLM for data queries, there are fixed execution steps, only support multi-modal questions, and have no error correction ability; in the process of using the GPT-based agent for data queries, the processing speed is slow, the scalability of the execution results is low, loops often occur, and errors often occur when selecting capabilities; in the process of connecting ChatGPT to third-party applications through plugins for data queries, there is no mature plugin for accessing data reading.

[0055] Based on the above analysis, the applicant has found that the data query methods in the prior art cannot perform data query accurately and efficiently, nor do they have scalability and flexibility. In view of the above problems, the embodiments of the present application provide a data query method, which can improve the efficiency of data query and reduce the cost of data query.

[0056] The embodiments of the present application provide a data query method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the efficiency of data query and reduce the cost of data query. The following describes an exemplary application of the electronic device provided by the embodiments of the present application. The electronic device provided by the embodiments of the present application can be implemented as various types of user terminals such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices (for example, mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable game devices), smart phones, smart speakers, smart watches, smart TVs, vehicle terminals, etc., or can be implemented as a server. The following will describe the exemplary application when the electronic device is implemented as a server.

[0057] See Figure 1A , Figure 1A is a schematic diagram of the architecture of the data query system 100 provided by the embodiments of the present application. To support a data query application, for example, Figure 1A the data query system 100 involves a server 200, a network 300, a terminal 400, a knowledge base 500, and a vector database 600. The terminal 400 is connected to the server 200 through the network 300. The network 300 can be a wide area network, a local area network, or a combination of the two. Data transmission occurs between the server 200 and the database 500 and the vector database 600.

[0058] In some embodiments, the server 200 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle terminal, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, which are not limited in the embodiments of the present application.

[0059] The embodiments of the present application can be implemented through artificial intelligence technology. Artificial Intelligence (AI) uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, and is a theory, method, technology, and application system that can perceive the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable machines to have the functions of perception, reasoning, and decision-making.

[0060] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics, etc. Among them, the pre-trained model, also known as the large model or the foundation model, can be widely applied to downstream tasks in various directions of artificial intelligence after fine-tuning. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0061] The embodiments of the present application can be implemented through database technology. Briefly, the knowledge base 500 and the vector database 600 can be regarded as places for storing electronic files in an electronic filing cabinet, and users can perform operations such as adding, querying, updating, and deleting data in the files. The so-called "database" is a data set stored together in a certain way, shared by multiple users, with as little redundancy as possible, and independent of application programs. The terminal 400 is used to send the question text and receive the target answer result, which is displayed on the graphical interface 410. The server 200 is used to obtain the question text and the preset files in the knowledge base 500 and the vector database 600, obtain the target answer result corresponding to the question text through artificial intelligence technology, and send the target answer result to the terminal 400.

[0062] In some embodiments, refer to Figure 1B , Figure 1B is a schematic diagram of the architecture of a specific application scenario of the data query system 100. In Figure 1B , the dashed box corresponds to Figure 1A the server 200 in Figure 1A That is to say, the function of the server 200 in Figure 1BIt is jointly completed by the language understanding model, agent entity, tool, and plugin. The terminal sends the question text to the language understanding model, and the language model converts the question text into a question vector. In response to querying the target answer result in the vector database based on the question vector, the target answer result is returned to the terminal; in response to not querying the target answer result in the vector database based on the question vector, the language understanding model identifies the intent of the question text based on the intent mapping table in the knowledge base, confirms the agent entity corresponding to the intent according to the intent of the question text, the agent entity determines the tool corresponding to the question text based on the agent description file and the normalized question text in the knowledge base, the tool determines the plugin for obtaining the answer material corresponding to the question text based on the plugin description text in the knowledge base, the plugin transmits the obtained question text and answer material to the language understanding model for processing to obtain the target answer result, and returns the target answer result to the terminal.

[0063] See Figure 2 , Figure 2 FIG. is a schematic structural diagram of the server 200 provided by an embodiment of the present application. Figure 2 The server 200 shown in FIG. includes: at least one processor 210, a memory 230, and at least one network interface 220. Each component in the server 200 is coupled together through a bus system 240. It can be understood that the bus system 240 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 240 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 2 all kinds of buses are labeled as the bus system 240.

[0064] The processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0065] The memory 230 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memories, hard disk drives, optical disc drives, etc. The memory 230 optionally includes one or more storage devices that are physically located far from the processor 210.

[0066] The memory 230 includes volatile memory, non-volatile memory, or both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 230 described in the embodiments of the present application is intended to include any suitable type of memory.

[0067] In some embodiments, the memory 230 is capable of storing data to support various operations. Examples of such data include programs, modules, and data structures, or subsets or supersets thereof, which will be described exemplarily below.

[0068] The operating system 231 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0069] The network communication module 232 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 220. Exemplary network interfaces 220 include: Bluetooth, wireless fidelity (WiFi), and universal serial bus (USB), etc.;

[0070] In some embodiments, the device provided by the embodiments of the present application can be implemented in software. Figure 2 Shown is a data query device 233 stored in the memory 230, which may be software in the form of a program and a plugin, etc., and includes the following software modules: a data acquisition module 2331, an intent recognition module 2332, a metric mapping module 2333, a metric replacement module 2334, a data splicing module 2335, a material generation module 2336, and a result generation module 2337. These modules are logical, and thus can be combined arbitrarily or further split according to the functions implemented. The functions of each module will be described below.

[0071] In some embodiments, a terminal or a server may implement the data query method provided in the embodiments of the present application by running various computer-executable instructions or computer programs. For example, the computer-executable instructions may be commands at the microprogram level, machine instructions, or software instructions. The computer program may be a native program or a software module in an operating system; it may be a native application (APP), that is, a program that needs to be installed in the operating system to run; or it may be a small program that can be embedded in any APP, that is, a program that only needs to be downloaded to the browser environment to run. In short, the above computer-executable instructions may be instructions in any form, and the above computer programs may be application programs, modules, or plug-ins in any form.

[0072] The exemplary applications and implementations of the server provided in the embodiments of the present application will be combined to illustrate the data query method provided in the embodiments of the present application.

[0073] See Figure 3A , Figure 3A FIG. is the first flowchart of the data query method provided in the embodiments of the present application. Taking the server as the main body, it will be described in combination with the steps shown in Figure 3A FIG.

[0074] In step 101, the original problem text is obtained.

[0075] Exemplarily, the source of the original problem text can be various, such as: web page, mobile software, server, etc.

[0076] In step 102, the intention of the original problem text is recognized, and the target proxy entity corresponding to the intention is determined from multiple candidate proxy entities.

[0077] In some embodiments, the intention of the original problem text may be recognized by an intention recognition model. First, training samples are obtained. The sample type may be text, and each text is labeled with a true label, and the label represents the intention of the text; secondly, the training samples are converted into vectors and intention prediction is performed through a semantic understanding model and a classifier; finally, the loss between the predicted intention and the true label is calculated through a loss function (such as softmax), and the parameters of the model are updated based on the loss, so as to complete the training of the intention recognition model. The original problem text is input into the intention recognition model to obtain the intention of the original text.

[0078] In some embodiments, see Figure 3B , Figure 3B FIG. is the second flowchart of the data query method provided in the embodiments of the present application. Figure 3A For step 102 of FIG., "determining the target proxy entity corresponding to the intention from multiple candidate proxy entities" can be achieved through Figure 3BIt is implemented by steps 1021 to 1022, which will be specifically described below.

[0079] In step 1021, a pre-configured intent mapping table is obtained. The intent mapping table includes mapping relationships between multiple candidate proxy entities and multiple different intents.

[0080] Exemplarily, different intents correspond to multiple different proxy entities. For example, when the intent of the original text is data query, there can be a proxy entity for querying business analytics, a proxy entity for querying information, and so on.

[0081] In step 1022, based on the intent of the original problem text, the intent mapping table is queried, and the proxy entity associated with the intent of the original text obtained from the query is used as the target proxy entity corresponding to the intent.

[0082] In some embodiments, when a proxy entity corresponding to the intent is found in the intent mapping table, for example, if the proxy entity for querying business analytics is selected, then this proxy entity is used as the target proxy entity.

[0083] In some embodiments, refer to Figure 3C , Figure 3C It is the third process schematic diagram of the data query method provided by the embodiments of the present application. When there are multiple proxy entities associated with the intent of the original text, steps 201 to 202 of Figure 3C are executed, which will be specifically described below.

[0084] In step 201, in response to querying multiple proxy entities associated with the intent of the original problem text, the invocation permission of each proxy entity is obtained. The invocation permission represents the minimum permission required to invoke the proxy entity.

[0085] In some embodiments, the same intent may be associated with multiple proxy entities. At this time, the invocation permission of each proxy entity needs to be obtained, and the specific proxy entity to be used is determined according to the invocation permission.

[0086] In step 202, the object permission of the source object of the original problem text is obtained, and the object permission of the source object is compared with the invocation permissions of different proxy entities to determine the highest invocation permission that can be invoked based on the object permission of the source object. The proxy entity corresponding to the highest invocation permission is used as the target proxy entity.

[0087] Exemplarily, when the intent of the original problem text is data query, at this time, the proxy entities associated with data query include a proxy entity for querying business analytics, a proxy entity for querying information, and so on. However, the invocation permissions of different proxy entities are different. The highest invocation permission that the source object of the original problem text can invoke is the permission to use the business analytics system. Therefore, the proxy entity for querying business analytics is used as the target proxy entity.

[0088] Continue to refer to Figure 3A In step 103, based on a pre-configured metric mapping table, multiple original metrics in the original problem text are mapped to multiple standard metrics.

[0089] In some embodiments, the metric mapping table includes mapping relationships between multiple different original metrics and multiple different standard metrics.

[0090] For example, multiple different original metrics can be mapped to the same standard metric. For example, "download", "download volume", "download times", "installation", "download number", "number of downloaders", "download user times", "download user", "download user volume", "download user times" will all be mapped to "download data", where "download data" is the standard metric.

[0091] In some embodiments, refer to Figure 3D , Figure 3D is the fourth process schematic diagram of the data query method provided by the embodiments of the present application. Figure 3A Step 103 of Figure 3D can be implemented by steps 1031 to 1032 of

[0092] In step 1031, multiple original metrics are extracted from the original problem text.

[0093] In some embodiments, an original metric list is constructed, and original metrics are extracted from the preset original metric list based on regular expressions.

[0094] In step 1032, based on each original metric, the metric mapping table is queried to obtain the standard metric that has a mapping relationship with each original metric.

[0095] For example, when the original metric is a time period, for example: the original metric is "the last three days", if today is October 27, 2023, and the format of the standard metric for the time period is "year-month-day ~ year-month-day", then the standard metric that has a mapping relationship with "the last three days" is "2023-10-25 ~ 2023-10-27".

[0096] Continue to refer to Figure 3A In step 104, based on multiple standard metrics, multiple original metrics in the original problem text are replaced to obtain a standard problem text.

[0097] For example, the original question text is "Query the download volume of Game A in the past three days". Among them, the original metrics are "Game A", "in the past three days", and "download volume". After querying the metric mapping table, the corresponding standard metrics are "youxi1234", "2023-10-25 to 2023-10-27", and "download data" respectively. Then the standard question text corresponding to this original question text is "Query the download data of youxi1234 from 2023-10-25 to 2023-10-27".

[0098] In the embodiment of the present application, index normalization processing is performed through an index mapping table to convert the original question text into a standard question text, so as to directly query data through the mapped standard metrics, improving the query efficiency.

[0099] In step 105, the standard question text is spliced with a preset prompt template to obtain a prompt text.

[0100] For example, when the question needs to be answered in Chinese, the requirement for a Chinese answer is added to the prompt template; when the required answer format is JSON, the requirement for the answer format to be JSON is added to the prompt template.

[0101] In the embodiment of the present application, the prompt template is spliced on the standard question text, and the query limit conditions are added through the prompt text. When there are special requirements for the answer to the question, the requirements can be clearly expressed through the prompt template, facilitating the conversion of the answer according to the requirements when querying the result, improving the query accuracy, and enhancing the query flexibility.

[0102] In step 106, at least one answer material corresponding to the prompt text is generated through the target proxy entity.

[0103] In some embodiments, each proxy entity is associated with multiple tools of different types, and the tools of different types have different data processing capabilities.

[0104] In some embodiments, refer to Figure 3E , Figure 3E is the fifth process schematic diagram of the data query method provided by the embodiment of the present application. Figure 3A Step 106 of Figure 3E can be implemented through steps 1061 to 1063 of

[0105] In step 1061, a preset proxy description file is obtained, where the proxy description file records the data processing capabilities included in each tool in the target proxy entity.

[0106] For example, for each proxy entity, there will be a description belonging to that proxy entity. When defining the proxy entity, the capabilities of the proxy entity will be told. For example, the proxy entity is told "You are a tool for querying the scoring and segmentation system, and you can do things 1, things 2, things 3...", and all the tools of the proxy entity will be listed, as well as the descriptions corresponding to each tool, and the proxy entity is told "You need to answer the user's questions based on the above tools."

[0107] In step 1062, determine the data processing capabilities that match the prompt text, and use the tools with the matching data processing capabilities as the target tools.

[0108] For example, if the data processing capabilities that match the prompt text are querying the scoring and segmentation system, then the tools that can query the scoring and segmentation system will be used as the target tools.

[0109] In step 1063, based on the prompt text, call the target tools in the target proxy entity to perform text generation operations to obtain at least one answer material.

[0110] In some embodiments, refer to Figure 3F , Figure 3F is the sixth process schematic diagram of the data query method provided by the embodiments of the present application. Figure 3E Step 1063 of Figure 3F can be implemented by steps 10631 to 10634 of

[0111] In step 10631, obtain a pre-set plug-in description file. Among them, the plug-in description file records multiple different types of plug-ins encapsulated in each tool. The multiple different types of plug-ins are used to generate multiple different types of answer materials. The multiple different types of plug-ins are: metric mapping plug-ins, data query plug-ins, and multiple field query plug-ins associated with multiple key fields.

[0112] In some embodiments, the plug-in description file records input, description, and output. Among them, the output is an explanation of the returned result, such as explaining what the meaning of the returned field represents. The plug-in description file is used to tell the plug-in what content to input when this type of plug-in can be used, and to call the specific plug-in of this type. By calling this plug-in, the output corresponding to the input content can be obtained.

[0113] Exemplarily, proxy entities with different capabilities correspond to different tools. There can be multiple types of tools, and each type of tool corresponds to a plugin of the same type. For example, Tool 1 only corresponds to an interface-type plugin, and there are also code-type plugins, model plugins, and so on. Among them, the interface-type plugin can directly obtain data by calling the already written interfaces. For example, by calling a Hypertext Transfer Protocol (HTTP) link, just passing the parameters to the plugin will return the result; for the model plugin, such as a classification model, passing the parameters to the model will obtain the result; for the code-type plugin, such as calling functions written in Python or C++ to obtain data. Just giving specific input to the plugin can obtain the result.

[0114] In step 10632, at least one keyword field is obtained based on the prompt text.

[0115] Exemplarily, there may be multiple keyword fields, such as game name, time, metric name, and so on.

[0116] For each keyword field, the following steps 10633 and 10634 are executed.

[0117] In step 10633, the plugin that has an associated relationship with the keyword field is used as the target plugin.

[0118] In step 10634, the target plugin is called based on the prompt text to generate at least one answer material.

[0119] In some embodiments, the form of the answer material depends on the type of the plugin. The answer material can be code, picture, chart, etc.

[0120] In some embodiments, the keyword field includes a field value. When the number of at least one keyword field is multiple, a language understanding model is called to generate multiple steps for obtaining the answer material; read the multiple steps in sequence, and for each intermediate step read, the following processing is performed: extract the keyword field in the intermediate step, call the target field query plugin to query the field value corresponding to the keyword field in the intermediate step, where the target field query plugin is a field query plugin associated with the keyword field in the intermediate step, and the intermediate step is the step except for the last two steps among the multiple steps; extract the keyword field in the penultimate step, and based on the keyword field in the penultimate step, call the metric mapping plugin to query the corresponding metric; according to the field value included in the keyword field in each intermediate step and the metric, call the data query plugin to query the field value included in the keyword field in the last step.

[0121] For example, “query the download situation of game A from October 12, 2023 to October 19, 2023”. First, GPT believes that it is necessary to first use the “API for querying game IDs” to obtain the game ID, and the game name corresponding to game A is youxi1234 (at this time, it has not ended and is still in the query state); after obtaining youxi1234, it is necessary to know what the corresponding indicators for downloads are, so it will call the API for indicator mapping to query the indicators for downloads, and the obtained indicator is download (at this time, it has not ended and is still in the query state); after obtaining youxi1234, the indicator download, and knowing the time range, it will use the API for data query to query the data and obtain the answer materials. When the answer materials are obtained, GPT will automatically stop calling the plugins in the tool (at this time, it has ended and is in the completed state).

[0122] In the embodiments of the present application, different types of plugins are called through the plugin description file to solve corresponding problems, achieving the decoupling of capabilities. When new capabilities are required, plugins can be added or changed at any time, thereby enhancing the scalability of capabilities and achieving controllable querying.

[0123] In some embodiments, refer to Figure 3G , Figure 3G is the seventh process schematic diagram of the data query method provided by the embodiments of the present application. Before step 106, steps 301 to 304 of Figure 3G are executed, which are specifically described below.

[0124] In step 301, obtain the prompt vector of the prompt text.

[0125] In some embodiments, the prompt text can be converted into a prompt vector through a word embedding model, that is, each word in the prompt text is represented as a vector of a fixed length, and a neural network is trained to learn the vector representation of the words. The vectors of all words are concatenated to obtain the vector representation of the prompt text.

[0126] In step 302, query the vector database based on the prompt vector, where the vector database includes the problem vectors corresponding to the pre-set problem files.

[0127] In some embodiments, the vector database is a database system specifically used for storing and querying vector data. Compared with the databases in the related art, the vector database uses vectorized computing and can process large-scale complex data at high speed; and can process high-dimensional data, such as images, audio, and video, etc., to solve the pain points in traditional relational databases; at the same time, the vector database supports complex query operations and can also be easily extended to multiple nodes to process larger-scale data.

[0128] In some embodiments, referring to Figure 3H , Figure 3H is the eighth process schematic diagram of the data query method provided by the embodiments of the present application. Before step 302, the steps 401 to 403 of Figure 3H are executed, which are specifically described below.

[0129] In step 401, a plurality of pre-set question files in the knowledge base are obtained, where the question files include question texts and answer materials corresponding to the question texts.

[0130] In step 402, the plurality of question files are vectorized to obtain question vectors corresponding to each question file.

[0131] In some embodiments, since the question files include question texts and answer materials corresponding to the question texts, it is necessary to vectorize both the question texts and the answer materials corresponding to the question texts, and convert the vectors of the question texts and the answer materials into the question vectors corresponding to the question files.

[0132] In some embodiments, referring to Figure 3I , Figure 3I is the ninth process schematic diagram of the data query method provided by the embodiments of the present application. Figure 3H Step 402 of Figure 3I can be implemented by steps 4021 to 4023 of

[0133] In step 4021, the question files whose included character count exceeds the character count threshold are divided into multiple text blocks.

[0134] In some embodiments, if the maximum number of characters allowed for a file is 200, but the current question file contains 300 characters, the current question file needs to be split to ensure that the character count of each split text block does not exceed 200.

[0135] In step 4022, the text blocks are vectorized to obtain text block vectors corresponding to each text block.

[0136] In some embodiments, the text blocks can be converted into text block vectors through the bag-of-words model, that is, each word in the text block is represented as a one-hot vector, the vector dimension is the size of the vocabulary, and only one element is 1, and the rest are 0. The one-hot vectors of all words are concatenated to obtain the text block vector.

[0137] In step 4023, the text block vectors of each text block in each question file are used as the question vectors corresponding to the question file.

[0138] In some embodiments, when a question file is split into multiple text blocks, the vectors of all text blocks included in the question file are required to be used as the question vector corresponding to the question file.

[0139] Continue to refer to Figure 3H , in step 403, a vector database is constructed based on multiple question vectors.

[0140] In some embodiments, there is a mapping relationship between the question file and the question vector, that is, in the vector database, the question vector corresponding to each question file is stored.

[0141] Continue to refer to Figure 3G , in step 303, in response to query results being found in the vector database, the query results are output.

[0142] In some embodiments, during the query process, a similarity threshold can be set. When the calculation result of the similarity between the prompt vector and the question vector is greater than or equal to the similarity threshold, it is considered that query results can be found.

[0143] In step 304, in response to no query results being found in the vector database, the process proceeds to execute the process of generating at least one answer material corresponding to the prompt text through the target proxy entity, that is, the above step 106.

[0144] In some embodiments, when the calculation result of the similarity between the prompt vector and the question vector is less than the similarity threshold, it indicates that no query results are found, and then the target proxy entity is called to obtain the answer material.

[0145] In the embodiments of the present application, a query is first performed in the vector database. If the result is found, the query result is directly output. If the result is not found, the proxy entity is further used for query. By pre-storing common questions and answers in the vector data, the results of basic questions can be quickly queried, reducing the query cost and improving the query efficiency.

[0146] Continue to refer to Figure 3A , in step 107, a target answer result is generated based on the original question text and at least one answer material.

[0147] In some embodiments, refer to Figure 3J , Figure 3J is the tenth process schematic diagram of the data query method provided by the embodiments of the present application. Figure 3A of step 107 can be implemented by Figure 3J from step 1071 to step 1075 of , which will be specifically described below.

[0148] In step 1071, the original question text is vectorized to obtain the original question text vector.

[0149] In some embodiments, the original question text can be converted into an original question text vector through a word embedding model, that is, each word in the original question text is represented as a vector of a fixed length, and a neural network is trained to learn the vector representation of the words. The vectors of all words are concatenated to obtain the vector representation of the original question text.

[0150] In step 1072, the answer material is vectorized to obtain an answer material vector.

[0151] In some embodiments, the method of converting the original question text into the original question text vector described above can be similarly used to convert the answer material into an answer material vector.

[0152] In step 1073, the original question text vector and the answer material vector are concatenated to obtain a first vector.

[0153] In some embodiments, the original question text vector and the answer material vector are added together, that is, they are merged in the order of elements, and a new vector is returned as the first vector.

[0154] In step 1074, the first vector is encoded to obtain a second vector.

[0155] In some embodiments, the first vector can be encoded by the encoder of the transformer component of ChatGPT. The encoder is used to convert the input sequence into a series of abstract feature representations, that is, the first vector is converted into a second vector.

[0156] In step 1075, the second vector is decoded to obtain the target answer result.

[0157] In some embodiments, the second vector can be decoded by the decoder of the transformer component of ChatGPT. The decoder is used to generate a target sequence according to the feature representation obtained by the encoder, that is, the second vector is converted into the target answer result.

[0158] The embodiments of the present application implement data query based on a language understanding model, which can utilize the characteristics of the language understanding model to automatically disassemble the query steps, avoid the query limitations caused by querying according to fixed steps, reduce the error rate, and reduce the usage cost. At the same time, the language understanding model can make automatic predictions based on existing data, enriching the user experience.

[0159] Next, the exemplary application of the embodiments of the present application in an actual application scenario will be described.

[0160] In the Q&A scenario based on ChatGPT, refer to Figure 4 , Figure 4It is a schematic diagram of question and answer for data query provided by an embodiment of the present application. In Figure 4 after obtaining the original question text, intent query will be performed according to the original question, then the question will be normalized, and an execution plan will be listed.

[0161] Exemplarily, referring to Table 1, Table 1 shows the process of the data query method.

[0162]

[0163] Table 1

[0164] ChatGPT will select the application programming interface (API) in a specific open application programming interface (OpenAPI) plugin to execute the above plan, so as to obtain the result. For example: using Dashboard_Plugin.get_metrics_post to obtain a data report related to the number of game registrations, that is, using the get_metrics_post API in the Dashboard_Plugin plugin to perform the execution operation.

[0165] Refining the above data query process can be divided into the following parts: obtaining the original question text, intent recognition module, normalization module, proxy entity scheduling module, and data summary module.

[0166] First of all, the intent recognition module is mainly used for intent recognition, and different intents correspond to different proxy entities. The intents can be: data query, data prediction, knowledge base question and answer.

[0167] The intent recognition uses the call prompt engineering. The user's questions are classified into different intents by GPT. The way used is through the preset prompt and selecting the two most similar examples related to the user's question, so that GPT gives a json-parsable reply to the user's answer.

[0168] Exemplarily, it can be stated in the prompt that when keywords such as active users / retention rate / churn rate / registration / payment / new users appear in the original question text, they are all data query intents.

[0169] Secondly, the normalization module needs to normalize the frequently asked game metrics and normalize the time (to specific start and end times). Add some additional information for data verification.

[0170] Among them, indicator normalization is to map the original indicators to standard indicators according to some preset field mapping relationships; for example, a common indicator mapping table is maintained. For example: "download", "download volume", "download times", "installation", "download count", "number of downloads", "number of download users", "download users", "download user volume", "download user times" will all be mapped to "download data".

[0171] Time normalization will use some regular rules to map the original indicators of some common time expressions to standard indicators. For example, map the start date (start_date) to the form of YYYY-MM-DD, and map the end date (end_date) to the form of YYYY-MM-DD. For example: data for the last 3 days is required. If today is October 27, 2023, then start-date is 2023-10-25 and end_date is 2023-10-27. If the time does not match the regular rules, GP T will be used to parse the time.

[0172] Next, the overall logical framework of the proxy entity scheduling module is divided into an Index module and a Query module. Among them, the role of the proxy entity in the entire scheduling process is like a customer service brain. Various plugins are the extended capabilities of different tools in the proxy entity, which can select whether to use a tool and which tool to use to answer the user's question based on the user's question and the previous result. For different intents, different proxy entities will be used to execute, and the tools available to different proxy entities are different. This module can be developed based on the open-source framework (LangChain) using large language models in combination with OpenAPI. Specifically, Langchain's OpenAPI agents and question-answering chains (QA Chain) are used.

[0173] See Figure 5 , Figure 5 is the process schematic diagram of the proxy entity scheduling module provided by the embodiments of the present application. In Figure 5 it shows the respective implementation processes of the Index module and the Query module in the proxy entity scheduling module and the association between the two modules.

[0174] The Index module is mainly used to build a vector database, such as Figure 5As shown in the process within the dashed box, it mainly includes four steps: 1. Load the pre-set question files in the knowledge base. For different types of files, there will be different loaders; 2. For long documents, the document will be sliced into small segments to meet the document limit requirements of GPT; 3. For the sliced segments, the embedding interface of OpenAI will be used for vectorization; 4. Store the vector data in the vector database for use.

[0175] The vector database is used to store the vectorized text in the database. Its great advantage is that it can quickly find the closest several vectors, thereby obtaining the corresponding text. Based on this, some knowledge content is vectorized and stored in the vector database, such as the question vectors corresponding to the question files. Among them, the question files include question texts and the answer materials corresponding to the question texts. In use, the query function of the vector database can be used, and the similarity algorithm is used to obtain K vectors with high similarity.

[0176] The Index module refers to vectorizing the text and storing it in the vector database. For example, there is the following text: Sentence 1: The release time of the game…; Sentence 2: The number of active users of the game…; Sentence 3: The game is launched in the following regions…. Using the Index module, the sentences will first be sliced into segments according to the required length, and then vectorized. Here, the vectorization uses OpenAI's embedding API, and the embedding of the corresponding sentences can be obtained. If the lengths of the above sentences all meet the requirements and are not sliced into multiple segments, then the following embeddings (the following embeddings are fictional) can be obtained: Embedding 1: 1221…222 (corresponding to Sentence 1); Embedding 2: 1222…333 (corresponding to Sentence 2); Embedding 3: 1223…444 (corresponding to Sentence 3).

[0177] Another example: For a 10,000-word txt-format usage document, including the usage instructions of the information system, the news system, the business intelligence system, etc. First, use the text loader to load the content, with 300 words as a segment (this is because the embedding of the model has a length limit, and generally, too long a length will introduce too much noise). Then, perform embedding on each sub-segment. Here, embedding is to map the text to a high-dimensional space vector, and this space vector has the characteristic that the content with the same or related language expressions is very close in the high-dimensional space. For these segments, they will be directly stored in the vector database dedicated to storing vectors.

[0178] Query is mainly used to query answer materials corresponding to the original question text. For example, Figure 5 as shown, it includes a total of 9 steps from step 501 to step 509.

[0179] In step 501, input; specifically: obtain the standardized question text after normalizing the original question text.

[0180] For example, if the original question text is "Query the download volume of game A in the past seven days" and today is October 19, 2023, then the standardized question text is "Query the download data of game A from 2023.10.12 to 2023.10.19".

[0181] In step 502, determine the proxy entity corresponding to the intent.

[0182] In some embodiments, according to the intent of the original question text, the corresponding proxy entity is adopted, and each proxy entity corresponds to a certain ability. Similar to each proxy entity having its own area of expertise, just like the customer service of different stores corresponding to different merchants, each has its own familiar products and abilities. For different intents, different proxy entities will be used to execute. After determining the intent, it is also necessary to obtain the object permissions of the source object of the original question text, compare the object permissions of the source object with the call permissions of different proxy entities to determine the highest call permission that can be called based on the object permissions of the source object, and use the proxy entity corresponding to the highest call permission as the target proxy entity.

[0183] For example, Table 2 shows three different intents and the proxy entities corresponding to the permissions of different source objects in each intent.

[0184]

[0185]

[0186] Table 2

[0187] In step 503, splice the preset prompt word template with the standardized question text to obtain the prompt text.

[0188] In some embodiments, for different questions, there are preset prompt word templates, and it is necessary to splice the standardized question text and the preset prompt word template. For example, if it is required to get a Chinese answer from GPT, the requirement for a Chinese answer will be added to the prompt word template to make the answer result of GPT more in line with the requirements. And it will tell GPT through the prompt word template that when querying data, it is usually necessary to use permission control first and then query data.

[0189] In step 504, perform vectorization processing on the prompt text to obtain the prompt text vector.

[0190] In step 505, the prompt vector is matched with the vectors in the vector database, and it is judged whether a query result can be obtained.

[0191] In some embodiments, the vector database at this time has been constructed through the above Index module. Using the retrieval function of the vector database, the most relevant knowledge base content is obtained. Such content may be, for example, "The information system supports...", "Users can use the information system through...", etc. The top K most matching segments are obtained from the vector database. When K = 1 and the question text is "In how many countries is King of Glory launched?", first, the embedding API of OpenAI is called to obtain the following embedding: 1221…223. Then, the cosine distance of the K = 1 segment with the smallest cosine distance is calculated using the similarity algorithm. It is found that the distance of Embedding 1 is the smallest, that is, sentence 1 best matches the requirement, so sentence 1 is obtained as the query result for subsequent use.

[0192] During the query process, a similarity threshold can be set. When the similarity calculation result is greater than or equal to the similarity threshold, it is considered that a query result can be obtained, and step 506 is executed; when the similarity calculation result is less than the similarity threshold, it is considered that no query result is obtained, and step 507 is executed.

[0193] In step 506, when a query result is obtained, the query result and the original question text are input into the language understanding model to generate the target answer result.

[0194] In step 507, when no query result is obtained, the target tool required by the proxy entity is selected according to the proxy description file, and then the plugin required by the target tool is selected according to the plugin description file.

[0195] In some embodiments, there is a proxy description file belonging to each proxy entity. When defining the proxy entity, the corresponding capabilities of the proxy entity will be told, and a text defining the capabilities is given to the proxy entity. For example, tell the proxy entity "You are a proxy entity for information query. You can do things 1, things 2, things 3...", and list all the tools of the proxy entity and the corresponding descriptions of each tool, "You need to answer the user's questions based on the above tools."

[0196] After determining the tools required by the proxy entity, load the description file of the plugin. The plugin description file contains input, description, and output. Among them, the output interprets the returned result, such as explaining what the meaning of the returned field represents, that is, when telling the plugin what content to input, this type of plugin can be used, as well as which API of this type of plugin to call (description). By calling this API, the output corresponding to the input content can be obtained. Proxy entities with different capabilities correspond to different tools. Tools can have multiple types, and each type of tool corresponds to the same type of plugin. For example, tool1 only corresponds to interface-type plugins (APIs), and there are also code-type plugins (Python functions or C++ functions, etc.), model plugins, etc. Among them, interface-type plugins: can directly obtain data by calling the already written interfaces. For example, when calling an http link, just pass the parameters to it, and the result will be returned; model plugins: for example, when calling a classification model and passing the parameters to the model, the result will be obtained; code-type plugins: for example, when calling functions written in Python or C++ languages to obtain data. Just give the plugin specific input, and the result can be obtained.

[0197] Among them, the way to obtain the plugin is to expand the capabilities of GPT according to business requirements. If you want to perform metric queries, an API for metric queries and its dependent APIs (such as the name of the metric, supported metrics, etc.) will be constructed.

[0198] In step 508, break down the problem and obtain answer materials through the plugin.

[0199] In some embodiments, the execution of each proxy entity is divided into intermediate steps and final steps. The result of the intermediate steps is used to determine what plugin to use next and whether to end. The final step is to obtain answer materials. Among them, obtaining the result may require multiple steps, that is, multiple plugins need to be called. The steps are not customized but are automatically judged by the logical ability of GPT.

[0200] For example: "Query the download situation of game A from October 12, 2023, to October 19, 2023". First, GPT believes that it is necessary to first use the "API for querying game IDs" to obtain the game ID. The game ID corresponding to game A is youxi1234 (at this time, it has not ended and is still in the Action state);

[0201] After obtaining youxi1234, it is necessary to know what the metrics for downloads are, so the API for metric mapping will be called to query the metrics for downloads, and the metric obtained is download (at this time, it has not ended and is still in the Action state);

[0202] After obtaining youxi1234, the indicator download, and knowing the time range, the API for data query will be used to query data and obtain answer materials. When the answer materials are obtained, GPT will automatically stop calling the plugins in the tool (at this time, it ends and is in the Finish state).

[0203] When performing data query, the interface type plugins (APIs) are used at this time. There are various different APIs, such as: API for data query: This API is the most direct interface for data query, but the parameters to be passed in include the game id, the name of the indicator field, the time period, as well as the filtering conditions and aggregation conditions; API for indicator mapping: This API can know the field name of the indicator to be queried in the API for data query; API for condition mapping: This API can know the field name of the condition to be filtered. For example, when querying the indicators for the ios system, it is necessary to know what value ios stores in the data query interface, such as ios = 2, etc.; API for game id query: This API can know what the game id is. It should be noted here that not all APIs will be used. For example, in the above example, the API for condition mapping is not used because there are no other restrictive conditions.

[0204] During the data query process, if the result obtained is an error, "Sorry, I can't answer your question for now" will be returned.

[0205] The principle of the step-by-step process is as follows: Through the plugin description file, GPT knows that there are several above-mentioned APIs to choose from when querying data. Then GPT will, based on the plugin description file and the question, judge the next step in the way of collaborative reasoning and action (ReAct, Reason and Act). For example, it will first think (thought), judge that the API "get_metrics_map_post" is needed to obtain what the download volume indicator is, and according to the description of the API, give the input parameters, then execute the API to get the result, and then obtain the next thought based on this result. If an error code is obtained, it will retry; if the correct result is obtained, such as the download volume indicator is download, it will use this indicator to obtain the next thought. When the download volume indicator and the time range are obtained, the "get_metrics_post" can be called to obtain the result and it is considered that the task has been completed, otherwise it will continue to try to call different APIs.

[0206] In step 509, the target answer result is obtained.

[0207] In some embodiments, the original question text and answer materials are input into ChatGPT to generate the target answer result. Among them, the output form can be text, picture, chart, code, and so on.

[0208] In Figure 5 it, the overall process is further split into different modules, including: user interaction module, large model module, framework core scheduling module, extension plugin module, data / knowledge base loading / retrieval module. Refer to Table 3, and Table 3 records the descriptions of each module.

[0209]

[0210] Table 3

[0211] Finally, the data summary module is used to return the target answer result to the user, and conduct data insight analysis on the data through GPT, including data anomaly detection, result analysis, etc.

[0212] The embodiments of the present application automatically plan the steps of data query based on a language understanding model, not limited to fixed execution steps. By introducing multiple proxy entities, different proxy entities contain tools with different capabilities. When the intentions of the original text are different, it can quickly match the appropriate tools in the proxy entity to solve problems targeted, reducing the error rate of the results. At the same time, through the plugin description file, the tool can call different types of plugins to solve the corresponding problems, realizing the decoupling of capabilities. The plugins can be added or changed at any time, thereby improving the scalability of capabilities and realizing controllable query. Query according to the pre-set proxy description file, plugin description file, prompt template and other files, enhancing the query efficiency and reducing the query cost.

[0213] Next, continue to describe the exemplary structure of the data query device 233 provided by the embodiments of the present application as software modules. In some embodiments, as Figure 2 shown, the software modules stored in the data query device 233 in the memory 230 may include:

[0214] The data acquisition module 2331 is used to acquire the original question text.

[0215] The intention recognition module 2332 is used to recognize the intention of the original question text and determine the target proxy entity corresponding to the intention from multiple candidate proxy entities.

[0216] The metric mapping module 2333 is used to map multiple original metrics in the original question text to multiple standard metrics based on a pre-configured metric mapping table.

[0217] The metric substitution module 2334 is used to substitute multiple original metrics in the original question text with multiple standard metrics to obtain the standard question text.

[0218] A data splicing module 2335, configured to splice a standard question text with a preset prompt template to obtain a prompt text.

[0219] A material generation module 2336, configured to generate at least one answer material corresponding to the prompt text through a target proxy entity.

[0220] A result generation module 2337, configured to generate a target answer result based on the original question text and at least one answer material.

[0221] In some embodiments, the intent recognition module 2332 is further configured to obtain a pre-configured intent mapping table, where the intent mapping table includes mapping relationships between multiple candidate proxy entities and multiple different intents; query the intent mapping table based on the intent of the original question text, and use the proxy entity associated with the intent of the original text obtained by the query as the target proxy entity corresponding to the intent.

[0222] In some embodiments, when there are multiple proxy entities associated with the intent of the original text, the intent recognition module 2332 is further configured to, in response to querying multiple proxy entities associated with the intent of the original question text, obtain the invocation permission of each proxy entity, where the invocation permission represents the minimum permission required to invoke the proxy entity; obtain the object permission of the source object of the original question text, compare the object permission of the source object with the invocation permissions of different proxy entities to determine the highest invocation permission that can be invoked based on the object permission of the source object, and use the proxy entity corresponding to the highest invocation permission as the target proxy entity.

[0223] In some embodiments, the metric mapping module 2333 is further configured to extract multiple original metrics from the original question text; query the metric mapping table based on each original metric to obtain the standard metrics that have mapping relationships with each original metric.

[0224] In some embodiments, the material generation module 2336 is further configured to obtain a pre-set proxy description file, where the proxy description file records the data processing capabilities included in each tool in the target proxy entity; determine the data processing capabilities that match the prompt text, and use the tool with the matching data processing capabilities as the target tool; call the target tool in the target proxy entity based on the prompt text to perform a text generation operation to obtain at least one answer material.

[0225] In some embodiments, the material generation module 2336 is further configured to obtain a preset plug-in description file, where the plug-in description file records multiple different types of plug-ins encapsulated in each tool, and the multiple different types of plug-ins are used to generate multiple different types of answer materials. The multiple different types of plug-ins include: a metric mapping plug-in, a data query plug-in, and multiple field query plug-ins associated with multiple keyword fields; obtain at least one keyword field based on the prompt text; perform the following processing for each keyword field: use the plug-in associated with the keyword field as the target plug-in; call the target plug-in based on the prompt text to generate at least one answer material.

[0226] In some embodiments, the keyword field includes a field value. When the number of at least one keyword field is multiple, the material generation module 2336 is further configured to call a language understanding model to generate multiple steps for obtaining answer materials; read the multiple steps in sequence, and perform the following processing for each intermediate step read: extract the keyword field in the intermediate step, and call the target field query plug-in to query the field value corresponding to the keyword field in the intermediate step, where the target field query plug-in is the field query plug-in associated with the keyword field in the intermediate step, and the intermediate step is the step except for the last two steps in the multiple steps; extract the keyword field in the penultimate step, and call the metric mapping plug-in to query the corresponding metric based on the keyword field in the penultimate step; query the field value included in the keyword field in the last step according to the field value and the metric included in the keyword field in each intermediate step by calling the data query plug-in.

[0227] In some embodiments, before generating at least one answer material corresponding to the prompt text through the target proxy entity, the material generation module 2336 is further configured to obtain the prompt vector of the prompt text; query the vector database based on the prompt vector, where the vector database includes the question vectors corresponding to the preset question files; output the query result in response to querying the query result in the vector database; and transfer to the process of generating at least one answer material corresponding to the prompt text through the target proxy entity in response to not querying the query result in the vector database.

[0228] In some embodiments, before querying the vector database based on the prompt vector, the material generation module 2336 is further configured to obtain multiple preset question files in the knowledge base, where the question file includes the question text and the answer material corresponding to the question text; perform vectorization processing on the multiple question files to obtain the question vectors corresponding to each question file; and construct the vector database based on the multiple question vectors.

[0229] In some embodiments, the material generation module 2336 is further configured to divide a problem file whose number of included characters exceeds a character number threshold into multiple text blocks; perform vectorization processing on the text blocks to obtain text block vectors for each text block; and use the text block vectors of each text block in each problem file as the problem vectors corresponding to the problem file.

[0230] In some embodiments, the result generation module 2337 is further configured to vectorize the original problem text to obtain an original problem text vector; vectorize the answer material to obtain an answer material vector; splice the original problem text vector and the answer material vector to obtain a first vector; encode the first vector to obtain a second vector; and decode the second vector to obtain a target answer result.

[0231] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions, and the computer program or computer-executable instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium, and the processor executes the computer-executable instructions, so that the electronic device executes the data query method described above in the embodiments of the present application.

[0232] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, where computer-executable instructions or a computer program are stored. When the computer-executable instructions or the computer program are executed by a processor, the processor will be caused to execute the data query method provided in the embodiments of the present application. For example, Figure 3A the data query method shown.

[0233] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0234] In some embodiments, the computer-executable instructions may be in the form of a program, software, software module, script, or code, and may be written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0235] By way of example, the computer-executable instructions may or may not correspond to files in a file system, and may be stored as part of a file that holds other programs or data. For example, they may be stored in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program under discussion, or in multiple cooperating files (e.g., files that store one or more modules, subroutines, or portions of code).

[0236] By way of example, the computer-executable instructions may be deployed to execute on one electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.

[0237] In summary, through the steps of automatically planning data queries based on a language understanding model in the embodiments of the present application, it is not limited to fixed execution steps. By introducing multiple agent entities, different agent entities contain tools with different capabilities. When the intents of the original text are different, it is possible to quickly match the appropriate tools in the agent entities to solve problems targeted, reducing the error rate of the results. At the same time, by means of a plug-in description file, the tool can call different types of plug-ins to solve corresponding problems, achieving decoupling of capabilities. Plug-ins can be added or changed at any time, thus enhancing the scalability of capabilities and achieving controllable queries. Querying according to preset files such as agent description files, plug-in description files, and prompt templates enhances the query efficiency and reduces the query cost.

[0238] The above description is only for the embodiments of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A data query method, characterized in that The method includes: Obtain the original problem text; Identify the intention of the original problem text, and determine a target proxy entity corresponding to the intention from multiple candidate proxy entities; Based on a pre-configured metric mapping table, map multiple original metrics in the original problem text to multiple standard metrics; Based on the multiple standard metrics, replace the multiple original metrics in the original problem text to obtain a standard problem text; Concatenate the standard problem text with a pre-set prompt template to obtain a prompt text; Generate at least one answer material corresponding to the prompt text through the target proxy entity; Generate a target answer result based on the original problem text and the at least one answer material.

2. The method according to claim 1, wherein The determining a target proxy entity corresponding to the intention from multiple candidate proxy entities includes: Obtain a pre-configured intention mapping table, where the intention mapping table includes mapping relationships between multiple candidate proxy entities and multiple different intentions; Query the intention mapping table based on the intention of the original problem text, and use the proxy entity associated with the intention of the original text obtained by the query as the target proxy entity corresponding to the intention.

3. The method according to claim 2, wherein In response to querying multiple proxy entities associated with the intention of the original problem text, obtain the invocation permission of each proxy entity, where the invocation permission represents the minimum permission required to invoke the proxy entity; Obtain the object permission of the source object of the original problem text, compare the object permission of the source object with the invocation permissions of different proxy entities to determine the highest invocation permission that can be invoked based on the object permission of the source object, and use the proxy entity corresponding to the highest invocation permission as the target proxy entity.

4. The method according to claim 1, wherein The metric mapping table includes mapping relationships between multiple different original metrics and multiple different standard metrics; The mapping of multiple original metrics in the original problem text to corresponding multiple standard metrics based on a pre-configured metric mapping table includes: Extract multiple original metrics from the original problem text; Query the metric mapping table based on each original metric to obtain the standard metric having the mapping relationship with each original metric.

5. The method according to claim 1, wherein Each proxy entity is associated with multiple different types of tools, and the different types of tools have different data processing capabilities; The generating at least one answer material corresponding to the prompt text through the target proxy entity includes: Obtain a pre-set proxy description file, where the proxy description file records the data processing capabilities included in each tool in the target proxy entity; Determine the data processing capability matching the prompt text, and use the tool having the matching data processing capability as the target tool; Call the target tool in the target agent entity based on the prompt text to perform a text generation operation, and obtain at least one answer material.

6. The method according to claim 5, wherein The step of calling the target tool in the target agent entity based on the prompt text to perform a text generation operation and obtain at least one answer material includes: Obtain a pre-set plug-in description file, where the plug-in description file records a plurality of different types of plug-ins encapsulated in each tool, and the plurality of different types of plug-ins are used to generate a plurality of different types of answer materials. The plurality of different types of plug-ins include: a metric mapping plug-in, a data query plug-in, and a plurality of field query plug-ins associated with a plurality of keyword fields; Obtain at least one keyword field based on the prompt text; Perform the following processing for each keyword field: Use the plug-in having an association relationship with the keyword field as the target plug-in; Call the target plug-in based on the prompt text to generate at least one answer material.

7. The method according to claim 6, wherein The keyword field includes a field value; When the number of the at least one keyword field is multiple, the step of obtaining at least one keyword field based on the prompt text includes: Call a language understanding model to generate a plurality of steps for obtaining the answer material; Read the plurality of steps in sequence, and perform the following processing for each intermediate step read: Extract the keyword field in the intermediate step, and call the target field query plug-in to query the field value corresponding to the keyword field in the intermediate step. The target field query plug-in is the field query plug-in associated with the keyword field in the intermediate step, and the intermediate step is a step other than the last two steps in the plurality of steps; Extract the keyword field in the second-to-last step, and call the metric mapping plug-in to query the corresponding metric based on the keyword field in the second-to-last step; Call the data query plug-in to query the field value included in the keyword field in the last step according to the field value included in the keyword field in each intermediate step and the metric.

8. The method according to any one of claims 1 to 7, characterized in that The step of generating a target answer result based on the original question text and the at least one answer material includes: Vectorize the original question text to obtain an original question text vector; Vectorize the answer material to obtain an answer material vector; Concatenate the original question text vector and the answer material vector to obtain a first vector; Encode the first vector to obtain a second vector; Decode the second vector to obtain a target answer result.

9. The method according to any one of claims 1 to 7, characterized in that, Before generating at least one answer material corresponding to the prompt text through the target agent entity, the method further includes: Obtain a prompt vector of the prompt text; Query a vector database based on the prompt vector, where the vector database includes question vectors corresponding to pre-set question files; In response to querying a query result in the vector database, output the query result. In response to the query result not being found in the vector database, the process proceeds to execute the process of generating at least one answer material corresponding to the prompt text by the target proxy entity.

10. The method according to claim 9, wherein Before querying the vector database based on the prompt vector, the method further includes: Obtaining a plurality of pre-set question files in the knowledge base, where the question files include question texts and answer materials corresponding to the question texts; Performing vectorization processing on the plurality of question files to obtain question vectors corresponding to each of the question files; Constructing the vector database based on the plurality of question vectors.

11. The method according to claim 10, characterized in that, The performing vectorization processing on the plurality of question files to obtain question vectors corresponding to each of the question files includes: Dividing the question files whose included number of characters exceeds the character number threshold into a plurality of text blocks; Performing vectorization processing on the text blocks to obtain text block vectors for each of the text blocks; Using the text block vectors of each text block in each question file as the question vector corresponding to the question file.

12. A data query device, characterized in that, The apparatus includes: A data acquisition module, configured to acquire the original question text; An intent recognition module, configured to recognize the intent of the original question text and determine a target proxy entity corresponding to the intent from a plurality of candidate proxy entities; An index mapping module, configured to map a plurality of original indexes in the original question text to a plurality of standard indexes based on a pre-configured index mapping table; An index substitution module, configured to substitute the plurality of original indexes in the original question text with the plurality of standard indexes to obtain a standard question text; A data splicing module, configured to splice the standard question text with a pre-set prompt template to obtain a prompt text; A material generation module, configured to generate at least one answer material corresponding to the prompt text through the target proxy entity; A result generation module, configured to generate a target answer result based on the original question text and the at least one answer material.

13. An electronic device, characterized in that, The electronic device includes: A memory, configured to store computer-executable instructions; A processor, configured to implement the data query method according to any one of claims 1 to 11 when executing the computer-executable instructions stored in the memory.

14. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, The computer-executable instructions or the computer program, when executed by the processor, implement the data query method according to any one of claims 1 to 11.

Citation Information

Cited By

  • Target detection method, device and equipment

    CN120807899A

  • A target detection method, device and equipment

    CN120807899B