Information query method, system, device and equipment, storage medium and program product
By filtering user intentions and determining target query capabilities, the integration of data table query and API scheduling is achieved, and the problem of unsuccessful response to mixed demand scenarios in the existing technology is solved, and the flexibility and user experience of scenario support are improved.
Patent Information
- Application Number
- CN202411129063.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-24
AI Technical Summary
现有技术难以在一个接入业务中同时进行数据表查询和API调度,无法准确分类到不同的流程分支,导致无法应对混合需求场景,且用户体验不佳。
By obtaining user intent, filtering data tables and APIs, determining target query capabilities, and performing data table query or API scheduling, it realizes the integration of data table query and API scheduling, which is suitable for the mixed needs of both data table query and API scheduling. Scenario, improve the flexibility and versatility of scene support.
It realizes accurate classification and convergence of data table query and API scheduling without introducing process branch intent classification, improving user experience and flexibility in querying data.
Smart Images

Figure CN119179716A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an information query method, system, device, equipment, storage medium and program product. Background Art
[0002] Most of the network management capabilities and tools accumulated by the network exist in the form of API (Application Programming Interface), which is used to support efficient online operation and maintenance of different data analysis scenarios. At the same time, some fixed data queries are also exposed to the outside world through service-oriented APIs in the form of capability encapsulation. In this case, service consumers are not aware of the underlying data source, but only the service API.
[0003] At present, in order to meet the diverse data analysis needs and capability / tool scheduling needs in the network field, the main focus is on building data query based on LLM (Large Language Model) and API scheduling based on LLM. In a scenario where data query and API scheduling exist at the same time in a certain access service, the pre-intention classification is generally used to distinguish whether to execute the process branch of data query based on LLM or the process branch of API scheduling based on LLM. However, the existing intent classification based solely on user questions cannot accurately classify into different branches. For example, user question 1: query the online address of ONU (Optical Network Unit), user question 2: query the device information of OLT (optical line terminal), user question 1 is queried through API, and user question 2 is obtained through the data table. The pre-intention classification cannot distinguish the process branches; and the data query based on LLM and the API scheduling based on LLM are executed independently of each other, which cannot cope with the mixed demand scenario of an access service with both data query and API scheduling. Summary of the invention
[0004] In response to the problems existing in the prior art, the embodiments of the present invention provide an information query method, system, device, equipment, storage medium and program product, which realize the integrated use of data table query and API scheduling capabilities without introducing process branch intention classification. It is suitable for mixed demand scenarios in which access services have both data table query and API scheduling, and improves the flexibility and versatility of scenario support.
[0005] In a first aspect, an embodiment of the present invention provides an information query method, which is applied to a server, comprising:
[0006] Obtaining a query request input by a user, and determining the user's intention based on the query request;
[0007] Filter the pre-accessed data table according to the user intention to obtain a data table filtering result;
[0008] Filter the pre-stored APIs according to the user's intention to obtain an API filtering result;
[0009] Determining target query capabilities according to the data table screening results and the API screening results;
[0010] The query is performed through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request, and the query result is displayed.
[0011] As an improvement of the above solution, determining the user intention according to the query request includes:
[0012] The query request is translated according to its intent using a preset first language model to obtain the user intent; wherein the user intent includes a first general dimension.
[0013] As an improvement of the above solution, the first general dimension includes at least one of the following dimensions: time dimension, space dimension, and scene dimension.
[0014] As an improvement of the above solution, the pre-accessed data table is screened according to the user intention to obtain the data table screening result, including:
[0015] Matching the first general dimension in the user intention with the second general dimension of the pre-accessed data table respectively, and filtering out data tables whose second general dimension is consistent with the first general dimension from the pre-accessed data table to obtain a first-level screening result of the data table;
[0016] When the primary screening result of the data table is a null value, obtaining table function descriptions and / or table descriptions of all the data tables, screening all the data tables according to the query request and the table function descriptions and / or table descriptions of the data tables, and obtaining the data table screening result;
[0017] When there are at least two data tables in the data table primary screening result, obtaining table function descriptions and / or table descriptions of the at least two data tables, screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables, and obtaining the data table screening result;
[0018] When there is one data table in the data table primary screening result, the table name and table description of the corresponding data table are obtained as the data table screening result.
[0019] As an improvement of the above solution, screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables to obtain the data table screening results includes:
[0020] For the at least two data tables, calculating a first similarity between the query request and a table function description and / or a table description of each of the data tables;
[0021] When the first similarity corresponding to any of the data tables is greater than a preset first similarity threshold, obtaining a table name, table function description, and table description of the corresponding data table as the data table screening result;
[0022] When the first similarities corresponding to all the data tables are not greater than the first similarity threshold, a historical question query is performed on the query request, and the queried target historical question and its corresponding answer indicator and the table name of the data table are used as the data table screening result.
[0023] As an improvement of the above solution, the querying of historical issues on the query request includes:
[0024] Calculating a second similarity between the query request and the historical question;
[0025] When the second similarity corresponding to any one of the historical questions is greater than a preset second similarity threshold, obtaining the corresponding historical question as a target historical question;
[0026] When the second similarities corresponding to all the historical questions are not greater than the second similarity threshold, first prompt information instructing the user to re-enter the query request is triggered and displayed.
[0027] As an improvement of the above solution, determining the target query capability according to the data table screening result and the API screening result includes:
[0028] Determine whether the data table screening result is a null value and whether the API screening result is a null value;
[0029] When the API screening result is not a null value, determining a target query capability indicating API scheduling;
[0030] When the data table screening result is not a null value and the API screening result is a null value, a target query capability indicating a data table query is determined.
[0031] As an improvement of the above solution, querying through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request includes:
[0032] When the target query capability indicates a data table query, finely screening the data table indicated by the data table screening result to determine table query parameters;
[0033] The query result of the query request is obtained through the external system interface connected to the table query parameter.
[0034] As an improvement of the above solution, querying through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request includes:
[0035] When the target query capability indicates API scheduling, finely screening the API indicated by the API screening result to determine API parameters;
[0036] The query result of the query request is obtained through the external system interface connected by the API parameter.
[0037] As an improvement of the above solution, before the external system interface connected through the API parameter obtains the query result of the query request, the method includes:
[0038] Using the API parameters to try to schedule the external system interface to which it is connected;
[0039] When the scheduling is successful, the query result of the query request is obtained through the external system interface connected to the API parameter;
[0040] When the scheduling fails, determining whether the data table screening result is a null value;
[0041] When the data table screening result is not a null value, fine screening is performed on the data table indicated by the data table screening result to determine table query parameters;
[0042] The query result of the query request is obtained through the external system interface connected to the table query parameter.
[0043] As an improvement of the above solution, the step of finely screening the data table indicated by the data table screening result to determine the table query parameter includes:
[0044] When the data table screening result indicates a data table, inputting the query request and the table description of the corresponding data table into a preset second language model to obtain table query parameters;
[0045] When the data table screening result indicates at least two of the data tables, performing data table fine screening by using a preset third language model according to the query request and the data table screening result to obtain a data table fine screening result;
[0046] According to the query request and the data table fine screening result, table query parameters are obtained through the second largest language model.
[0047] As an improvement of the above solution, the method of finely screening the data table by using a preset third language model according to the query request and the data table screening result to obtain the data table fine screening result includes:
[0048] When the data table screening result includes a table function description and a table description of the data table, inputting the query request and the table function description and the table description of the data table indicated by the data table screening result into the third language model for data table fine screening, and obtaining a table name of a target data table as the data table fine screening result;
[0049] The obtaining of table query parameters according to the query request and the data table fine screening result by using the second largest language model includes:
[0050] The query request and the table description of the target data table indicated by the data table fine screening result are input into the second largest language model to obtain table query parameters.
[0051] As an improvement of the above solution, the method of finely screening the data table by using a preset third language model according to the query request and the data table screening result to obtain the data table fine screening result includes:
[0052] When the data table screening result includes the target historical question corresponding to the data table and the corresponding answer indicator, the query request and the target historical question corresponding to the data table indicated by the data table screening result and the corresponding answer indicator are input into the third language model to perform data table fine screening, and obtain the table name and query indicator of the target data table as the data table fine screening result;
[0053] The obtaining of table query parameters according to the query request and the data table fine screening result by using the second largest language model includes:
[0054] The query request, the table description of the target data table indicated by the data table fine screening result, and the query index are input into the second largest language model to obtain table query parameters.
[0055] As an improvement of the above solution, the external system interface connected through the API parameter obtains the query result of the query request, including:
[0056] Verify the API parameters;
[0057] When the verification is passed, the query request is subjected to a time format verification to convert the time information in the query request into a set time format to obtain a target query request;
[0058] According to the target query request, the query result is obtained through the external system interface connected by the API parameter.
[0059] As an improvement of the above solution, the checking of the API parameters includes:
[0060] Determine whether the API parameters include a first setting parameter corresponding to the corresponding API; wherein the first setting parameter is a necessary parameter for scheduling the corresponding API;
[0061] When the API parameters include the first setting parameters corresponding to the corresponding API, the API parameters are sent to the front end, and the API parameters are displayed in the form of a first interactive window;
[0062] When the API parameters do not include the first setting parameters corresponding to the corresponding API, the API parameters and second prompt information indicating the first setting parameters of the API are completed are sent to the front end, and the API parameters and the second prompt information are displayed in the form of a second interactive window;
[0063] Acquire the first setting parameters input by the user in the second interactive window, generate final API parameters according to the API parameters and the first setting parameters, send the finally generated API parameters to the front end, and display the finally generated API parameters in the form of the first interactive window;
[0064] According to the first behavior operation of the user in the first interactive window, it is determined that the corresponding API parameters have passed the security risk verification; wherein, the first behavior operation is the behavior operation of the user on the first interactive window when the user determines that the API call corresponding to the corresponding API parameters does not have a security risk.
[0065] As an improvement of the above solution, the obtaining the query result of the query request through the external system interface connected to the table query parameter includes:
[0066] Verifying the table query parameters;
[0067] When the verification is passed, the query request is subjected to a time format verification to convert the time information in the query request into a set time format to obtain a target query request;
[0068] According to the target query request, the query result is obtained through the external system interface connected to the table query parameter.
[0069] As an improvement of the above solution, the checking of the table query parameters includes:
[0070] Determine whether the table query parameter includes a second setting parameter corresponding to the corresponding data table; wherein the second setting parameter is a necessary parameter for scheduling the corresponding data table;
[0071] When the table query parameter includes the second setting parameter corresponding to the corresponding data table, the table query parameter is sent to the front end, and the table query parameter is displayed in the form of a third interactive window;
[0072] When the table query parameter does not include the second setting parameter corresponding to the corresponding data table, the table query parameter and third prompt information indicating the second setting parameter of the data table to be completed are sent to the front end, and the table query parameter and the third prompt information are displayed in the form of a fourth interactive window;
[0073] Acquire the second setting parameter input by the user in the fourth interactive window, generate final table query parameters according to the table query parameters and the second setting parameters, send the final generated table query parameters to the front end, and display the final generated table query parameters in the form of the third interactive window;
[0074] According to the second behavior operation of the user in the third interactive window, it is determined that the corresponding table query parameters pass the security risk verification; wherein, the second behavior operation is the behavior operation of the user on the third interactive window when it is determined that there is no security risk in the data table call corresponding to the corresponding table query parameter.
[0075] As an improvement of the above solution, before obtaining the query request input by the user and determining the user intention according to the query request, the method further includes:
[0076] Initializing the pre-accessed data table, and storing the relevant information of the data table obtained after the initialization in the first knowledge database;
[0077] Initializing the pre-stored API, and storing the API related information obtained after the initialization in the second knowledge database;
[0078] The historical question-answer pairs within a set time period are initialized, and the relevant information of the historical question-answer pairs obtained after the initialization is stored in the third knowledge database.
[0079] As an improvement of the above solution, the initialization of the pre-accessed data table includes:
[0080] Initialize the pre-accessed data table to obtain the table name, table function description, and table description of the data table in a first standard format;
[0081] Performing a universal dimension rule check on the data table to determine a second universal dimension of the data table;
[0082] According to the table name, table function description, table description and the second general dimension of the data table, relevant information of the data table is obtained.
[0083] As an improvement of the above solution, the initialization of the pre-stored API includes:
[0084] Initialize the pre-stored API to obtain the API name, API function description, and API input parameter definition information of the API in the second standard format;
[0085] Performing a universal dimension rule check on the API to determine a third universal dimension of the API;
[0086] According to the API name, API function description, API input parameter definition information and the third general dimension of the API, relevant information of the API is obtained.
[0087] As an improvement of the above scheme, the general dimension rule verification includes time format verification, space verification and scene verification; wherein, the time format verification is used to determine the time information corresponding to the data table or the API and convert the time information into a time dimension of a set time format; the space verification is used to determine the spatial information corresponding to the data table or the API and convert the spatial information into a spatial dimension of a set spatial format; the scene verification is used to determine the query scene information corresponding to the data table or the API and convert the query scene information into a scene dimension of a set scene format.
[0088] As an improvement of the above solution, the pre-stored APIs are screened according to the user intention to obtain the API screening result, including:
[0089] Matching the first general dimension in the user intention with the third general dimension of the pre-stored APIs respectively, and filtering out APIs whose third general dimension is consistent with the first general dimension from the APIs to obtain a first-level screening result of the APIs;
[0090] When the API first-level screening result is a null value, obtaining API function descriptions and / or API input parameter definition information of all the APIs, screening all the APIs according to the query request and the API function descriptions and / or API input parameter definition information of the APIs, and obtaining the API screening result;
[0091] When there are at least two APIs in the API first-level screening result, obtain API function descriptions and / or API input parameter definition information of the at least two APIs, and screen the at least two APIs according to the query request and the API function descriptions and / or API input parameter definition information of the at least two APIs to obtain the API screening result;
[0092] When there is one API in the API first-level screening result, the API name of the corresponding API and its API input parameter definition information are obtained as the API screening result.
[0093] In a second aspect, an embodiment of the present invention provides an information query method, which is applied to a user terminal, including:
[0094] Receive a query request input by a user on a user interface, and send the query request to a server, so that the server performs the following operations:
[0095] Determining user intent based on the query request;
[0096] Filter the pre-accessed data table according to the user intention to obtain a data table filtering result;
[0097] Filter the pre-stored APIs according to the user's intention to obtain an API filtering result;
[0098] Determining target query capabilities according to the data table screening results and the API screening results;
[0099] Performing a query through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request;
[0100] The query result sent by the server is received, and the query result is displayed on a user interface.
[0101] In a third aspect, an embodiment of the present invention provides an information query system, which is applied to a server, and includes:
[0102] A user intention determination module, used to obtain a query request input by a user and determine the user intention based on the query request;
[0103] A data table screening module, used to screen the pre-accessed data table according to the user's intention to obtain a data table screening result;
[0104] An API screening module is used to screen the pre-stored APIs according to the user's intention and obtain API screening results;
[0105] A target query capability determination module, used to determine the target query capability according to the data table screening result and the API screening result;
[0106] The query display module is used to query through the data table query or API scheduling corresponding to the target query capability, obtain the query result of the query request, and display the query result.
[0107] In a fourth aspect, an embodiment of the present invention provides an information query device, applied to a user terminal, comprising:
[0108] The query request receiving module is used to receive the query request input by the user on the user interface and send the query request to the server so that the server performs the following operations:
[0109] Determining user intent based on the query request;
[0110] Filter the pre-accessed data table according to the user intention to obtain a data table filtering result;
[0111] Filter the pre-stored APIs according to the user's intention to obtain an API filtering result;
[0112] Determining target query capabilities according to the data table screening results and the API screening results;
[0113] Performing a query through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request;
[0114] The query result receiving module is used to receive the query result sent by the server and display the query result on the user interface.
[0115] In a fifth aspect, an embodiment of the present invention provides an information query device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the information query method as described in any one of the first aspect or the information query method as described in the second aspect.
[0116] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the information query method as described in any one of the first aspect or the information query method as described in the second aspect.
[0117] In the seventh aspect, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the information query method as described in any one of the first aspect or the information query method as described in the second aspect.
[0118] Compared with the prior art, an information query method, system, device, equipment, storage medium and program product of an embodiment of the present invention first obtains a query request input by a user, and determines the user intention based on the query request; then filters the pre-accessed data table according to the user intention to obtain the data table filtering result; filters the pre-stored API according to the user intention to obtain the API filtering result; then determines the target query capability according to the data table filtering result and the API filtering result; queries through the data table query or API scheduling corresponding to the target query capability to obtain the query result of the query request, and displays the query result; the embodiment of the present invention simultaneously filters the data table and API accessed by the system, and then integrates the data table query and API call based on the initial screening results of the data table and API. The whole process does not introduce user intention classification of data table query process branches and API scheduling process branches, and is suitable for mixed demand scenarios in which the access business has both data table query and API scheduling, thereby improving the flexibility and versatility of scenario support. BRIEF DESCRIPTION OF THE DRAWINGS
[0119] In order to more clearly illustrate the technical solution of the present invention, the drawings used in the implementation mode will be briefly introduced below. Obviously, the drawings described below are only some implementation modes of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0120] Figure 1 is a flow chart of an information query method provided by an embodiment of the present invention;
[0121] Figure 2 is a schematic diagram of an interface for displaying query results provided by an embodiment of the present invention;
[0122] Figure 3 is another schematic diagram of an interface for displaying query results provided by an embodiment of the present invention;
[0123] Figure 4 This is a schematic diagram of an interface for asking a user to complete information and ask a question again, provided by an embodiment of the present invention;
[0124] Figure 5 is another interface schematic diagram for asking the user to complete the information and ask the question again, provided by an embodiment of the present invention;
[0125] Figure 6 This is a schematic diagram of an interface for asking a user to further refine a question when no answer to a related question is found and no similar historical question is retrieved, provided by an embodiment of the present invention;
[0126] Figure 7 It is a flow chart of data table query and API scheduling integration provided by an embodiment of the present invention;
[0127] Figure 8 is a schematic diagram of an interface in which no answer to a related question is found according to an embodiment of the present invention;
[0128] Fig. 9 is a schematic diagram of a first interactive window provided by an embodiment of the present invention;
[0129] Fig.10 is a schematic diagram of a second interactive window provided by an embodiment of the present invention;
[0130] Fig.11 is a schematic diagram of a third interactive window provided by an embodiment of the present invention;
[0131] Fig.12 is a schematic diagram of a fourth interactive window provided by an embodiment of the present invention;
[0132] Fig.13 It is a flowchart of user intent translation and mapping from user intent to data table / API in a data table query process provided by an embodiment of the present invention;
[0133] Fig.14 It is a flow chart of table query parameter / API parameter confirmation, intent execution, and intent response result presentation in a data table query process provided by an embodiment of the present invention;
[0134] Fig.15 is another flow chart of an information query method provided by an embodiment of the present invention;
[0135] Fig.16 is a schematic diagram of inputting a query request on a user interface of a user terminal provided by an embodiment of the present invention;
[0136] Fig.17 is a schematic diagram of displaying query results on a user interface of a user terminal provided by an embodiment of the present invention;
[0137] Fig.18 is a structural block diagram of an information query system provided by an embodiment of the present invention;
[0138] Fig.19 is a structural block diagram of an information query device provided by an embodiment of the present invention;
[0139] Fig. 20It is a structural block diagram of an information query device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0140] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0141] It is understood that the various numbers involved in the embodiments of the present invention are only for the convenience of description and are not intended to limit the scope of the present application. The size of the sequence number of each process does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.
[0142] In embodiments of the present invention, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. The term "multiple or several" refers to two or more, and the same applies to "multiple / items or several / items". "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0143] The following is an explanation of some terminology concepts and related technologies involved in the embodiments of the present invention.
[0144] The process of data table query based on LLM is as follows:
[0145] LLM selects the data table based on the question and the functional description of the access data table (optionally with the table description (schema));
[0146] LLM extracts query parameters through the schema of the question and the selected data table;
[0147] Generate SQL statements or call data query API to query data.
[0148] The process of API scheduling based on LLM is as follows:
[0149] LLM selects the API based on the question and the functional description of the access API (optionally with the definition of the API input parameters);
[0150] LLM extracts query parameters through the input parameter definition of the question and the selected API;
[0151] According to the query parameters, request the corresponding capability / tool API to make capability / tool calls to query data.
[0152] In the prior art, there are the following problems in performing process branching based on pre-intention classification or formulating different input rules when the user inputs a question, carrying different prefixes or giving different entrances:
[0153] (1) In a scenario where an access service simultaneously includes information table query and API scheduling, the method of prior intention classification or formulating different input rules, carrying different prefixes or giving different entrances when the user inputs the question cannot accurately classify it into different process branches (i.e., data table query process branch and API scheduling process branch). At the same time, when the user inputs the question, regardless of the rules, prefixes or different entrances, the user experience and friendliness will be reduced.
[0154] (2) An access system may have access to N data tables or N APIs. During the data table or API selection phase, since different LLMs have different token input restrictions, entering the functional descriptions of all LLM data tables or APIs at once is likely to cause token overflow.
[0155] (3) When selecting a table / API based on the user question and the functional description of the table / API (optionally with the table schema / API input parameter definition), the selection is made based on the semantic similarity between the two. If there is implicit knowledge between the user question and the expected answer, for example, the user question is: the business development status of the national home business in November 2023, and the functional description of the table is: support monthly query of the number of home broadband users and traffic in the country, provinces and cities, the semantics of the two may not match and accurately establish the association between the question and the table / API description.
[0156] Based on this, the present invention proposes an information query method, which preliminarily screens and finely screens the data tables and APIs accessed by the system, reduces the number of subsequent inputs to the LLM model, thereby shielding the token input restrictions of the LLM model, and integrates the use of data table query and API scheduling based on the screening results of the data table and API. It is suitable for scenarios where the access business has both data table query and API scheduling. At the same time, intent classification is not introduced, and the peripheral scheduling process is designed, which can retain the existing API scheduling process and data table query process of the system, and improve the availability and flexibility of information query. At the same time, the historical question-answer retrieval mechanism is introduced to support implicit knowledge questions.
[0157] The information query method involved in the embodiment of the present invention is described in detail below with reference to the accompanying drawings.
[0158] See also Figure 1 , Figure 1 1 is a flow chart of an information query method provided by an embodiment of the present invention. The information query method specifically includes:
[0159] S11: obtaining a query request input by a user, and determining the user's intention according to the query request;
[0160] S12: screening the pre-accessed data table according to the user intention to obtain a data table screening result;
[0161] S13: Filter the pre-stored APIs according to the user's intention to obtain an API filtering result;
[0162] S14: determining target query capability according to the data table screening result and the API screening result;
[0163] S15: querying through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request, and displaying the query result.
[0164] It should be noted that the information query method described in the embodiment of the present invention can be executed by a server, such as a server, a computer, a computer and other equipment, which is installed with a system that provides data table query and API scheduling functions / tools. The user inputs a query request through an input device (such as a keyboard, a touch screen, a recording device, etc.), and the query request can be a query statement, such as a user question. The system obtains the query request input by the user and translates its intent to determine the user's intent; then, based on the user's intent, the system pre-connected data tables and APIs are screened to find the data tables and APIs associated with the user's intent, and then the data table results and API screening results are determined to determine whether to follow the target query capability that indicates the data table query process branch or the target query capability that indicates the API scheduling process branch; finally, based on the data table query or API scheduling corresponding to the determined target query capability, a query is performed to obtain the query result of the query request input by the user, and the query result is sent to the system front end for display. The embodiment of the present invention can reduce the number of inputs to the LLM model during subsequent process branches by screening the data tables and APIs accessed by the system, thereby shielding the token input restrictions of the LLM model. At the same time, the screening results of the data tables and APIs are used in a fusion of data table query and API scheduling. Intent classification is not introduced in the selection link of data table query and API scheduling. Only the data table and API screening link is added to the peripheral scheduling process, so that accurate classification and fusion of data table query and API call can be achieved. The existing API scheduling process and data table query process of the system can be retained. It is suitable for scenarios where the access business has both data table query and API scheduling, and improves the availability and flexibility of information query. In addition, there is no need to pre-select process branches by rules, prefixes or different entrances when the user enters the question, which improves the user experience and friendliness of querying data.
[0165] For example, the user can click the "New Dialogue" control on the interactive interface of the server, and then enter the user question in the "New Dialogue" control, such as "query the national 5G diversion ratio in November 2023". The server executes the above information query process to obtain the final query result as follows: Figure 2 As shown. For another example, if a user enters "query the number of 5G users in each province in October 2023" in the "New Dialog" control on the interactive interface of the server, the server can obtain the final query result by executing the above information query process. Figure 3 shown.
[0166] Specifically, determining the user intention according to the query request includes:
[0167] The query request is translated according to its intent using a preset first language model to obtain the user intent; wherein the user intent includes a first general dimension.
[0168] Among them, the first general dimension includes at least one of the following dimensions: time dimension, space dimension, and scenario dimension.
[0169] Exemplarily, the main task of intent translation is to extract the first general dimension of the query request input by the user. For data in the network field, especially performance statistics data or operation data, there are usually statistical granularities at different times, in different spaces, in different scenarios, etc. By identifying the first general dimension of the query request, the scope of the target data table / API can be effectively narrowed. Specifically, the preset general dimension rules and the query request input by the user can be concatenated into the first prompt template of intent translation, and then the first prompt template is input into the first large language module to determine the general dimension of the query request, and the first general dimension of the query request output by the first large language model is obtained, which can include, for example, one or more of the time dimension, space dimension, and scenario dimension.
[0170] In the embodiment of the present invention, taking the time dimension and the space dimension as examples, each dimension is enumerated as follows: the time dimension includes: hour, day, month; the space dimension: the whole country, province, city.
[0171] The general dimension rules for the time dimension and the space dimension are as follows:
[0172] When "the whole country" appears in the query request and no province name or city name appears, the space dimension is "the whole country";
[0173] When a province name or "each province" appears in the query request and no city name or district / county name appears, the space dimension is "province";
[0174] When a city name appears in the query request and no district / county name appears, the space dimension is "city";
[0175] When "hour" or "o'clock" appears in the query request, the time dimension is "hour";
[0176] When "day", "date", "number" or holiday information appears in the query request and "hour" or "o'clock" does not appear, the time dimension is "day";
[0177] When "month", "quarter" appears in the user's question and "day", "date", "number", "hour", "o'clock" or holiday does not appear, the time dimension is "month".
[0178] For example, the query request entered by the user is: Please query the development of mobile services across the country in October 2023? "Please query the development of mobile services across the country in October 2023?" and the general dimension rule are spliced into the first prompt word template of the intent translation, and input into the first language module, and the first general dimension of the query request can be obtained as: time dimension: month, space dimension: country.
[0179] If there are missing dimensions in the query request entered by the user, such as missing time, space or scene (such as business type), a prompt is triggered and displayed to instruct the user to re-enter the query request. Figure 4 As shown, the user inputs "query the business development traffic on October 10, 2023", and the server executes the above information query process and finds that the information of the scene and spatial dimensions is missing, and displays the prompt "Please add network service subcategories, such as 4G, 5G, VoLTE, broadband, and Internet TV" on the front-end interactive interface. Please add the geographical scope of the query, such as the whole country, province, city, district, county, and community. Please complete the information based on the above information and ask again." For another example Figure 5 As shown, the user inputs "query the national household broadband traffic", and the server executes the above information query process and finds that the information of the time dimension is missing. The prompt "Please supplement the query time, such as May last year, August 14, 2023, last week, May to June this year, etc. Please complete the information based on the above information and ask again" is displayed on the front-end interactive interface.
[0180] Specifically, the filtering of the pre-accessed data table according to the user intention to obtain the data table filtering result includes:
[0181] Matching the first general dimension in the user intention with the second general dimension of the pre-accessed data table respectively, and filtering out data tables whose second general dimension is consistent with the first general dimension from the pre-accessed data table to obtain a first-level screening result of the data table;
[0182] When the primary screening result of the data table is a null value, obtaining table function descriptions and / or table descriptions of all the data tables, screening all the data tables according to the query request and the table function descriptions and / or table descriptions of the data tables, and obtaining the data table screening result;
[0183] When there are at least two data tables in the data table primary screening result, obtaining table function descriptions and / or table descriptions of the at least two data tables, screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables, and obtaining the data table screening result;
[0184] When there is one data table in the data table primary screening result, the table name and table description of the corresponding data table are obtained as the data table screening result.
[0185] Further, screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables to obtain the data table screening results includes:
[0186] For the at least two data tables, calculating a first similarity between the query request and a table function description and / or a table description of each of the data tables;
[0187] When the first similarity corresponding to any of the data tables is greater than a preset first similarity threshold, obtaining a table name, table function description, and table description of the corresponding data table as the data table screening result;
[0188] When the first similarities corresponding to all the data tables are not greater than the first similarity threshold, a historical question query is performed on the query request, and the queried target historical question and its corresponding answer indicator and the table name of the data table are used as the data table screening result.
[0189] Specifically, when the first similarity corresponding to any one of the data tables is greater than a preset first similarity threshold, obtaining the table name, table function description and table description of the corresponding data table as the data table screening result includes:
[0190] Sort the data tables whose first similarity is greater than the first similarity threshold in descending order of the first similarity;
[0191] The table names, table function descriptions and table descriptions of several data tables located in the front columns of the sorting are obtained as the data table screening result.
[0192] Further, performing a historical question query on the query request includes:
[0193] Calculating a second similarity between the query request and the historical question;
[0194] When the second similarity corresponding to any one of the historical questions is greater than a preset second similarity threshold, obtaining the corresponding historical question as a target historical question;
[0195] When the second similarities corresponding to all the historical questions are not greater than the second similarity threshold, first prompt information instructing the user to re-enter the query request is triggered and displayed.
[0196] Specifically, when the second similarity corresponding to any one of the historical questions is greater than a preset second similarity threshold, obtaining the corresponding historical question as the target historical question includes:
[0197] Sorting the historical questions whose second similarity is greater than the second similarity threshold in descending order of the second similarity;
[0198] Get several historical questions that are at the top of the sorting column as target historical questions.
[0199] It should be noted that, when the first-level filtering result of the data table is null, the process of "filtering all the data tables to obtain the data table filtering result" is the same as the process of "filtering the at least two data tables to obtain the data table filtering result" when there are at least two data tables in the first-level filtering result of the data table, and will not be repeated here.
[0200] In the embodiment of the present invention, the initial screening of the data table mainly includes three stages: primary initial screening, secondary initial screening, and historical similar question retrieval stage, which are used to determine the scope of the data table pre-accessed by the system. The specific process is as follows:
[0201] In the first-level preliminary screening stage: according to the first common dimension of the query request identified above, the first-level preliminary screening of the data tables accessed by the system is performed. Among them, the business party will configure the second common dimension of all data tables when accessing the data table. By matching and screening the first common dimension of the query request, such as the time dimension: month, the space dimension: nationwide, with the second common dimension configured by the business party when accessing the data table, the data table corresponding to the time dimension of month and the space dimension of nationwide is found as the first-level preliminary screening result;
[0202] If the first-level screening result is null or greater than n (n>1), continue with the second-level preliminary screening;
[0203] If the first-level screening result is unique, the subsequent screening steps are skipped. After the subsequent target query capability is completed, the table query parameter confirmation stage is directly entered.
[0204] For example, the data tables of the system at different statistical granularities are as follows:
[0205]
[0206] When the time dimension of the query request is month and the space dimension is nationwide, the two data tables TM_PM_TZ_DAILY_M and TM_FM_GZ_TFRATE_D can be filtered out.
[0207] In the secondary preliminary screening stage: the table function description and table description (schema) of the data table obtained through the primary preliminary screening are obtained from the knowledge base (such as the first knowledge database for storing relevant information of the data table), and similarity calculation is performed with the query request input by the user to obtain the first similarity between the table function description and table description (schema) of each data table obtained through the primary preliminary screening and the query request;
[0208] When the first similarity of any data table is greater than a preset first similarity threshold, for the data table whose first similarity is greater than the preset first similarity threshold, the table name is returned, and then conventional table fine screening is performed on these data;
[0209] Exemplarily, a TOPN algorithm may be used to further screen out top N data tables with greater first similarities from data tables whose first similarities are greater than a preset first similarity threshold, and return the table names of these N data tables, and then perform subsequent conventional table fine screening.
[0210] When the first similarities of all data tables are not greater than the preset first similarity threshold, jump to the historical similarity question retrieval; the first similarity of the data table is not greater than the preset first similarity threshold, indicating that the query request entered by the user cannot be directly linked to the description of these data tables and contains implicit knowledge. At this time, through the user's historical similar question retrieval method, the similarity between historical similar questions and their associated data tables and the query request entered by the user is mined.
[0211] In the historical similar question retrieval stage: the similarity between the query request input by the user and the historical questions in the knowledge base (such as a third knowledge database for storing relevant information of the user's historical question and answer pairs, which can use a vector library) is calculated to obtain the second similarity between each historical question and the query request;
[0212] For historical questions whose second similarity is greater than a preset second similarity threshold, the corresponding historical question is returned as the target historical question, and the table name and answer index of the data corresponding to the target historical question are returned, and then the unconventional table is finely screened;
[0213] Exemplarily, the TOPN algorithm can also be used to further screen out the top M (M>1) historical questions with larger second similarities from the historical questions with second similarities greater than a preset second similarity threshold as target historical questions, and return the table names and answer indicators of these N historical questions and their corresponding data tables, and then perform subsequent unconventional table fine screening.
[0214] If the second similarity of the historical questions is not greater than the preset second similarity threshold, a null value is returned, and the first prompt information is returned to the system front end to prompt the user to further refine your question. For example, Figure 6 shown.
[0215] For example, the system stores the following historical question-answer pairs:
[0216]
[0217] According to the second similarity between the query request and the historical questions, the first target historical question whose second similarity exceeds the preset second similarity threshold is retrieved, and the table name and query index of the corresponding data table are returned:
[0218] TM_PM_TZ_DAILY_M [SA_USER,5G_FLOW,TRAFFIC]
[0219] At this point, the data table is unique and the subsequent fine screening can be skipped. If multiple target historical questions are retrieved and involve different data tables, the subsequent fine screening needs to be continued.
[0220] The embodiment of the present invention can achieve flexible support for fuzzy or coarse-grained implicit knowledge problems by introducing historical similar question retrieval, thereby improving the accuracy of subsequent parameter confirmation.
[0221] Specifically, the filtering of the pre-stored APIs according to the user intention to obtain the API filtering result includes:
[0222] Matching the first general dimension in the user intention with the third general dimension of the pre-stored APIs respectively, and filtering out APIs whose third general dimension is consistent with the first general dimension from the APIs to obtain a first-level screening result of the APIs;
[0223] When the API first-level screening result is a null value, obtaining API function descriptions and / or API input parameter definition information of all the APIs, screening all the APIs according to the query request and the API function descriptions and / or API input parameter definition information of the APIs, and obtaining the API screening result;
[0224] When there are at least two APIs in the API first-level screening result, obtain API function descriptions and / or API input parameter definition information of the at least two APIs, and screen the at least two APIs according to the query request and the API function descriptions and / or API input parameter definition information of the at least two APIs to obtain the API screening result;
[0225] When there is one API in the API first-level screening result, the API name of the corresponding API and its API input parameter definition information are obtained as the API screening result.
[0226] It should be noted that the process and principle of "filtering the pre-stored APIs according to the user intention" are the same as the process and principle of "filtering the pre-accessed data table according to the user intention" mentioned above, and will not be repeated here.
[0227] Specifically, determining the target query capability according to the data table screening result and the API screening result includes:
[0228] Determine whether the data table screening result is a null value and whether the API screening result is a null value;
[0229] When the API screening result is not a null value, determining a target query capability indicating API scheduling;
[0230] When the data table screening result is not a null value and the API screening result is a null value, a target query capability indicating a data table query is determined.
[0231] Further, querying through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request includes:
[0232] When the target query capability indicates a data table query, finely screening the data table indicated by the data table screening result to determine table query parameters;
[0233] The query result of the query request is obtained through the external system interface connected to the table query parameter.
[0234] Further, querying through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request includes:
[0235] When the target query capability indicates API scheduling, finely screening the API indicated by the API screening result to determine API parameters;
[0236] The query result of the query request is obtained through the external system interface connected by the API parameter.
[0237] Furthermore, before obtaining the query result of the query request through the external system interface connected by the API parameter, the method includes:
[0238] Using the API parameters to try to schedule the external system interface to which it is connected;
[0239] When the scheduling is successful, the query result of the query request is obtained through the external system interface connected to the API parameter;
[0240] When the scheduling fails, determining whether the data table screening result is a null value;
[0241] When the data table screening result is not a null value, fine screening is performed on the data table indicated by the data table screening result to determine table query parameters;
[0242] The query result of the query request is obtained through the external system interface connected to the table query parameter.
[0243] like Figure 7 As shown, after completing the above-mentioned user intention translation, primary screening of the data table, secondary screening, historical similar question retrieval, and primary screening of the API, secondary screening, and historical similar question retrieval, the screening result judgment is performed based on the primary screening results of the data table and the API to determine which target query capability is used for the query request input by the user; when the data table screening result is not empty (that is, at least one data table is screened out in the primary screening stage) and the API screening result is empty (that is, no API is screened out in the primary screening stage), the process branch of the data table query is executed, and when the API screening result is not empty (that is, at least one API is screened out in the screening stage), the process branch of the API scheduling is executed; when the data table primary screening result is empty (that is, no data table is screened out in the primary screening stage) and the API screening result is empty (that is, no API is screened out in the primary screening stage), the data query process is directly terminated, and the fourth prompt information can also be returned to the system front end to prompt the user with a similar phrase "no answer to the relevant question is found", such as Figure 8 shown.
[0244] When executing the process branch of data table query, it is necessary to further perform table fine screening on the data table indicated by the data table screening result to determine the table query parameters for table query; then judge the query result. When the query fails, directly end the data query process. Similarly, the fourth prompt information can be returned to the system front end to prompt the user with a similar phrase "No answer to the relevant question was found"; when the query is successful, send the query result to the system front end, and enable the system front end to present the query result.
[0245] When executing the process branch of API scheduling, it is also necessary to further perform API fine screening on the API indicated by the API screening result to determine the API parameters for API scheduling; then judge the scheduling result. When the scheduling fails, the API scheduling process will end, and then judge again whether the data table screening result is empty; if the data table screening result is empty, the data query process will be directly ended; if the data table screening result is not empty, it will enter the process branch of the above data table query to query the data table. When the scheduling is successful, the query results are sent to the system front end, and the system front end will present the query results.
[0246] In an embodiment of the present invention, based on the initial screening results of the data table and the API, it is preliminarily determined whether to execute the process branch of the data table query or the process branch of the data table query. In the selection link of the data table query and the API scheduling, the intent classification is not introduced. Only the data table and API screening link is added to the peripheral scheduling process, so that the accurate classification and integrated use of the data table query and the API call can be realized, and the existing API scheduling process and the data table query process of the system can be retained. At the same time, in the process branch of the API scheduling, if the scheduling fails, the query process will not be terminated, but the process branch of the data table query will be transferred to further perform the data table query, further strengthening the integrated use of the data table query and the API call, and improving the flexibility of the data query and the accuracy of the data query. In addition, adding table fine screening and API fine screening in the process branch of the data table query and the process branch of the data table query can further narrow the scope of the data table or API of the query request input by the user, thereby further reducing the number of inputs to the LLM model during the subsequent process branches, and shielding the limitation of the token input of the LLM model.
[0247] Specifically, the fine screening of the data table indicated by the data table screening result to determine the table query parameter includes:
[0248] When the data table screening result indicates a data table, inputting the query request and the table description of the corresponding data table into a preset second language model to obtain table query parameters;
[0249] When the data table screening result indicates at least two of the data tables, performing data table fine screening by using a preset third language model according to the query request and the data table screening result to obtain a data table fine screening result;
[0250] According to the query request and the data table fine screening result, table query parameters are obtained through the second largest language model.
[0251] Further, the method of performing fine screening of the data table by using a preset third language model according to the query request and the data table screening result to obtain the data table fine screening result includes:
[0252] When the data table screening result includes a table function description and a table description of the data table, inputting the query request and the table function description and the table description of the data table indicated by the data table screening result into the third language model for data table fine screening, and obtaining a table name of a target data table as the data table fine screening result;
[0253] Then, according to the query request and the data table fine screening result, the table query parameters are obtained through the second largest language model, including:
[0254] The query request and the table description of the target data table indicated by the data table fine screening result are input into the second largest language model to obtain table query parameters.
[0255] Further, the method of performing fine screening of the data table by using a preset third language model according to the query request and the data table screening result to obtain the data table fine screening result includes:
[0256] When the data table screening result includes the target historical question corresponding to the data table and its corresponding answer indicator, the query request and the target historical question corresponding to the data table indicated by the data table screening result and its corresponding answer indicator are input into the third language model for data table fine screening to obtain the table name and query indicator of the target data table as the data table fine screening result.
[0257] Then, according to the query request and the data table fine screening result, the table query parameters are obtained through the second largest language model, including:
[0258] The query request, the table description of the target data table indicated by the data table fine screening result, and the query index are input into the second largest language model to obtain table query parameters.
[0259] It should be noted that, in an embodiment of the present invention, the process and principle of "when the target query capability indicates API scheduling, the API indicated by the API screening result is finely screened to determine the API parameters" are the same as the process and principle of "when the target query capability indicates a data table query, the data table indicated by the data table screening result is finely screened to determine the table query parameters", and they will not be repeated here. Among them, the data table / API fine screening link is based on the different valid information of the data table / API obtained in the data table / API initial screening stage, and requests the third largest language model to make the final data table / API selection. According to different input information, it is divided into two stages: conventional table fine screening and unconventional table fine screening. The data table fine screening link is described in detail below, as follows:
[0260] In the conventional table fine screening stage: the input of the third language model includes: the query request input by the user, the table function description and table description (schema) of the data table; the output of the third language model: the table name of the finely screened data table;
[0261] In the stage of fine screening of unconventional tables: the input of the third language model includes: the query request entered by the user, the retrieved TOPN target historical questions and the table names and answer indicators of their corresponding data tables; the output of the third language model includes: the table name and query indicators of the finely screened data table; the query indicators are used as a reference for extracting query parameters in the stage of confirming table query parameters.
[0262] For example, the TOPN target historical issues, query indicators, table descriptions of data tables / API input parameter definition information can be combined into a third prompt template, and then the third prompt template can be input into the third language module for data table / API fine screening.
[0263] In the query parameter confirmation stage, based on the information after the data table / API is carefully screened and the query request input by the user, the second largest language model is requested to obtain the user's final table query parameters / API parameters. In order to make the output parameter structure of the second largest model consistent and facilitate the unified parsing and execution of subsequent codes, the present invention predefines the standard format of the output parameters of the second largest language model. According to the different information input to the second largest language model, the table query parameter / API parameter confirmation is divided into two stages: conventional parameter confirmation and unconventional parameter confirmation.
[0264] In the conventional parameter confirmation stage: the input of the second largest language model comes from the information obtained in the conventional table fine screening stage. For data table query, the input of the second largest language model includes: the query request entered by the user and the table description (schema) of the data table; the output of the second largest language model: table query parameters; for API, the input of the second largest language model includes: the query request entered by the user and the input parameter definition information of the API; the output of the second largest language model: API parameters;
[0265] In the unconventional parameter confirmation stage: the input of the second largest language model comes from the information obtained from the above-mentioned unconventional table screening. For data table queries, the input of the second largest language model includes: query requests entered by users, table descriptions (schema) of data tables, and query indicators corresponding to target historical questions; the output of the second largest language model: table query parameters; for APIs, the input of the second largest language model includes: query requests entered by users, API input parameter definition information, and query indicators corresponding to target historical questions; the output of the second largest language model: API parameters.
[0266] Specifically, the query request input by the user and the information obtained in the fine screening stage can be used as background knowledge and pieced into the second prompt word template, and then the second prompt word template is input into the second language module for query parameter confirmation. For example, the query request input by the user, the table description (schema) of the data table, and the query indicators corresponding to the target historical question are pieced into the second prompt word template, and then the second prompt word template is input into the second language module for query parameter confirmation to obtain the corresponding table query parameters. The second model can rely on similar target historical questions and their query indicators to confirm that when the query request input by the user is: "Query the development of national mobile services in October 2023", the query indicator should be [SA_USER, 5G_FLOW, TRAFFIC], and the target field of the query can be determined. Other time dimensions and space dimensions are combined with the query request and the table description (schema) of the data table to obtain other query condition fields and values.
[0267] After obtaining the table query parameters / API parameters, you can connect to the corresponding external system interface to obtain the query results, and then call the LLM model to organize the query results, organize them into natural language descriptions and send them to the front end for query result presentation.
[0268] Specifically, obtaining the query result of the query request through the external system interface connected to the API parameter includes:
[0269] Verify the API parameters;
[0270] When the verification is passed, the query request is subjected to a time format verification to convert the time information in the query request into a set time format to obtain a target query request;
[0271] According to the target query request, the query result is obtained through the external system interface connected by the API parameter.
[0272] Further, the checking of the API parameters includes:
[0273] Determine whether the API parameters include a first setting parameter corresponding to the corresponding API; wherein the first setting parameter is a necessary parameter for scheduling the corresponding API;
[0274] When the API parameters include the first setting parameters corresponding to the corresponding API, the API parameters are sent to the front end and displayed in the form of a first interactive window, such as Fig. 9 As shown;
[0275] When the API parameter does not include the first setting parameter corresponding to the corresponding API, the API parameter and the second prompt information indicating the first setting parameter of the API are sent to the front end, and the API parameter and the second prompt information are displayed in the form of a second interactive window, such as Fig.10 As shown, the user can complete the first set parameter of the API by clicking the "Supplement API Parameters" control, and click the "Confirm" control to jump to Fig. 9 Confirm the final API parameters in the interactive interface shown;
[0276] The first setting parameters input by the user in the second interactive window are obtained, and final API parameters are generated according to the API parameters and the first setting parameters, and the final generated API parameters are sent to the front end, and the final generated API parameters are displayed in the form of the first interactive window, such as Fig. 9 As shown;
[0277] According to the first behavior operation of the user in the first interactive window, it is determined that the corresponding API parameters pass the security risk verification; wherein the first behavior operation is the behavior operation of the user on the first interactive window when determining that the API call corresponding to the corresponding API parameter does not have a security risk, such as clicking Figure 7 The "Confirm" control confirms that the API parameters are complete and pass the security risk check.
[0278] In order to improve the success rate of API scheduling and reduce the security risks caused by sensitive API scheduling, the embodiment of the present invention verifies the API parameters before using API parameters for API scheduling. The specific process is as follows: determine whether the API parameters output by the model include the necessary parameters of the corresponding API scheduling (which can also be described as required parameters). If the necessary parameters of the corresponding API scheduling are included, the API parameters are sent to the system front end for display, and the user is prompted to determine whether the API parameters have security risks. For example, the user is prompted to confirm the API parameter security risks through an interactive window. If the user confirms that the API parameters have security risks, the user can click the confirmation button in the interactive window, and then the data query process will end; if the user confirms that the API parameters do not have security risks, the user can click the cancel button in the interactive window, and then enter the API scheduling; if the necessary parameters of the corresponding API scheduling are not included or some necessary parameters are missing, the API parameters need to be sent to the system front end for display, and the user is prompted to complete the necessary parameters of the API scheduling, and then the completed API parameters are verified for security risks.
[0279] After passing the security risk check, in order to ensure that the query request can be accurately identified by the model, it is necessary to further perform time format check on the time information in the query request and convert it into the set time format. For example, for the query request "Please query the national mobile business development situation in October 2023?", the query request can be converted into "Please query the national mobile business development situation in October 2023?" through time format check. Then, "Please query the national mobile business development situation in October 2023?" and API parameters are input into the LLM model for API scheduling to obtain the corresponding query results.
[0280] Further, obtaining the query result of the query request through the external system interface connected to the table query parameter includes:
[0281] Verifying the table query parameters;
[0282] When the verification is passed, the query request is subjected to a time format verification to convert the time information in the query request into a set time format to obtain a target query request;
[0283] According to the target query request, the query result is obtained through the external system interface connected to the table query parameter.
[0284] Specifically, the checking of the table query parameters includes:
[0285] Determine whether the table query parameter includes a second setting parameter corresponding to the corresponding data table; wherein the second setting parameter is a necessary parameter for scheduling the corresponding data table;
[0286] When the table query parameter includes the second setting parameter corresponding to the corresponding data table, the table query parameter is sent to the front end, and the table query parameter is displayed in the form of a third interactive window, such as Fig.11 As shown;
[0287] When the table query parameter does not include the second setting parameter corresponding to the corresponding data table, the table query parameter and the third prompt information indicating the second setting parameter of the data table to be completed are sent to the front end, and the table query parameter and the third prompt information are displayed in the form of a fourth interactive window, such as Fig.12 As shown;
[0288] The second setting parameter input by the user in the fourth interactive window is obtained, and a final table query parameter is generated according to the table query parameter and the second setting parameter, and the final generated table query parameter is sent to the front end, and the final generated table query parameter is displayed in the form of the third interactive window, such as Fig.11 As shown;
[0289] According to the second behavior operation of the user in the third interactive window, it is determined that the corresponding table query parameters pass the security risk verification; wherein, the second behavior operation is the behavior operation of the user on the third interactive window when it is determined that there is no security risk in the data table call corresponding to the corresponding table query parameter.
[0290] It should be noted that, in the embodiment of the present invention, the process and principle of verifying the table query parameters are the same as the process and principle of verifying the API parameters described above, and will not be repeated here.
[0291] Specifically, before obtaining the query request input by the user and determining the user intention according to the query request, the method further includes:
[0292] Initializing the pre-accessed data table, and storing the relevant information of the data table obtained after the initialization in the first knowledge database;
[0293] Initializing the pre-stored API, and storing the API related information obtained after the initialization in the second knowledge database;
[0294] The historical question-answer pairs within a set time period are initialized, and the relevant information of the historical question-answer pairs obtained after the initialization is stored in the third knowledge database.
[0295] As an improvement of the above solution, the initialization of the pre-accessed data table includes:
[0296] Initialize the pre-accessed data table to obtain the table name, table function description, and table description of the data table in a first standard format;
[0297] Performing a universal dimension rule check on the data table to determine a second universal dimension of the data table;
[0298] According to the table name, table function description, table description and the second general dimension of the data table, relevant information of the data table is obtained.
[0299] Specifically, the initialization of the pre-stored API includes:
[0300] Initialize the pre-stored API to obtain the API name, API function description, and API input parameter definition information of the API in the second standard format;
[0301] Performing a universal dimension rule check on the API to determine a third universal dimension of the API;
[0302] According to the API name, API function description, API input parameter definition information and the third general dimension of the API, relevant information of the API is obtained.
[0303] The API input parameter definition indicates the necessary parameters for executing the corresponding API scheduling.
[0304] Among them, the general dimension rule verification includes time format verification, space verification and scene verification; among them, the time format verification is used to determine the time information corresponding to the data table or the API and convert the time information into a time dimension in a set time format; the space verification is used to determine the spatial information corresponding to the data table or the API and convert the spatial information into a spatial dimension in a set spatial format; the scene verification is used to determine the query scene information corresponding to the data table or the API and convert the query scene information into a scene dimension in a set scene format.
[0305] In the embodiment of the present invention, before data query, it is necessary to perform data initialization processing on the data table, API and historical question-answer pairs connected to the system, obtain relevant information of the initialized data table (such as table name, table function description, table description, second general dimension of the data table, etc.), relevant information of the historical question-answer pairs (such as historical questions and their corresponding data table names, answer indicators, query indicators, etc.), and the user intention query. Figure 2 The relevant information of the API that is initially screened at the first level (such as API name, API function description, API input parameter definition, API's third common dimension, etc.) will be entered into the knowledge base after all the information is verified, where information verification includes but is not limited to time format verification, integrity verification, data format verification, etc., which are not specifically limited in this embodiment of the law. For example, the relevant information of historical question and answer pairs can be saved in a pre-established third knowledge database (i.e., a vector library) for similar retrieval of user historical questions. The relevant information of the data table is saved in the first knowledge database (i.e., the ES library), and the relevant information of the API is saved in the second knowledge database (i.e., the ES library) for user intentions. Figure 2 Level initial screening.
[0306] The information query process described in the embodiment of the present invention can be divided into user intent translation, user intent to data table / API mapping, table query parameter / API parameter confirmation, intent execution to intent response result presentation, and the specific process involves the following components:
[0307] Application framework: As a unified control and scheduling engine, it is responsible for receiving the query requests input by users from the front end, and interacting with the knowledge base, LLM model, and tool set to complete the entire process from user intent translation, user intent to data table / API mapping, table query parameter / API parameter confirmation, intent execution to intent response result presentation. The specific process is as follows Fig.13 and Fig.14 shown.
[0308] Knowledge base: stores prior knowledge, such as the table name, table function description and table description of the data table, the API name, API function description, API input parameter definition information, historical questions of users' historical Q&A pairs and their corresponding data table descriptions, answer indicators, query indicators, etc., for data table / API screening. Specifically, it can be split into multiple or different forms of knowledge databases (such as ES library, vector library) for storage according to different stored knowledge or different effect targets.
[0309] LLM model: responsible for translating user intent, selecting tools (APIs) and parameters based on user intent, and providing a natural language description response based on user query results.
[0310] Toolset: represents the collection of all tools supported by the system, including a series of tools such as data processing and drawing.
[0311] Intention execution module: responsible for verifying the parameters output by the LLM model and connecting to the data source for data query.
[0312] Data source: refers to the database that hosts the access data table.
[0313] Compared with the prior art, the effective effects of the embodiments of the present invention are:
[0314] By optimizing the data table / API selection process and not introducing intent classification, the target range of data tables / APIs can be effectively narrowed through initial screening of data tables and APIs, including primary screening, secondary screening, and multiple screening of user historical similar questions. At the same time, the final selection of target data tables / APIs can be achieved through fine screening of data tables / APIs based on a small range of data tables / APIs, thereby reducing the number of inputs to the LLM model during subsequent process branches, thereby shielding the limitations of the LLM model's token input and achieving accurate classification of data table queries and API calls.
[0315] By optimizing the parameter link, adding the result content of the user's historical similar question retrieval to the prompt word template input into the LLM model, and providing flexible support for fuzzy or coarse-grained implicit knowledge problems, the accuracy of parameter confirmation can be improved.
[0316] Based on the initial screening results of data tables and APIs, the data table query and API scheduling processes are integrated and designed. Intent classification is not introduced in the selection phase of data table query and API scheduling. Only the data table and API screening phase is added to the peripheral scheduling process, which can achieve accurate classification and integrated use of data table query and API call. The system's existing API scheduling process and data table query process can be retained. In the absence of intention classification changes or enhancements, it can cope with scenarios where the access business has both data table query and API scheduling, thereby improving the availability and flexibility of information query. In addition, there is no need to pre-select process branches by rules, prefixes or different entrances when users enter questions, which improves the user experience and friendliness of querying data.
[0317] See also Fig.15 , Fig.15 The embodiment of the present invention provides another flow chart of an information query method, wherein the information query method is applied to a user terminal and includes:
[0318] S21: receiving a query request input by a user on a user interface, and sending the query request to a server, so that the server performs the following operations:
[0319] Determining user intent based on the query request;
[0320] Filter the pre-accessed data table according to the user intention to obtain a data table filtering result;
[0321] Filter the pre-stored APIs according to the user's intention to obtain an API filtering result;
[0322] Determining target query capabilities according to the data table screening results and the API screening results;
[0323] Performing a query through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request;
[0324] S22: receiving the query result sent by the server, and displaying the query result on a user interface.
[0325] It should be noted that the user terminal can be a terminal device with input and display devices such as a mobile phone, computer, tablet, etc. The user terminal is connected to the above-mentioned server for communication. On the one hand, the user can directly enter the query request on the server to query information and display the query results. On the other hand, the user can also enter the query request through the user terminal, such as Fig.16 As shown, by clicking the "New Dialog" control, a query request is input and sent to the server for information query, and the user interface of the user device displays the query result obtained after the server performs the information query, such as Fig.17The information query process performed by the server can refer to the working process of the information query method described in the above embodiment, which will not be repeated here.
[0326] See also Fig.18 , Fig.18 The embodiment of the present invention provides a structural block diagram of an information query system, wherein the information query system includes:
[0327] A user intention determination module 11 is used to obtain a query request input by a user and determine the user intention according to the query request;
[0328] A data table screening module 12 is used to screen the pre-accessed data table according to the user's intention to obtain a data table screening result;
[0329] An API screening module 13 is used to screen the pre-stored APIs according to the user's intention and obtain an API screening result;
[0330] A target query capability determination module 14, configured to determine the target query capability according to the data table screening result and the API screening result;
[0331] The query display module 15 is used to query through the data table query or API scheduling corresponding to the target query capability, obtain the query result of the query request, and display the query result.
[0332] In an optional embodiment, the user intention determination module 11 includes:
[0333] An intention translation unit is used to perform intention translation on the query request through a preset first language model to obtain the user intention; wherein the user intention includes a first general dimension.
[0334] In an optional embodiment, the first general dimension includes at least one of the following dimensions: a time dimension, a space dimension, and a scene dimension.
[0335] In an optional embodiment, the data table screening module 12 includes:
[0336] a first data table screening unit, configured to match the first general dimension in the user intention with the second general dimension of the pre-accessed data table, respectively, and screen out data tables whose second general dimension is consistent with the first general dimension from the pre-accessed data table, to obtain a first-level screening result of the data table;
[0337] A second data table screening unit is used for, when the primary screening result of the data table is a null value, obtaining table function descriptions and / or table descriptions of all the data tables, screening all the data tables according to the query request and the table function descriptions and / or table descriptions of the data tables, and obtaining the data table screening result;
[0338] A third data table screening unit is used for, when there are at least two data tables in the data table primary screening result, obtaining table function descriptions and / or table descriptions of the at least two data tables, screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables, and obtaining the data table screening result;
[0339] The data table information acquisition unit is used to acquire the table name and table description of the corresponding data table as the data table screening result when there is a data table in the data table primary screening result.
[0340] In an optional embodiment, the third data table screening unit includes:
[0341] A first similarity calculation subunit, configured to calculate, for the at least two data tables, a first similarity between the query request and a table function description and / or a table description of each of the data tables;
[0342] A first data table information acquisition subunit is used to acquire the table name, table function description and table description of the corresponding data table as the data table screening result when the first similarity corresponding to any of the data tables is greater than a preset first similarity threshold;
[0343] The historical question query subunit is used to perform a historical question query on the query request when the first similarities corresponding to all the data tables are not greater than the first similarity threshold, and use the queried target historical question and its corresponding answer indicator and the table name of the data table as the data table screening result.
[0344] In an optional embodiment, the historical question query subunit includes:
[0345] A second similarity calculation subunit, used to calculate a second similarity between the query request and the historical question;
[0346] A second data table information acquisition subunit is used to acquire the corresponding historical question as a target historical question when the second similarity corresponding to any one of the historical questions is greater than a preset second similarity threshold;
[0347] The first prompt subunit is used to trigger and display first prompt information instructing the user to re-enter the query request when the second similarities corresponding to all the historical questions are not greater than the second similarity threshold.
[0348] In an optional embodiment, the target query capability determination module 14 includes:
[0349] A first judgment unit, used to judge whether the data table screening result is a null value and whether the API screening result is a null value;
[0350] A first target query capability determination unit, configured to determine a target query capability indicating API scheduling when the API screening result is not a null value;
[0351] The second target query capability determination unit is used to determine the target query capability indicating the data table query when the data table screening result is not a null value and the API screening result is a null value.
[0352] In an optional embodiment, the query display module 15 includes:
[0353] A table query parameter determination unit, configured to, when the target query capability indicates a data table query, perform fine screening on the data table indicated by the data table screening result to determine a table query parameter;
[0354] The table query unit is used to obtain the query result of the query request through the external system interface connected to the table query parameter.
[0355] In an optional embodiment, the query display module 15 includes:
[0356] An API parameter determination unit, configured to, when the target query capability indicates API scheduling, finely screen the API indicated by the API screening result to determine API parameters;
[0357] The API scheduling unit is used to obtain the query result of the query request through the external system interface connected to the API parameter.
[0358] In an optional embodiment, the system includes:
[0359] A scheduling attempt module, used for attempting to schedule the external system interface connected to the API parameter before obtaining the query result of the query request through the external system interface connected to the API parameter; when the scheduling is successful, obtaining the query result of the query request through the external system interface connected to the API parameter;
[0360] A data table judgment module, used to judge whether the data table screening result is a null value when scheduling fails;
[0361] A table query parameter determination module, configured to, when the data table screening result is not a null value, perform a fine screening on the data table indicated by the data table screening result to determine the table query parameter;
[0362] The table query module is used to obtain the query result of the query request through the external system interface connected to the table query parameter.
[0363] In an optional embodiment, the table query parameter determination unit includes:
[0364] A first table query parameter acquisition subunit is used for inputting the query request and the table description of the corresponding data table into a preset second language model to obtain table query parameters when the data table screening result indicates a data table;
[0365] a data table fine screening subunit, configured to, when the data table screening result indicates at least two of the data tables, perform data table fine screening by using a preset third language model according to the query request and the data table screening result to obtain a data table fine screening result;
[0366] The second table query parameter acquisition subunit is used to obtain table query parameters according to the query request and the data table fine screening result through the second largest language model.
[0367] In an optional embodiment, the data table fine screening subunit includes:
[0368] a first table fine screening subunit, configured to input the query request and the table function description and table description of the data table indicated by the data table screening result into the third language model for data table fine screening, and obtain the table name of the target data table as the data table fine screening result, when the data table screening result includes the table function description and table description of the data table;
[0369] The second table query parameter acquisition subunit includes:
[0370] The first parameter acquisition subunit is used to input the query request and the table description of the target data table indicated by the data table fine screening result into the second largest language model to obtain table query parameters.
[0371] In an optional embodiment, the data table fine screening subunit includes:
[0372] The second table fine screening sub-unit is used to input the query request and the corresponding target historical question and the corresponding answer indicator of the data table indicated by the data table screening result into the third language model for data table fine screening when the data table screening result includes the target historical question corresponding to the data table and the corresponding answer indicator, and obtain the table name and query indicator of the target data table as the data table fine screening result.
[0373] The second table query parameter acquisition subunit includes:
[0374] The second parameter acquisition subunit is used to input the query request and the table description of the target data table indicated by the data table fine screening result and the query index into the second largest language model to obtain table query parameters.
[0375] In an optional embodiment, the API scheduling unit includes:
[0376] An API parameter verification subunit, used to verify the API parameters;
[0377] A first time format verification subunit is used to perform a time format verification on the query request when the verification is passed, so as to convert the time information in the query request into a set time format to obtain a target query request;
[0378] The API scheduling subunit is used to obtain the query result through the external system interface connected to the API parameters according to the target query request.
[0379] In an optional embodiment, the API parameter verification subunit includes:
[0380] A first parameter determination subunit, used to determine whether the API parameter includes a first setting parameter corresponding to the corresponding API; wherein the first setting parameter is a necessary parameter for scheduling the corresponding API;
[0381] A first API parameter display subunit is used to send the API parameters to the front end when the API parameters include the first setting parameters corresponding to the corresponding API, and display the API parameters in the form of a first interactive window;
[0382] A second API parameter display subunit is used for sending the API parameters and second prompt information indicating the first setting parameters of the API to the front end when the API parameters do not include the first setting parameters corresponding to the corresponding API, and displaying the API parameters and the second prompt information in the form of a second interactive window;
[0383] a third API parameter display subunit, configured to obtain the first setting parameter input by the user in the second interactive window, and generate final API parameters according to the API parameters and the first setting parameters, and send the finally generated API parameters to the front end, and display the finally generated API parameters in the form of the first interactive window;
[0384] The first security verification determination sub-unit is used to determine that the corresponding API parameters have passed the security risk verification based on the first behavioral operation of the user in the first interactive window; wherein, the first behavioral operation is the behavioral operation of the first interactive window when the user determines that the API call corresponding to the corresponding API parameter does not have a security risk.
[0385] In an optional embodiment, the table query unit includes:
[0386] A table query parameter subunit, used to verify the table query parameter;
[0387] A second time format verification subunit is used to perform a time format verification on the query request when the verification is passed, so as to convert the time information in the query request into a set time format to obtain a target query request;
[0388] The data table query subunit is used to obtain the query result according to the target query request through the external system interface connected to the table query parameter.
[0389] In an optional embodiment, the table query parameter subunit includes:
[0390] A second parameter determination subunit, used to determine whether the table query parameter includes a second setting parameter corresponding to the corresponding data table; wherein the second setting parameter is a necessary parameter for scheduling the corresponding data table;
[0391] a fourth API parameter display subunit, configured to send the table query parameter to the front end when the table query parameter includes the second setting parameter corresponding to the corresponding data table, and display the table query parameter in the form of a third interactive window;
[0392] a fifth API parameter display subunit, configured to, when the table query parameter does not include the second setting parameter corresponding to the corresponding data table, send the table query parameter and third prompt information indicating the second setting parameter of the data table to the front end, and display the table query parameter and the third prompt information in the form of a fourth interactive window;
[0393] a sixth API parameter display subunit, configured to obtain the second setting parameter input by the user in the fourth interactive window, and generate a final table query parameter according to the table query parameter and the second setting parameter, and send the final generated table query parameter to the front end, and display the final generated table query parameter in the form of the third interactive window;
[0394] The second security verification determination subunit is used to determine that the corresponding table query parameters have passed the security risk verification based on the second behavioral operation of the user in the third interactive window; wherein the second behavioral operation is the behavioral operation of the user on the third interactive window when the user determines that the data table call corresponding to the corresponding table query parameter does not have a security risk.
[0395] In an optional embodiment, the system further includes:
[0396] A data table initialization module, used for obtaining the query request input by the user, initializing the pre-accessed data table before determining the user's intention according to the query request, and storing the relevant information of the data table obtained after the initialization in the first knowledge database;
[0397] An API initialization module is used to initialize the pre-stored API and store the API related information obtained after the initialization in the second knowledge database;
[0398] The historical question-answer pair initialization module is used to initialize the historical question-answer pairs within a set time period and store the relevant information of the historical question-answer pairs obtained after initialization in the third knowledge database.
[0399] In an optional embodiment, the data table initialization module includes:
[0400] A first format conversion unit, used to initialize the pre-accessed data table, and obtain the table name, table function description, and table description of the data table in a first standard format;
[0401] A first rule checking unit, configured to perform a universal dimension rule check on the data table to determine a second universal dimension of the data table;
[0402] The data table related information acquisition unit is used to obtain the related information of the data table according to the table name, table function description, table description and the second general dimension of the data table.
[0403] In an optional embodiment, the API initialization module includes:
[0404] The second format conversion unit is used to initialize the pre-stored API to obtain the API name, API function description, and API input parameter definition information of the API in a second standard format;
[0405] A second rule verification unit, configured to perform a general dimension rule verification on the API to determine a third general dimension of the API;
[0406] The API related information acquisition unit is used to obtain the relevant information of the API according to the API name, API function description, API input parameter definition information and the third general dimension of the API.
[0407] In an optional embodiment, the general dimension rule check includes time format check, space check and scene check; wherein, the time format check is used to determine the time information corresponding to the data table or the API and convert the time information into a time dimension in a set time format; the space check is used to determine the spatial information corresponding to the data table or the API and convert the spatial information into a spatial dimension in a set spatial format; the scene check is used to determine the query scene information corresponding to the data table or the API and convert the query scene information into a scene dimension in a set scene format.
[0408] In an optional embodiment, the API screening module 13 includes:
[0409] A first API screening unit is used to match the first general dimension in the user intention with the third general dimension of the pre-stored API respectively, and screen out APIs whose third general dimension is consistent with the first general dimension from the APIs to obtain an API primary screening result;
[0410] A second API screening unit is used for obtaining API function descriptions and / or API input parameter definition information of all the APIs when the API first-level screening result is a null value, screening all the APIs according to the query request and the API function descriptions and / or API input parameter definition information of the API, and obtaining the API screening result;
[0411] A third API screening unit is used for, when there are at least two APIs in the API first-level screening result, obtaining API function descriptions and / or API input parameter definition information of the at least two APIs, screening the at least two APIs according to the query request and the API function descriptions and / or API input parameter definition information of the at least two APIs, and obtaining the API screening result;
[0412] The API information acquisition unit is used to acquire the API name of the corresponding API and its API input parameter definition information as the API screening result when there is an API in the API first-level screening result.
[0413] It should be noted that the working process of each module in the information query system described in the embodiment of the present invention can refer to the working process of the information query method applied to the server described in the above embodiment, and the technical effect achieved is the same as the information query method applied to the server described in the above embodiment, which will not be repeated here.
[0414] See also Fig.19 , Fig.19 : is a structural block diagram of an information query device provided by an embodiment of the present invention. The information query device is applied to a user terminal and includes:
[0415] The query request receiving module 21 is used to receive a query request input by a user on the user interface, and send the query request to the server, so that the server performs the following operations:
[0416] Determining user intent based on the query request;
[0417] Filter the pre-accessed data table according to the user intention to obtain a data table filtering result;
[0418] Filter the pre-stored APIs according to the user's intention to obtain an API filtering result;
[0419] Determining target query capabilities according to the data table screening results and the API screening results;
[0420] Performing a query through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request;
[0421] The query result receiving module 22 is used to receive the query result sent by the server and display the query result on the user interface.
[0422] It should be noted that the working process of each module in the information query device described in the embodiment of the present invention can refer to the working process of the information query method applied to the server described in the above embodiment, and the technical effect achieved is the same as the information query method applied to the server described in the above embodiment, which will not be repeated here.
[0423] See also Fig. 20 , Fig. 20 3 is a structural block diagram of an information query device provided in an embodiment of the present invention. The information query device includes a processor 31, a memory 32, and a computer program stored in the memory 32 and executable on the processor 31. When the processor 31 executes the computer program, the steps in the above-mentioned various information query method embodiments are implemented, such as steps S11 to S15 or steps S21 to S22.
[0424] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 32 and executed by the processor 31 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the information query device.
[0425] The information query device may include, but is not limited to, a processor 31 and a memory 32. Those skilled in the art will appreciate that the schematic diagram is merely an example of the information query device and does not constitute a limitation on the information query device. The information query device may include more or fewer components than shown in the diagram, or may combine certain components, or different components. For example, the information query device may also include an input / output device, a network access device, a bus, etc.
[0426] The processor 31 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 31 is the control center of the information query device, and uses various interfaces and lines to connect various parts of the entire information query device.
[0427] The memory 32 can be used to store the computer program and / or module. The processor 31 realizes various functions of the information query device by running or executing the computer program and / or module stored in the memory 32 and calling the data stored in the memory 32. The memory 32 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 32 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0428] Wherein, if the module / unit integrated in the information query device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 31. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0429] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0430] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, many improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. An information query method, characterized in that: Applied to the server, including: Obtaining a query request input by a user, and determining the user's intention based on the query request; Filter the pre-accessed data table according to the user intention to obtain a data table filtering result; Filter the pre-stored APIs according to the user's intention to obtain an API filtering result; Determining target query capabilities according to the data table screening results and the API screening results; The query is performed through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request, and the query result is displayed.
2. The information query method according to claim 1, characterized in that: The determining the user intention according to the query request includes: The query request is translated according to its intent using a preset first language model to obtain the user intent; wherein the user intent includes a first general dimension.
3. The information query method according to claim 2, characterized in that: The first general dimension includes at least one of the following dimensions: time dimension, space dimension, and scene dimension.
4. The information query method according to claim 1 or 2, characterized in that: The step of screening the pre-accessed data table according to the user intention to obtain the data table screening result includes: Matching the first general dimension in the user intention with the second general dimension of the pre-accessed data table respectively, and filtering out data tables whose second general dimension is consistent with the first general dimension from the pre-accessed data table to obtain a first-level screening result of the data table; When the primary screening result of the data table is a null value, obtaining table function descriptions and / or table descriptions of all the data tables, screening all the data tables according to the query request and the table function descriptions and / or table descriptions of the data tables, and obtaining the data table screening result; When there are at least two data tables in the data table primary screening result, obtaining table function descriptions and / or table descriptions of the at least two data tables, screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables, and obtaining the data table screening result; When there is one data table in the data table primary screening result, the table name and table description of the corresponding data table are obtained as the data table screening result.
5. The information query method according to claim 4, characterized in that: The step of screening the at least two data tables according to the query request and the table function descriptions and / or table descriptions of the at least two data tables to obtain the data table screening results includes: For the at least two data tables, calculating a first similarity between the query request and a table function description and / or a table description of each of the data tables; When the first similarity corresponding to any of the data tables is greater than a preset first similarity threshold, obtaining a table name, table function description, and table description of the corresponding data table as the data table screening result; When the first similarities corresponding to all the data tables are not greater than the first similarity threshold, a historical question query is performed on the query request, and the queried target historical question and its corresponding answer indicator and the table name of the data table are used as the data table screening result.
6. The information query method according to claim 5, characterized in that: The querying of historical issues on the query request includes: Calculating a second similarity between the query request and the historical question; When the second similarity corresponding to any one of the historical questions is greater than a preset second similarity threshold, obtaining the corresponding historical question as a target historical question; When the second similarities corresponding to all the historical questions are not greater than the second similarity threshold, first prompt information instructing the user to re-enter the query request is triggered and displayed.
7. The information query method according to claim 1, characterized in that: The determining the target query capability according to the data table screening result and the API screening result includes: Determine whether the data table screening result is a null value and whether the API screening result is a null value; When the API screening result is not a null value, determining a target query capability indicating API scheduling; When the data table screening result is not a null value and the API screening result is a null value, a target query capability indicating a data table query is determined.
8. The information query method according to claim 7, characterized in that: The querying through the data table query or API scheduling corresponding to the target query capability to obtain the query result of the query request includes: When the target query capability indicates a data table query, finely screening the data table indicated by the data table screening result to determine table query parameters; The query result of the query request is obtained through the external system interface connected to the table query parameter.
9. The information query method according to claim 7, characterized in that: The querying through the data table query or API scheduling corresponding to the target query capability to obtain the query result of the query request includes: When the target query capability indicates API scheduling, finely screening the API indicated by the API screening result to determine API parameters; The query result of the query request is obtained through the external system interface connected to the API parameter.
10. The information query method according to claim 9, characterized in that: Before obtaining the query result of the query request through the external system interface connected by the API parameter, the method includes: Using the API parameters to try to schedule the external system interface to which it is connected; When the scheduling is successful, the query result of the query request is obtained through the external system interface connected to the API parameter; When the scheduling fails, determining whether the data table screening result is a null value; When the data table screening result is not a null value, fine screening is performed on the data table indicated by the data table screening result to determine table query parameters; The query result of the query request is obtained through the external system interface connected to the table query parameter.
11. The information query method according to claim 8 or 10, characterized in that: The step of finely screening the data table indicated by the data table screening result to determine table query parameters includes: When the data table screening result indicates a data table, inputting the query request and the table description of the corresponding data table into a preset second language model to obtain table query parameters; When the data table screening result indicates at least two of the data tables, performing data table fine screening by using a preset third language model according to the query request and the data table screening result to obtain a data table fine screening result; According to the query request and the data table fine screening result, table query parameters are obtained through the second largest language model.
12. The information query method according to claim 11, characterized in that: The method of performing fine screening of the data table according to the query request and the data table screening result by using a preset third language model to obtain a fine screening result of the data table includes: When the data table screening result includes a table function description and a table description of the data table, inputting the query request and the table function description and the table description of the data table indicated by the data table screening result into the third language model for data table fine screening, and obtaining a table name of a target data table as the data table fine screening result; The obtaining of table query parameters according to the query request and the data table fine screening result by using the second largest language model includes: The query request and the table description of the target data table indicated by the data table fine screening result are input into the second largest language model to obtain table query parameters.
13. The information query method according to claim 11, characterized in that: The method of performing fine screening of the data table according to the query request and the data table screening result by using a preset third language model to obtain a fine screening result of the data table includes: When the data table screening result includes the target historical question corresponding to the data table and the corresponding answer indicator, the query request and the target historical question corresponding to the data table indicated by the data table screening result and the corresponding answer indicator are input into the third language model to perform data table fine screening, and obtain the table name and query indicator of the target data table as the data table fine screening result; The obtaining of table query parameters according to the query request and the data table fine screening result by using the second largest language model includes: The query request, the table description of the target data table indicated by the data table fine screening result, and the query index are input into the second largest language model to obtain table query parameters.
14. The information query method according to claim 9 or 10, characterized in that: The obtaining of the query result of the query request through the external system interface connected with the API parameter includes: Verify the API parameters; When the verification is passed, a time format verification is performed on the query request to convert the time information in the query request into a set time format to obtain a target query request; According to the target query request, the query result is obtained through the external system interface connected by the API parameter.
15. The information query method according to claim 14, characterized in that: The checking of the API parameters includes: Determine whether the API parameters include a first setting parameter corresponding to the corresponding API; wherein the first setting parameter is a necessary parameter for scheduling the corresponding API; When the API parameters include the first setting parameters corresponding to the corresponding API, the API parameters are sent to the front end, and the API parameters are displayed in the form of a first interactive window; When the API parameters do not include the first setting parameters corresponding to the corresponding API, the API parameters and second prompt information indicating the first setting parameters of the API are completed are sent to the front end, and the API parameters and the second prompt information are displayed in the form of a second interactive window; Acquire the first setting parameters input by the user in the second interactive window, generate final API parameters according to the API parameters and the first setting parameters, send the finally generated API parameters to the front end, and display the finally generated API parameters in the form of the first interactive window; According to the first behavior operation of the user in the first interactive window, it is determined that the corresponding API parameters have passed the security risk verification; wherein, the first behavior operation is the behavior operation of the user on the first interactive window when the user determines that the API call corresponding to the corresponding API parameters does not have a security risk.
16. The information query method according to claim 8 or 10, characterized in that: The obtaining the query result of the query request through the external system interface connected to the table query parameter includes: Verifying the table query parameters; When the verification is passed, a time format verification is performed on the query request to convert the time information in the query request into a set time format to obtain a target query request; According to the target query request, the query result is obtained through the external system interface connected to the table query parameter.
17. The information query method according to claim 16, characterized in that: The checking of the table query parameters includes: Determine whether the table query parameter includes a second setting parameter corresponding to the corresponding data table; wherein the second setting parameter is a necessary parameter for scheduling the corresponding data table; When the table query parameter includes the second setting parameter corresponding to the corresponding data table, the table query parameter is sent to the front end, and the table query parameter is displayed in the form of a third interactive window; When the table query parameter does not include the second setting parameter corresponding to the corresponding data table, the table query parameter and third prompt information indicating the second setting parameter of the data table to be completed are sent to the front end, and the table query parameter and the third prompt information are displayed in the form of a fourth interactive window; Acquire the second setting parameter input by the user in the fourth interactive window, generate final table query parameters according to the table query parameters and the second setting parameters, send the final generated table query parameters to the front end, and display the final generated table query parameters in the form of the third interactive window; According to the second behavior operation of the user in the third interactive window, it is determined that the corresponding table query parameters pass the security risk verification; wherein, the second behavior operation is the behavior operation of the user on the third interactive window when it is determined that there is no security risk in the data table call corresponding to the corresponding table query parameter.
18. The information query method according to claim 1, characterized in that: Before obtaining the query request input by the user and determining the user intention according to the query request, the method further includes: Initializing the pre-accessed data table, and storing the relevant information of the data table obtained after the initialization in the first knowledge database; Initializing the pre-stored API, and storing the API related information obtained after the initialization in the second knowledge database; The historical question-answer pairs within a set time period are initialized, and the relevant information of the historical question-answer pairs obtained after the initialization is stored in the third knowledge database.
19. The information query method according to claim 18, characterized in that: The initializing of the pre-accessed data table includes: Initialize the pre-accessed data table to obtain the table name, table function description, and table description of the data table in a first standard format; Performing a universal dimension rule check on the data table to determine a second universal dimension of the data table; According to the table name, table function description, table description and the second general dimension of the data table, relevant information of the data table is obtained.
20. The information query method according to claim 18, characterized in that: The initialization of the pre-stored API includes: Initialize the pre-stored API to obtain the API name, API function description, and API input parameter definition information of the API in the second standard format; Performing a universal dimension rule check on the API to determine a third universal dimension of the API; According to the API name, API function description, API input parameter definition information and the third general dimension of the API, relevant information of the API is obtained.
21. The information query method according to claim 19 or 20, characterized in that: The general dimension rule check includes time format check, space check and scene check; wherein, the time format check is used to determine the time information corresponding to the data table or the API and convert the time information into a time dimension in a set time format; the space check is used to determine the space information corresponding to the data table or the API and convert the space information into a space dimension in a set space format; the scene check is used to determine the query scene information corresponding to the data table or the API and convert the query scene information into a scene dimension in a set scene format.
22. The information query method according to claim 1 or 2, characterized in that: The step of screening the pre-stored APIs according to the user intention to obtain the API screening results includes: Matching the first general dimension in the user intention with the third general dimension of the pre-stored APIs respectively, and filtering out APIs whose third general dimension is consistent with the first general dimension from the APIs to obtain a first-level screening result of the APIs; When the API first-level screening result is a null value, obtaining API function descriptions and / or API input parameter definition information of all the APIs, screening all the APIs according to the query request and the API function descriptions and / or API input parameter definition information of the APIs, and obtaining the API screening result; When there are at least two APIs in the API first-level screening result, obtain API function descriptions and / or API input parameter definition information of the at least two APIs, and screen the at least two APIs according to the query request and the API function descriptions and / or API input parameter definition information of the at least two APIs to obtain the API screening result; When there is one API in the API first-level screening result, the API name of the corresponding API and its API input parameter definition information are obtained as the API screening result.
23. An information query method, characterized in that: Applied to user terminals, including: Receive a query request input by a user on a user interface, and send the query request to a server, so that the server performs the following operations: Determining user intent based on the query request; Filter the pre-accessed data table according to the user intention to obtain a data table filtering result; Filter the pre-stored APIs according to the user's intention to obtain an API filtering result; Determining target query capabilities according to the data table screening results and the API screening results; Performing a query through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request; The query result sent by the server is received, and the query result is displayed on a user interface.
24. An information query system, characterized in that: Applied to the server, including: A user intention determination module, used to obtain a query request input by a user and determine the user intention according to the query request; A data table screening module, used to screen the pre-accessed data table according to the user's intention to obtain a data table screening result; An API screening module is used to screen the pre-stored APIs according to the user's intention and obtain API screening results; A target query capability determination module, used to determine the target query capability according to the data table screening result and the API screening result; The query display module is used to query through the data table query or API scheduling corresponding to the target query capability, obtain the query result of the query request, and display the query result.
25. An information query device, characterized in that: Applied to user terminals, including: The query request receiving module is used to receive the query request input by the user on the user interface and send the query request to the server so that the server performs the following operations: Determining user intent based on the query request; Filter the pre-accessed data table according to the user intention to obtain a data table filtering result; Filter the pre-stored APIs according to the user's intention to obtain an API filtering result; Determining target query capabilities according to the data table screening results and the API screening results; Performing a query through a data table query or API scheduling corresponding to the target query capability to obtain a query result of the query request; The query result receiving module is used to receive the query result sent by the server and display the query result on the user interface.
26. An information query device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the information query method according to any one of claims 1 to 22 or the information query method according to claim 23 is implemented.
27. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the information query method according to any one of claims 1 to 22 or the information query method according to claim 23.
28. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, it implements the information query method described in any one of claims 1 to 22 or the information query method described in claim 23.
Citation Information
Cited By
Natural language SQL (Structured Query Language) conversion method based on data platform and large language model
CN119576977A
Natural Language to SQL Conversion Method Based on Data Platform and Large Language Model
CN119576977B
Customer service question and answer statement generation method, customer service system, equipment and medium
CN119917630A
Customer service question and answer statement generation method, customer service system, device and medium
CN119917630B
Natural language-to-SQL conversion method based on data platform and large language model
WO2026165977A1
