Query result generation method and device
By determining user intentions and determining sub-data tables from data tables, the problem of inefficient processing of big data tables is solved, and efficient data processing and computing resources are achieved.
Patent Information
- Application Number
- CN202411457082.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-14
AI Technical Summary
In scenarios where data tables are required for calculation and reasoning, due to the large size of the data table, it cannot be sent to the language model for processing at one time, resulting in waste of computing resources and low data processing efficiency.
By determining the user's intent, the object description and sub-data table of the object to be queried is determined, so that the language model can generate query results based on the object description and sub-data table, reducing the amount of data processed.
Effectively respond to user needs, improve data processing efficiency, and reduce waste of computing resources.
Smart Images

Figure CN119441291A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of computer technology, and in particular, to a query result generating method and device. Background Art
[0002] Language models are used to understand and generate human language. With the rapid development of artificial intelligence technology, language models have better natural language understanding and computational reasoning capabilities.
[0003] In existing scenarios where data tables are needed for computational reasoning, the data tables are large and cannot be fed into the language model for processing at once. Even if they can be processed, the language model needs to process the entire data table, while actual calculations only require part of the data in the data table. This results in a waste of computing resources and reduces data processing efficiency. Summary of the invention
[0004] One or more embodiments of this specification describe a query result generating method and device.
[0005] In a first aspect, an embodiment of the present specification provides a method for generating a query result. The method includes determining a user intent through a language model based on user information. The method also includes determining an object description based on the user intent and determining a sub-data table from a data table, wherein the data table stores tabular data of multiple objects. In addition, the method also includes generating a query result through a language model based on the object description and the sub-data table.
[0006] In a second aspect, an embodiment of the present specification provides a query result generating device. The device includes an intention determination module, which is used to determine the user intention through a language model based on the user information. The device also includes a data acquisition module, which is used to determine the object description based on the user intention and determine a sub-data table from a data table, wherein the data table stores tabular data of multiple objects. In addition, the device also includes a query module, which is used to generate a query result through a language model based on the object description and the sub-data table.
[0007] In a third aspect, an embodiment of the present specification provides an electronic device. The electronic device includes a processor and a memory. The processor is connected to the memory. The memory is used to store executable program code. The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method described in the first aspect.
[0008] In a fourth aspect, the embodiments of this specification provide a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0009] The beneficial effects brought by the technical solutions provided by some embodiments of this specification include at least:
[0010] In one or more embodiments of the present specification, the embodiments of the present specification propose a query result generation method and device, which determines the object description and sub-data table of the object to be queried by determining the user's intention; then the language model can generate a query result that meets the user's intention based on the object description and sub-data table. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0012] Figure 1 A flowchart of a query result generation method provided in an embodiment of this specification;
[0013] Figure 2 A system architecture diagram for implementing a query result generation method provided in an embodiment of this specification;
[0014] Figure 3 A flowchart of the interactive steps of a query result generating method provided in an embodiment of this specification;
[0015] Figure 4A This is a schematic diagram of storing an object description in the embodiments of this specification;
[0016] Figure 4B This is a schematic diagram of data table storage in the embodiments of this specification;
[0017] Figure 5 This is an example diagram of converting a data table index item into a standard index item in an embodiment of this specification;
[0018] Figure 6 This is an example diagram of determining a sub-data table from a data table in an embodiment of this specification;
[0019] Figure 7 A schematic diagram of a query result generation method provided in an embodiment of this specification applied to a human-computer interaction interface;
[0020] Figure 8 A schematic diagram of the structure of a query result generating device provided in an embodiment of this specification;
[0021] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of this specification will be described clearly and completely below in conjunction with the drawings in the embodiments of this specification.
[0023] The terms "first", "second", "third", etc. in the description and claims of this specification and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0024] In existing scenarios where data tables are needed for computational reasoning, the data tables are large and cannot be fed into the language model for processing at once. Even if they can be processed, the language model needs to process the entire data table, while actual calculations only require part of the data in the data table. This results in a waste of computing resources and reduces data processing efficiency.
[0025] The query result generation method provided by the embodiment of the present specification can identify the real intention of the user and obtain the required partial table data from the data table based on the real intention of the user, and the language model can obtain the required query result based on the partial table data. The embodiment of the present specification can effectively respond to user needs and has high data processing efficiency.
[0026] The method of the embodiment of this specification can be applied between a client (computer device) and a server. The client and the server communicate through a network.
[0027] The user initiates a query request to the robot on the client, and the robot sends the query request to the server. The server receives the query request, processes it accordingly, and responds to the query request.
[0028] The computer device may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0029] The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0030] See also Figure 1 , Figure 1 A flowchart of a query result generation method provided in an embodiment of this specification is shown. The method includes:
[0031] Step 102, based on the user information, determine the user intention through a language model;
[0032] Step 104, based on the user intention, determine an object description and determine a sub-data table from a data table, wherein the data table stores tabular data of a plurality of objects; and
[0033] Step 106: Generate a query result through the language model based on the object description and the sub-data table.
[0034] The method of the embodiment of this specification is executed on the server side, and the language model deployed on the server side is used to determine the user's query intention, so as to obtain relevant object descriptions and sub-data tables according to user needs, so that the language model can quickly match more accurate query results based on a smaller amount of data and data that is more in line with user needs. In this way, not only the server processing efficiency is improved, but also the user experience is better.
[0035] Next, steps 102 to 106 will be described in detail.
[0036] In step 102, the user information includes information about the user's interaction with the robot on the client side.
[0037] In one example, the client presents a dialog interface, and the robot interacts with the user in a conversational form (e.g. Figure 7 ). In this example, the user information includes the interaction information generated during the session.
[0038] During the conversation, the user inputs a question, and the robot can provide guidance and feedback based on the question. For example, the robot can guide the user to give more specific query information through replies with options. Another example is to guide the user to fill in specific query information through replies in the form of a table.
[0039] In another example, the client presents a query page interface, which is configured with a query form. The user enters relevant information according to the form requirements. When the user completes the input and confirms, the robot processes the data collected by the page and responds to the query request. In this example, the user information includes the data collected by the page and the page information.
[0040] After obtaining the user information, the user information is processed.
[0041] In one example, when the user information includes interactive information generated during the conversation, the conversation between the robot and the user is obtained, and the conversation related to the query is extracted from the conversation, and is packaged into prompt words and sent to the language model for semantic analysis.
[0042] In another example, when the user information includes data collected from the page and page information, the page information is obtained, including page description information and table information, and the data entered by the user through the table, that is, the data collected from the page, is obtained. The page description information, table information, and the data collected from the page are encapsulated into prompt words and sent to the language model for semantic analysis.
[0043] The language model performs semantic understanding on the prompt words in the input model and parses to obtain the user's intention. The language model may adopt a generative language model, such as LLM (Large Language Models) and AIGC (Artificial Intelligence Generated Content).
[0044] The user intent is used to reflect the real intent of the user's query. Specifically, the real intent of the user's query may include the object that the user wants to query and a certain aspect of the object that the user wants to query.
[0045] In one example, a user queries the revenue of product A. Product A is the object that the user wants to query, and the revenue is the content that the user needs to query about product A.
[0046] In another example, the user searches for a travel plan to travel to City C. The travel product of City C is the object that the user wants to search, and the content that the user needs to search includes the travel plan.
[0047] In another example, the user designs a logistics transportation plan according to the supply demand. The object to be queried by the user is the supply order, and the content to be queried by the user includes the logistics transportation plan.
[0048] In step 104, based on the user intention, determining the object description and determining the sub-data table from the data table includes:
[0049] Based on the user's intention, determining a query key for the object to be queried; and
[0050] Based on the query key, the object description is determined and the child data table is determined from the data table.
[0051] like Figure 2, the language model 214 parses the user input information sent by the robot 204, determines the user's intention, and returns the determined user's intention to the robot, and the user confirms the user's intention by interacting with the robot. After that, the server executes step 104, and can extract field information from the user's intention to identify the object to be queried and the query key of the object to be queried. The embodiment of this specification uses the query key to query the object description 208 and the sub-data table 212 related to the object to be queried from the database. Among them, the database can be stored on the client, on the server, or in the cloud. The database stores the object description and data table of the object, as well as the first mapping table for standardizing the object description and the second mapping table for standardizing the data table. The object description is the description corresponding to the object, which can be a product manual or other forms of descriptive description of the object. The object description 208 is read from the object description 206 of multiple objects, and the sub-data table 212 is read from the data table 210, which can be stored in a structured database.
[0052] In some implementations, based on the user's intent, all query keys of the object to be queried can be determined. For example, during a session, the user inputs relatively detailed user information, which can clarify the user's intent and further determine all query keys of the object to be queried. For another example, when collecting user information using a table page, relatively comprehensive user information can be collected in a targeted manner based on the object to be queried, which can clarify the user's intent and further determine all query keys of the object to be queried.
[0053] In some implementations, based on the user's intent, some query keys of the object to be queried are determined, and other query keys are obtained through interaction. This often happens during a session when the user inputs relatively broad user information or relatively little user information. To this end, determining the query key of the object to be queried based on the user's intent includes:
[0054] Based on the user intention, determining the object to be queried and part of the query key;
[0055] Based on other query keys required by the object to be queried, new user information is obtained and new user intentions are obtained through user interaction; and
[0056] Based on the new user intention, the other query keys required for the object to be queried are determined.
[0057] The specific query keys required are determined based on the query keys required for the object to be queried. For example, the query keys required for object A include query key 1, query key 2, and query key 3; the query keys required for object B include query key 1, query key 2, and query key 4. The partial query keys of object A are obtained as query key 1 and query key 2. When the object to be queried is object A, it can be determined that the other query key required for object A is query key 4. The robot sends the option questions or forms constructed based on the required query key 4 to the user, and the user enters the user information according to the robot's guidance. The robot sends the new user information to the language model for parsing to obtain the new user intent.
[0058] Afterwards, the object to be queried and all the query keys may be determined based on the previous user intention and the new user intention.
[0059] The database stores object descriptions and data tables of multiple objects. The method of the embodiment of this specification also includes:
[0060] The object descriptions and the data table of the plurality of objects are stored, and the table data in the data table is associated with the object descriptions through the objects.
[0061] The object description and data table can be stored in the database by input; they can also be obtained by collecting public databases, or collecting relevant databases under authorization, and stored in the database.
[0062] When the object description and data table are obtained from different sources, and there are differences in the terms of the object description of each object and the index items in the data table, the object descriptions and data tables of different objects in the database need to be standardized.
[0063] Wherein, storing the object descriptions of the plurality of objects comprises:
[0064] According to the first mapping table, converting the terms in the original object description of each object into standard terms; and
[0065] Storage is converted to object descriptions with standard terminology.
[0066] The original object description of each object belongs to different types of objects, and the terms therein are various, which need to be standardized and converted. The first mapping table stores multiple standard terms and multiple common terms corresponding to the mappings. In addition, the first mapping table can be replaced by a graph to achieve the mapping between multiple common terms and multiple standard terms.
[0067] For example, object description A includes term 1, and object description B includes term 2. In the first mapping table, term 1 and term 2 both correspond to standard term A. After comparing the first mapping table, term 1 in object description A can be converted to standard term A, and term 2 in object description B can be converted to standard term A.
[0068] like Figure 4A , converted into object descriptions with standard terms and stored in the database in the form of files, and each file is assigned an object description address in the database. The database stores an object description list 402, which stores object descriptions of multiple objects.
[0069] When the query key includes a key related to an object name, the object description related to the object name can be indexed from the object description list 402 and the corresponding file can be read.
[0070] Wherein, storing the data table comprises:
[0071] According to the second mapping table, the index items of the original table data of each object are converted into standard index items;
[0072] The storage is converted to tabular data with standard index entries.
[0073] The second mapping table stores a plurality of standard index items and a plurality of common index items mapped thereto. In addition, the second mapping table can be replaced by a graph to achieve mapping between the plurality of common index items and the plurality of standard index items.
[0074] A standard term and a plurality of common terms mapped thereto. In addition, the first mapping table may be replaced by a graph to achieve mapping between the plurality of common terms and the plurality of standard terms.
[0075] For example, the index item of the data table of object A includes name 1, and the index item of the data table of object B includes name 2. In the second mapping table, both name 1 and name 2 correspond to index item 1. After comparing the second mapping table, name 1 of the data table of object A can be converted to index item 1, and name 2 of the data table of object B can be converted to index item 1.
[0076] For another example, the sub-items of the index item in the data table of object A include A1 and A3. In the second mapping table, A1 corresponds to 01, and A3 corresponds to 02. After comparing the second mapping table, the sub-item A1 of the index item in the data table of object A can be converted to 01, and the sub-item A3 can be converted to 02.
[0077] like Figure 4B , converted into tabular data with standard index items and stored in a structured database (such as Figure 2The data table 404 in the database stores tabular data of multiple objects.
[0078] Figure 5 An example of standardized conversion of data table index items is shown. All tables in the example are only parts of the actual table, which is intended to illustrate how index items are converted. Table 500 is the original table, and Name 1 and Name 2 correspond to the first index item and the second index item. Among them, Table 502 is a mapping table related to the sub-items of the second index item, Table 506 is a mapping table related to the sub-items of the first index item, and Table 504 is a mapping table related to the index items. Through the mapping relationship of Table 504, Name 1 is converted to Index Item 1, and Name 3 is converted to Index Item 2. Through the mapping relationship of Table 502, all sub-items under Name 2 are standardized. Through Table 506, all sub-items under Name 1 are standardized. Finally, Table 508 with standardized processing is obtained.
[0079] When the query key includes a key related to the object name, the table data related to the object name can be indexed from the data table 404. As for which specific part of the table data to read, the data table needs to be read based on other keys in the query key to obtain a sub-data table.
[0080] The query key includes a user key and an object key. The user key includes a key related to user information. The object key includes a key related to object information.
[0081] The determining the object description based on the query key and determining the sub-data table from the data table specifically includes:
[0082] Determining the object description of the object to be queried based on the object key in the query key; and
[0083] Based on the object key and the user key in the query key, the sub-data table of the object to be queried is determined from the table data of the object to be queried.
[0084] The user key includes multiple user primary keys and multiple user subkeys. A user primary key can have one or more user subkeys. The object key includes multiple object primary keys and multiple user subkeys. An object primary key can have one or more object primary keys.
[0085] Specifically, based on the object key and the user key in the query key, determining the sub-data table of the object to be queried from the table data of the object to be queried includes:
[0086] The plurality of object primary keys and the plurality of object subkeys, and the plurality of user primary keys and the plurality of user subkeys form a key group;
[0087] The table data of the object to be queried in the data table is indexed by the key group, and the table data obtained by the index is determined as a sub-data table.
[0088] like Figure 6 When there are 4 index items, assume that index item 1 and index item 2 are user primary keys, sub-item 01 of index item 1 and sub-item 10 of index item 2 are user sub-keys, index item 3 and index item 4 are object primary keys, sub-item 20 of index item 3 and sub-item 31 of index item 4 are object sub-keys.
[0089] (Index item 1: 01), (Index item 2: 10), (Index item 3: 20), and (Index item 4: 31) form a key group key.
[0090] The data table 602 is queried with the key group key, and the read table data is finally determined as the sub-data table 604.
[0091] in, Figure 6 The data sheet 602 can be found in Figure 5 The conversion method is converted into a data table with standard index items.
[0092] Each key in the above-mentioned key group needs to be standardized according to the standard index item before forming the key group.
[0093] In one example, the language model may perform standardization when determining the user's intent, and may form a key group in a standardized format when querying.
[0094] In another example, after the language model determines the user's intent, the server may also standardize the information in the user's intent according to the second mapping table, and may form a key group in a standardized format during query.
[0095] In order to obtain query results that meet the user's intention, in the process of determining the query key based on the user's intention, a human-computer interaction method is used to guide the user to input more or more detailed user information.
[0096] In this implementation manner, based on the object key and the user key in the query key, determining the sub-data table of the object to be queried from the table data of the object to be queried specifically includes:
[0097] The plurality of object primary keys and the plurality of object subkeys, and the plurality of user primary keys and the plurality of user subkeys form a key group;
[0098] Based on the query key determined by the new user intention, update the related keys in the key group mentioned above;
[0099] The table data of the object to be queried in the data table is indexed with the updated key group, and the table data obtained by the index is determined as a new sub-data table.
[0100] For detailed query process, please refer to Figure 6 .
[0101] Each key in the above-mentioned key group needs to be standardized according to the standard index item before forming the key group.
[0102] In order to obtain the query result that meets the user's intention, the embodiment of this specification can also obtain new user intention by obtaining user information again after the user is not satisfied with the query result.
[0103] Generally, during a conversation, when the robot has fed back the query results based on the conversation information, the user will often continue to input user information. In one example, the robot feeds the historical conversation and the current conversation as user information into the language model for re-analysis, and then a new user intent can be determined. In another example, the robot feeds the current reply as user information into the language model for parsing, and obtains the user intent of the current conversation through parsing, and determines the user intent of the current conversation and the user intent of the historical conversation as the new user intent. Among them, if the time interval between the historical conversation and the current conversation does not exceed the preset time, the historical conversation and the current conversation can be considered as associated conversations.
[0104] In the latter example, the previous user intent has confirmed the query key, and the previously confirmed query key needs to be adjusted according to the new user intent.
[0105] Specifically, based on the query key determined by the new user intent, the relevant keys in the key group determined in the previous user intent are updated.
[0106] For example, the key group determined in the previous user intent is key = (index item 1: 01, index item 2: 10, index item 3: 20, index item 4: 31). The query key determined by the new user intent is the user key. Assuming that index item 1 is the user primary key, the user subkey corresponding to the user primary key determined according to the new user intent is 02. Then the original key group is updated to key' = (index item 1: 02, index item 2: 10, index item 3: 20, index item 4: 31)
[0107] In some implementations, based on the user's intent, some query keys for the object to be queried are determined, and other query keys are determined according to pre-configured information.
[0108] The determining, based on the user intention, a query key of the object to be queried comprises:
[0109] Based on the user intention, determining the object to be queried; and
[0110] Based on the object to be queried, a pre-configured query key is determined as at least a part of the query key of the object to be queried.
[0111] In one implementation, based on the object to be queried, determining a preconfigured query key as at least a part of the query key of the object to be queried includes:
[0112] Acquire the query key required for the object type of the object to be queried from the configuration list; and
[0113] The query key obtained from the configuration list is determined as a part of the query key of the object to be queried.
[0114] The configuration list pre-stores the query keys required under different object types, and each object type is associated with multiple objects. After the object to be queried is determined, the object type to which the object to be queried belongs is determined from the configuration list, and the required query key is obtained.
[0115] When part of the query keys have been determined based on the user's intention, the remaining query keys may be determined from the pre-configured query keys.
[0116] In addition to obtaining the query key from the configuration list, the object description can also be read from the database to determine part of the query key required for the object to be queried, such as the object primary key and the user primary key.
[0117] In another implementation manner, based on the object to be queried, determining a preconfigured query key as at least a part of the query key of the object to be queried includes:
[0118] Acquire, from the user's historical portrait, records of historical objects of the same object type as the object to be queried; and
[0119] The query key in the record is determined as at least a part of the query key of the object to be queried.
[0120] The user history profile records user information, query records, transaction records, etc. The user history profile is formed by the server based on the user's past behavior of using the client under the user's authorization.
[0121] This implementation method determines the query key based on the historical records in the user's historical profile. The query key determined in this way is closer to the user's needs.
[0122] In one implementation manner, obtaining a record of a historical object having the same object type as the object to be queried from the user's historical portrait includes:
[0123] Acquire transaction records of the historical objects of the same object type as the object to be queried from the user history portrait;
[0124] Extracting basic user information and object information from the transaction record;
[0125] Based on the user basic information and the object information, a query key of the historical object is determined.
[0126] In one example, a user inquires about the benefits of product A. The transaction records of similar products as product A are obtained from the user's historical profile. That is, the user obtains the transaction records of related products from the transaction records of products that have been purchased. The basic information of the user and the object information are extracted from the transaction orders in the transaction records. When product A is an annuity insurance, the basic information of the insured, including age, gender, etc., is obtained from the insurance policy. The information such as the collection method, payment period, payment frequency, and payment amount is also obtained from the insurance policy.
[0127] The extracted age and gender are used as user keys, and the extracted collection method, payment period, payment frequency, and payment amount are used as object keys. After determining the user key and object key, all query keys can be known.
[0128] In another example, a user searches for travel plans to City C. Transaction records of domestic travel products are obtained from the user's historical profile. That is, the user obtains relevant travel transaction records from the travel transaction records that have been purchased. User basic information and object information are extracted from the transaction orders in the transaction records. The user basic information may include name, ID number, age, gender, etc. The object information may include accommodation information, transportation information, and travel time.
[0129] The extracted name, ID number, age, and gender are used as user keys, and the extracted accommodation information (such as homestay or star-rated hotel), transportation information (such as car rental or high-speed rail or airplane), and travel time are used as object keys.
[0130] When the user only wants to query travel plans that include transportation and accommodation, after determining the above user key and object key, all query keys are determined.
[0131] When a user wants to query a travel plan that includes a travel route, it is also necessary to obtain tourist attraction information, including the name and location of the attraction. After determining the above user key and object key, it is also necessary to extract the key of the relevant information from the tourist attraction information. The tourist attraction information is stored in the database, and when a user queries a city travel plan, the relevant tourist attraction information can be obtained.
[0132] In another example, the user designs a logistics transportation plan based on the supply demand. The transaction records of the same transportation destination are obtained from the user's historical profile. The vehicle information, transportation route, transportation time, and logistics user information are extracted from the supply order in the transaction record.
[0133] The extracted logistics user information is used as the user primary key, and the extracted vehicle information (such as type, loading capacity), transportation route, and transportation time are used as the object primary key.
[0134] After determining the above user key and object key, it is also necessary to obtain new supply requirements and obtain the key of the quantity of goods from them.
[0135] In another implementation manner, obtaining the record of the historical object of the same object type as the object to be queried from the user's historical portrait includes:
[0136] Acquire query records of the historical object having the same object type as the object to be queried from the user historical portrait;
[0137] Obtain a query key for generating a final query result in the query record.
[0138] This implementation may determine the query key from the historical query records, and may determine all or part of the query key according to different query scenarios.
[0139] In step 106, based on the object description and the sub-data table, generating a query result by using the language model includes:
[0140] Obtaining the object name and the object description address of the object description;
[0141] Generate a prompt word based on the object name of the object description, the object description address, and the sub-data table;
[0142] The language model generates a query result based on the prompt word.
[0143] Generating a prompt word based on the object name of the object description, the object description address, and the sub-data table includes:
[0144] Converting the sub-data table obtained from the data table into a sequence of fields containing tabular data;
[0145] A prompt word is generated based on the object name of the object description, the object description address, and the field sequence.
[0146] Among them, the sub-data table can be converted into CSV format and can be sent to the language model together with the object name and object description address of the object description.
[0147] When a new sub-data table is found, the new sub-data table will overwrite the historical sub-data table. The prompt words sent to the language model are encapsulated based on the object name and object description address of the new sub-data table and the object description currently being queried.
[0148] In step 106, based on the object description and the sub-data table, generating a query result by using the language model includes:
[0149] Determining a calculation result by the language model based on the mathematical model included in the object description and the sub-data table;
[0150] A query result including the calculation result is generated by the language model.
[0151] The language model obtains the object description according to the object description address, and obtains a mathematical model therefrom, such as a product revenue calculation formula, a travel product cost calculation formula, and a logistics transportation cost calculation formula.
[0152] The sub-data table contains specific data of parameters required by the mathematical model.
[0153] The data in the sub-data table can be substituted into the data model to obtain calculation results, such as product revenue value, total cost of travel plan, and total cost of logistics transportation plan.
[0154] Figure 3 A flowchart of the interactive steps of a query result generating method provided in an embodiment of this specification is shown.
[0155] Figure 3 The specific process is as follows:
[0156] Step 302, the client receives the query information input by the user and converts it into user input information;
[0157] Step 304, the client sends the user input information to the server;
[0158] Step 306, the server receives user input information;
[0159] Step 308, the server uses the language model deployed thereon to perform semantic analysis to obtain the user's intention;
[0160] Step 310, the server sends the determined user intent to the client;
[0161] Step 312, the client receives the user intention determined by the server;
[0162] Step 314: the client feeds back the user's intention in the form of a conversation or form, and the user can confirm or modify it.
[0163] Step 316, the client sends the confirmed user intention to the server;
[0164] Step 318, the server receives the confirmed user intention sent by the client;
[0165] Step 320: The server determines the object description from the database and the sub-data table from the data table based on the user's intention; the specific determination process may refer to one or more of the above-mentioned specific implementations.
[0166] Step 322: The server generates a query result by using a language model based on the determined object description and sub-data table.
[0167] Step 324: The server sends the query result to the client.
[0168] Step 326: The client receives the query results and displays them to the user.
[0169] In one example, a user enters query information on the client, such as "I want to know the revenue of product A". The server uses a language model to perform semantic analysis on the user input information and obtains the query intention for product A, including the object name (product name) and object type (product type) of the object to be queried.
[0170] The server uses the object name and object type keys, and the gender and age keys extracted from the user's basic information to form part of the query key. Other query keys can be determined from historical records or configuration lists or by obtaining new user intentions. Based on the query key, the server determines the object description (product manual) and sub-data table (revenue calculation table) from the database.
[0171] The server uses the language model semantics to identify the mathematical model in the object description, such as the product revenue calculation formula. The language model performs inference calculations based on the mathematical model and the specific data of the required parameters in the sub-data table to obtain the revenue value.
[0172] The server will feed back the object description, sub-data table and income value found in the query to the client in the form of query results.
[0173] In another example, the user enters query information on the client, such as "I want to know about the tour group in City C". The server uses the language model to perform semantic analysis on the user input information and obtains the query intention for the tour in City C, including the object name of the object to be queried (tourism products in City C) and the object type (tourism product type).
[0174] Based on the keys of object name and object type, the server extracts the keys of gender, age, and ID number from the basic information of the user to form part of the query key. Other query keys can be determined from historical records or configuration lists or by obtaining new user intentions, such as keys related to transportation, accommodation hotels, restaurants, and attractions. Based on the query key, the server determines the object description (C City Tourism Product Manual) and sub-data tables (transportation fee table, accommodation fee table, catering fee table, ticket fee table) from the database.
[0175] The server uses the language model semantics to identify the mathematical model in the object description, such as the total cost formula containing the transportation calculation formula, accommodation calculation formula, catering calculation formula, and ticket calculation formula. The language model performs inference calculation based on the mathematical model and the specific data of the required parameters in the sub-data table to obtain the total cost of the tourism product.
[0176] The server will feed back the object description, sub-data table and total cost found in the query to the client in the form of query results.
[0177] In another example, the user designs a logistics transportation plan based on the supply demand. The transaction records of the same transportation destination are obtained from the user's historical profile. The vehicle information, transportation route, transportation time, and logistics user information are extracted from the supply order in the transaction record.
[0178] The user enters query information on the client, such as "Please generate a logistics transportation plan according to the new supply order." The server uses the language model to perform semantic analysis on the user input information and obtains the design intent of the logistics transportation plan for the new supply order, including the object name (supply order number) and object type (such as distinguishing order types according to the transportation destination) of the object to be queried.
[0179] The server uses the keys of the object name and object type, as well as the keys extracted from the logistics user information providing the transportation service, to form part of the query key. Other query keys can be determined from historical records or configuration lists or by obtaining new user intentions, such as keys related to vehicle information (such as type, loading capacity), transportation routes, and transportation time. Based on the query key, the server determines the object description (logistics user manual) and sub-data table (logistics transportation cost calculation table) from the database.
[0180] The server uses the language model semantics to identify the mathematical model in the object description, such as the logistics transportation calculation formula. The language model performs inference calculations based on the mathematical model and the specific data of the required parameters in the sub-data table to obtain the total transportation cost required for the supply order.
[0181] The server will feed back the object description, sub-data table and total transportation cost to the client in the form of query results.
[0182] In addition to the above application scenarios, it can also be applied to other scenarios, such as line design scenarios. According to the line loss calculation formula in the line design manual and the line loss meter (the metering data of different types of lines and different distances is stored in the table), the language model is used to generate a query result containing the total line loss value of the line design scheme according to the user's intention. For example, in the production scenario, the production situation can be predicted and queried. According to the working time calculation formula in the process manual of the production product and the production meter (the table stores the working time data of different process equipment under different processes), the language model is used to generate a query result containing the time required to complete the production according to the user's intention.
[0183] When the user confirms the user intent, the robot on the client side can construct guiding questions for the query key that cannot be determined to obtain the user's new user intent. The above process can be performed in step 314 to obtain the new user intent through user interaction.
[0184] When the user is not satisfied with the query result, after step 326, the client obtains new input information from the user, and the server determines a new user intention based on the new user information.
[0185] After the server parses the new user intent, it updates the query key determined based on the previous user intent. The server obtains a new sub-data table based on the updated query key. If the query object required in the user intent does not change, there is no need to re-read the object description. If the query object required in the user intent changes, the object description still needs to be re-read.
[0186] The server generates query results using a language model based on the read object description (which may also be a new object description) and the new sub-data table.
[0187] The embodiments of this specification can be implemented based on RAG technology.
[0188] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0189] See also Figure 8 , Figure 8 A schematic diagram of the structure of a query result generating device provided in an embodiment of this specification is shown.
[0190] The device 800 at least includes: an intention determination module 802, a data acquisition module 804, and a query module 806. Among them:
[0191] The intention determination module 802 is used to determine the user intention through a language model based on the user information;
[0192] The data acquisition module 804 is used to determine the object description based on the user intention and determine a sub-data table from a data table, wherein the data table stores tabular data of multiple objects; and
[0193] The query module 806 is used to generate a query result through the language model based on the object description and the sub-data table.
[0194] The device of the embodiment of this specification is set at the server end, and uses the language model to determine the user's query intention, so as to obtain the relevant object description and sub-data table according to the user's needs, so that the language model can quickly match a more accurate query result based on a smaller amount of data and data that is more in line with the user's needs. In this way, not only the server processing efficiency is improved, but also the user experience is better.
[0195] Specifically, the intention determination module 802 may use a language model to perform semantic analysis on user information to identify fields that can reflect user intentions.
[0196] Specifically, the data acquisition module 804 includes:
[0197] A first determining unit, based on the user intention, determines a query key of the object to be queried, wherein the query key includes a user key and an object key; and
[0198] The second determining unit is used to determine the object description based on the query key and determine the sub-data table from the data table.
[0199] In some implementations, the first determination unit may determine all query keys of the object to be queried based on the user's intention.
[0200] In some implementations, the first determination unit may guide the user to feedback more specific user intentions through user interaction according to one or more of the aforementioned implementations.
[0201] In some implementations, the first determining unit may determine all or part of the query keys in combination with preconfigured query keys according to one or more of the foregoing implementations.
[0202] Furthermore, optional implementations include a scheme for determining query keys by configuring a list, a scheme for determining all or part of the query keys by user history profiles, and a scheme for determining part of the query keys by reading object descriptions from a database.
[0203] Specifically, the second determination unit may first determine the object description of the object to be queried based on the object key in the query key; then, based on the object key and the user key in the query key, determine the sub-data table of the object to be queried from the tabular data of the object to be queried.
[0204] The process of determining the sub-data table based on the query key may be performed according to one or more of the aforementioned embodiments.
[0205] The query module 808 includes:
[0206] A first generating unit, configured to generate a prompt word based on the object description and the sub-data set determined by the data acquisition module;
[0207] The second generating unit is used to generate a query result based on the prompt word by using a language model.
[0208] Specifically, the first generating unit generates the prompt word according to one or more of the aforementioned implementations.
[0209] The second generating unit may also generate a calculation result based on the prompt word by using a language model.
[0210] Specifically, based on the mathematical model and sub-data table included in the object description, the language model performs inference calculation to obtain the calculation result. The language model generates the calculation result together with the object description and sub-data set determined by the data acquisition module as the query result.
[0211] The device of the embodiment of the present specification also includes a storage module, which is used to store object descriptions and data tables of multiple objects. The table data in the data table is associated with the object description through the object.
[0212] In addition, object descriptions and data tables need to be standardized and converted before being stored in the database.
[0213] like Fig. 9 An electronic device 900 provided in an embodiment of the present specification may include: at least one processor 902, at least one network interface 908, a user interface 906, a memory 910 and at least one communication bus 904.
[0214] The communication bus can be used to realize the connection and communication among the above-mentioned components.
[0215] The user interface may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0216] The network interface may include but is not limited to a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0217] Among them, the processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the routing device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one hardware form of DSP, FPGA, and PLA. The processor can integrate one or a combination of CPU, GPU, modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor, but may be implemented separately through a chip.
[0218] Among them, the memory may include RAM or ROM. Optionally, the memory includes a non-transient computer-readable medium. The memory can be used to store instructions, programs, codes, code sets or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory may also be at least one storage device located away from the aforementioned processor. The memory as a computer storage medium may include an operating system, a network communication module, a user interface module and an application. The processor may be used to call the application stored in the memory and execute the method in one or more of the above-mentioned embodiments.
[0219] The embodiments of this specification also provide a computer-readable storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in the above method embodiments. If the components of the above electronic device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.
[0220] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of this specification is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0221] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.
[0222] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims of this specification.
Claims
1. A query result generating method, comprising: Based on user information, determine user intent through language model; Based on the user intention, determining an object description and determining a sub-data table from a data table, the data table storing tabular data of a plurality of objects; as well as Based on the object description and the sub-data table, a query result is generated by the language model.
2. The method according to claim 1, wherein based on the user intention, determining the object description and determining the sub-data table from the data table comprises: Based on the user intention, determining a query key of the object to be queried, the query key including a user key and an object key; as well as Based on the query key, the object description is determined and the child data table is determined from the data table.
3. The method according to claim 2, wherein determining the query key of the object to be queried based on the user intention comprises: Based on the user intention, determining the object to be queried and part of the query key; Based on other query keys required by the object to be queried, new user information is obtained and new user intentions are obtained through user interaction; as well as Based on the new user intention, the other query keys required for the object to be queried are determined.
4. The method according to claim 2 or 3, wherein based on the query key, determining the object description and determining the sub-data table from the data table comprises: Determining the object description of the object to be queried based on the object key in the query key; as well as Based on the object key and the user key in the query key, the sub-data table of the object to be queried is determined from the table data of the object to be queried.
5. The method according to claim 4, wherein the object key comprises a plurality of object primary keys and a plurality of object subkeys subordinate to the plurality of object primary keys, the user key comprises a plurality of user primary keys and a plurality of user subkeys subordinate to the plurality of user primary keys, and based on the object key and the user key in the query key, determining the subdata table of the object to be queried from the table data of the object to be queried comprises: The plurality of object primary keys and the plurality of object subkeys, and the plurality of user primary keys and the plurality of user subkeys form a key group; The table data of the object to be queried in the data table is indexed by the key group, and the table data obtained by the index is determined as a sub-data table.
6. The method according to claim 4, wherein the object key comprises a plurality of object primary keys and a plurality of object subkeys subordinate to the plurality of object primary keys, the user key comprises a plurality of user primary keys and a plurality of user subkeys subordinate to the plurality of user primary keys, and based on the object key and the user key in the query key, determining the subdata table of the object to be queried from the table data of the object to be queried comprises: The plurality of object primary keys and the plurality of object subkeys, and the plurality of user primary keys and the plurality of user subkeys form a key group; Based on the query key determined by the new user intention, update the relevant key in the key group; The table data of the object to be queried in the data table is indexed with the updated key group, and the table data obtained by the index is determined as a new sub-data table.
7. The method according to claim 2, wherein determining the query key of the object to be queried based on the user intention comprises: Based on the user intention, determining the object to be queried; as well as Based on the object to be queried, a pre-configured query key is determined as at least a part of the query key of the object to be queried.
8. The method according to claim 7, wherein based on the object to be queried, determining the pre-configured query key as at least a part of the query key of the object to be queried comprises: Acquire the query key required for the object type of the object to be queried from the configuration list; as well as The query key obtained from the configuration list is determined as a part of the query key of the object to be queried.
9. The method according to claim 7, wherein based on the object to be queried, determining the pre-configured query key as at least a part of the query key of the object to be queried comprises: Acquire, from the user's historical portrait, records of historical objects of the same object type as the object to be queried; as well as The query key in the record is determined as at least a part of the query key of the object to be queried.
10. The method according to claim 9, wherein obtaining the records of historical objects of the same object type as the object to be queried from the user's historical portrait comprises: Acquire transaction records of the historical objects of the same object type as the object to be queried from the user history portrait; Extracting basic user information and object information from the transaction record; Based on the user basic information and the object information, a query key of the historical object is determined.
11. The method according to claim 9, wherein obtaining the records of historical objects of the same object type as the object to be queried from the user's historical portrait comprises: Acquire query records of the historical object having the same object type as the object to be queried from the user historical portrait; Obtain a query key for generating a final query result in the query record.
12. The method according to claim 1, further comprising: The object descriptions and the data table of the plurality of objects are stored, and the table data in the data table is associated with the object descriptions through the objects.
13. The method of claim 12, wherein storing the object descriptions of the plurality of objects comprises: According to the first mapping table, converting the terms in the original object description of each object into standard terms; Storage is converted to object descriptions with standard terminology.
14. The method according to claim 12, wherein storing the data table comprises: According to the second mapping table, the index items of the original table data of each object are converted into standard index items; The storage is converted to tabular data with standard index entries.
15. The method according to claim 1, wherein generating a query result by using the language model based on the object description and the sub-data table comprises: Obtaining the object name and the object description address of the object description; Generate a prompt word based on the object name of the object description, the object description address, and the sub-data table; The language model generates a query result based on the prompt word.
16. The method according to claim 15, wherein generating a prompt word based on the object name of the object description, the object description address, and the sub-data table comprises: Converting the sub-data table obtained from the data table into a sequence of fields containing tabular data; A prompt word is generated based on the object name of the object description, the object description address, and the field sequence.
17. The method according to claim 1 or 15, wherein generating a query result by using the language model based on the object description and the sub-data table comprises: Determining a calculation result by the language model based on the mathematical model included in the object description and the sub-data table; A query result including the calculation result is generated by the language model.
18. A query result generating device, comprising: An intention determination module, used to determine the user intention through a language model based on user information; A data acquisition module, configured to determine an object description based on the user intention and determine a sub-data table from a data table, wherein the data table stores tabular data of a plurality of objects; as well as A query module is used to generate a query result through the language model based on the object description and the sub-data table.
19. Electronic equipment, including processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 17.
20. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 17.
Citation Information
Cited By
Method, device and equipment for interactive dialogue and storage medium
CN120632030A