User question processing method and system and related products

By using the execution failure information of the machine query statement in the question-and-answer system to perform secondary input of the language model, a new prompt is generated loop to correct the machine query statement, which solves the problem of low accuracy in user problem conversion in the prior art, and improves the accuracy and credibility of the reply effect.

CN119691112APending Publication Date: 2025-03-25SANGFOR TECH INC
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411718418.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the existing question-and-answer system, the language model converts user questions into machine query statements with low accuracy, resulting in the response effect of machine query statements in actual application scenarios that cannot meet user query needs.

Method used

By taking the execution failure information of the machine query statement as the secondary input of the language model, a new prompt is generated repeatedly so that the language model can self-diagnose and correct the generated machine query statement until the preset conditions are met.

Benefits of technology

It improves the accuracy and usability of user questions converted into machine query statements, and ensures the credibility of answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691112A_ABST
    Figure CN119691112A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a user question processing method and system and a related product, and the method comprises the steps: executing a machine query statement to query the reply content of a user question in a preset database, and if the execution result of the machine query statement is failure, executing the reply content of the user question; and generating a new prompt based on the execution failure information of the machine query statement, the machine query statement and the user question, and returning to execute the step of inputting the new prompt into the trained language model until the end. The execution failure information of the machine query statement is used as the secondary input of the language model, that is, external knowledge is additionally introduced for the language model, the situation that the language model completely depends on user problems and cannot accurately understand user intentions can be avoided, and meanwhile the user experience is improved. According to the method, the language model can be prompted to diagnose the logic error of the generated machine query statement on the basis, so that the accuracy and availability of converting the user question into the machine query statement are improved, and the credibility of the answer is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of information processing technology, and in particular, to user problem handling methods, systems and related products. Background Art

[0002] In the question-and-answer system scenario, the answers to user questions are often stored in a preset database. After receiving the user questions input by the user, the question-and-answer system often needs to use a pre-trained language model to convert the user questions into machine query statements that can be understood by the computer, such as structured query language (SQL) or multidimensional query expressions (MDX), and based on the machine query statements, search the preset database for the answer corresponding to the machine query statement and return it to the user, thereby achieving the effect of automatic reply.

[0003] It can be seen that the answer results of the question-answering system depend on the ability of the language model to convert user questions into machine query statements. However, due to the performance limitations of the language model itself, it may not be able to accurately understand the user intentions implied in the user questions, and the conversion span of directly converting user questions into machine query statements is large and the accuracy is low, which results in the answer effect of machine query statements in actual application scenarios often failing to meet user query needs. Summary of the invention

[0004] The embodiments of the present application provide a user question processing method, system and related products for promoting the generation of more accurate machine query statements by user questions.

[0005] A first aspect of an embodiment of the present application provides a method for handling user problems, including:

[0006] Inputting the prompt generated based on the user question into the trained language model to prompt the language model to generate a machine query statement of the current round corresponding to the user question;

[0007] Execute the machine query statement to query the answer content of the user question in a preset database, and obtain the execution result of the machine query statement;

[0008] If the execution result of the machine query statement is failure, a prompt for the next round is generated as a new prompt based on the execution failure information of the machine query statement, the machine query statement and the user question, and the process returns to the step of inputting the new prompt into the trained language model until the preset conditions are met and the new prompt is stopped from being input into the language model.

[0009] Optionally, the execution failure information is used to indicate that there is a compilation error problem in the machine query statement;

[0010] The new prompt is input into the trained language model to prompt the language model to locate and analyze the content of the compilation error in the machine query statement, and modify the content according to the error analysis result to generate a new machine query statement.

[0011] Optionally, the execution failure information is used to indicate that the referenced field in the machine query statement does not exist in the preset database;

[0012] The new prompt is input into a trained language model to prompt the language model to search for a similar semantic field of the reference field in the preset database, or to infer the correct semantic field of the reference field based on the context of the reference field in the machine query statement; the similar semantic field or the correct semantic field is used to replace the reference field to correct the machine query statement.

[0013] Optionally, the machine query sentence finally generated in each round is comprehensively determined based on the machine query sentences respectively generated by the multiple language models.

[0014] Optionally, the generating of the next round of prompts based on the execution failure information of the machine query statement, the machine query statement and the user question includes:

[0015] Obtaining error correction information fed back by the user regarding the execution failure information;

[0016] A prompt for the next round is generated based on the error correction information, the execution failure information of the machine query statement, the machine query statement and the user question.

[0017] Optionally, the preset conditions include: the machine query statement searches for the reply content in the preset database, the machine query statement is consistent with the previous machine query statement, or the total number of times the machine query statement is generated reaches a preset number.

[0018] The method described in the first aspect of the present application can be implemented by using the content described in the second aspect of the present application during specific implementation.

[0019] A second aspect of the embodiment of the present application provides a user question processing system, including: a generating unit, a querying unit;

[0020] The generating unit is used to input the prompt language generated based on the user question into the trained language model to prompt the language model to generate a machine query sentence of the current round corresponding to the user question;

[0021] The query unit is used to execute the machine query statement to query the answer content of the user question in a preset database, and obtain the execution result of the machine query statement;

[0022] The generation unit is also used to generate a prompt for the next round as a new prompt based on the execution failure information of the machine query statement, the machine query statement and the user question if the execution result of the machine query statement is failure, and return to execute the step of inputting the new prompt into the trained language model until the preset conditions are met and stop inputting the new prompt into the language model.

[0023] A third aspect of an embodiment of the present application provides an electronic device, including: a processor and a memory;

[0024] The processor is configured to communicate with the memory and execute instructions in the memory to implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0025] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0026] A fifth aspect of an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.

[0027] It can be seen from the above technical solutions that the embodiments of the present application have at least the following advantages:

[0028] Using the execution failure information of machine query statements as the secondary input of the language model is equivalent to introducing additional external knowledge into the language model, which can prevent the language model from being completely dependent on user questions and failing to accurately understand user intentions. At the same time, it can enable the language model to self-diagnose logical errors in the machine query statements it generates based on evidence, thereby improving the accuracy and availability of converting user questions into machine query statements and ensuring the credibility of the answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0030] It should be noted that, although the steps in the process diagrams (if any) involved in the embodiments are drawn in sequence as indicated by the arrows, unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0031] Figure 1 A schematic diagram of a system architecture of a method for handling user problems according to an embodiment of the present application;

[0032] Figure 2 A flowchart of a method for handling user problems according to an embodiment of the present application;

[0033] Figure 3 Another flowchart of the method for handling user problems according to an embodiment of the present application;

[0034] Figure 4 A schematic diagram of the structure of the user problem handling system according to an embodiment of the present application;

[0035] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0037] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. 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 necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0038] In the following description, similar expressions such as "a specific implementation" or "a specific example" are involved, which describe a subset of all possible embodiments, but it can be understood that "a specific implementation" or "a specific example" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict. In the following description, the term multiple refers to at least two. In some specific examples, the numerical value mentioned in this application reaches the threshold value (if any), which may include the case where the former is greater than the latter of the threshold value; if similar expressions such as "any" or "at least one" are mentioned, it can specifically refer to any one of the listed examples or any combination of these examples.

[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0040] The method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 101 through the network, and the data storage system 100 can store the data that the server 101 needs to process or needs, such as storing the preset database of the embodiment of the present application. The data storage system 100 can be integrated on the server 101, or it can be placed on the cloud or other network servers. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The server 101 can be implemented as an independent server or a server cluster consisting of multiple servers.

[0041] The terminal 102 can obtain the user question input by the user and send the user question to the server 101. The server 101 can input the prompt generated based on the user question into the trained language model to prompt the language model to generate the machine query statement of the current round corresponding to the user question; thereafter, the server 101 executes the machine query statement to query the answer content of the user question in the preset database, and obtains the execution result of the machine query statement; if the execution result of the machine query statement is failure, the server 101 can generate the prompt of the next round as a new prompt based on the execution failure information of the machine query statement, the machine query statement and the user question, and return to the step of inputting the new prompt into the trained language model until the preset condition is met and the new prompt is stopped from being input into the language model. If the execution result of the machine query statement is successful, the server 101 can return the queried answer content to the terminal 102.

[0042] It should be noted that the method provided in the embodiment of the present application can be implemented jointly by the terminal device and the server as described above, or it can be implemented entirely on the server side, or it can be implemented entirely on the terminal device side. The specific method can be determined according to the actual application scenario and is not limited here.

[0043] The method of the present application will be described in further detail below.

[0044] See also Figure 2 In a first aspect, the present application provides a specific embodiment of a method for handling user problems, the embodiment comprising the following steps:

[0045] Step S21: input the prompt generated based on the user question into the trained language model to prompt the language model to generate a machine query statement of the current round corresponding to the user question;

[0046] At the beginning, the user question itself can be used as a prompt, or can be a component of the prompt. This prompt is used to guide or prompt the language model to understand the user's intention and generate appropriate machine query statements based on it, such as at least one type of statement in Structured Query Language (SQL), XQuery, Hibernate Query Language (HQL, Hibernate Query Language, etc.

[0047] The user question in the embodiment of the present application can be a question sentence, a declarative sentence, a rhetorical question or other type of sentence. In other words, any sentence that the input language model instructs it to respond to can be called a user question. This user question can be called a user query sentence or a natural language sentence.

[0048] The above-mentioned trained language model (Generative Pre-Trained Transformer) or pre-trained language model is a natural language processing technology based on deep learning. It learns the universal laws and semantic representations of language through unsupervised learning on a large-scale text corpus. Pre-trained language models usually use deep neural network structures such as Transformer. Through a multi-level self-attention mechanism, the input text sequence is mapped to a vector representation in a high-dimensional semantic space, thereby achieving understanding and generation of text. In some examples, the above-mentioned language model may also be referred to as a large-scale language model (LLM, Large Language Model).

[0049] Step S22: execute the machine query statement to query the answer content of the user's question in the preset database, and obtain the execution result of the machine query statement;

[0050] For ease of explanation and understanding, the embodiments of the present application mainly use SQL statements as machine query statements for example. Specifically, the generated SQL statements can be sent to a preset database for execution to try to query the preset database for the reply content (which can be regarded as the answer) related to the user's question, and the corresponding execution result can be success or failure, where failure means that the reply content related to the user's question cannot be found in the preset database.

[0051] Step S23: If the execution result of the machine query statement is failure, generate the next round of prompts as new prompts based on the execution failure information of the machine query statement, the machine query statement and the user question, and return to the step of inputting the new prompts into the trained language model until the preset conditions are met and stop inputting the new prompts into the language model.

[0052] like Figure 3 As shown in the figure, if the execution result of the current round of SQL statements in the preset database fails, the execution failure information of the SQL statements in the preset database (which can be regarded as the reason), the machine query statement and the user question can be spliced ​​as the secondary input of the language model, and the cycle is repeated until the preset conditions are met. Among them, the execution failure information as additional knowledge of the language model can enable the language model to self-diagnose the logical errors of the SQL statements it generated last time, thereby improving the query accuracy.

[0053] Exemplarily, the prompt for the next round may be: Please regenerate the SQL statement based on the following user question input by the user, the SQL statement generated in the previous round, and the execution error information generated in the previous round.

[0054] The above-mentioned preset condition may be until the generated SQL statement can be successfully executed in the preset database, that is, the specific answer content related to the user's question is obtained.

[0055] Based on the above example descriptions, some specific possible implementation examples will be provided below. In actual applications, the implementation contents between these examples can be combined or implemented separately as needed according to the corresponding functional principles and application logic. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logics, which can be determined by the actual scenario.

[0056] Generally, when using the SQL statements generated by the LLM model to execute statements in SQL client tools or API interfaces, the following situations may occur: a. Successful execution, and obtaining specific response content and other data; b. The SQL statement is illegal and cannot be compiled and understood; c. The query is a non-existent table, etc., which does not meet the existing database structure. The following will mainly explain the above situations b and c, where the execution results are all failures.

[0057] based on Figure 2 In some specific examples, the above execution failure information can be used to indicate that there is a compilation error (i.e., illegality) in the machine query statement; accordingly, a new prompt is input into the trained language model to prompt the language model to locate and analyze the cause of the compilation error in the machine query statement, and modify the content according to the result of the error analysis to generate a new machine query statement.

[0058] For example, for a SQL statement with a compilation error: SELECT user_iduser_name FROM UsersWHERE age>30; by comparing the syntax structure of this SQL statement with the SQL standard syntax, it can be located that the content "user_iduser_name" in this SELECT clause has a syntax format error, that is, the column names are missing commas to separate them. Correspondingly, the cause of the error (i.e., the cause of the error) is analyzed to be that the column names in the SELECT clause should be separated by commas; based on this content to locate the error, the SQL statement with the compilation error can be corrected to: SELECT user_id,user_name FROM Users WHERE age>30. The error in this example is a syntax error, but in actual applications, the error type may be more complex, such as at least one of a function usage error, a data type mismatch, a logic error, etc., which can be analyzed and corrected according to the specific situation, and is not limited here.

[0059] based on Figure 2 In some specific examples, the execution failure information can be further used to indicate that the referenced field in the machine query statement does not exist in the preset database; a new prompt is input into the trained language model to prompt the language model to find a similar semantic field of the referenced field in the preset database, or to infer the correct semantic field of the referenced field based on the context of the referenced field in the machine query statement; the similar semantic field or the correct semantic field is used to replace the referenced field to correct the machine query statement.

[0060] In other words, there may be an execution failure that meets the above situation c. For example, the preset database contains multiple tables, each of which has specific constituent fields. For the SQL statement: SELECT name, birth_yr FROM people WHERE age>25; where the birth_yr field does not exist in the database, the corresponding execution failure information may be as follows: Error: Column'birth_yr'does not exist in table'people'. This execution failure information indicates that the birth_yr field does not exist in the personnel table (i.e., the people table) of the database. To this end, you can search for fields with similar meanings to birth_yr in the people table based on the database structure information, such as birth_year. Or, if you cannot find a similar field, you can try to infer the possible correct meaning field (such as year_of_birth) based on the context of the birth_yr field in the SQL statement (such as other fields, conditions of the WHERE clause, etc.), and then correct it to obtain any of the following more accurate SQL statements: "SELECT name,birth_year FROM people WHERE age>25"; or, "SELECT name,year_of_birth FROMpeople WHERE age>25", thereby improving the accuracy and success rate of the query.

[0061] It can be seen that in order to ensure the accuracy and success rate of the query, the field name, value type, etc. in the SQL statement should be consistent with the actual field name and value type in the preset database, and the syntax of the SQL statement should be compiled correctly, so as to avoid not being able to find the required response content in the preset database. Of course, it is also possible that the tables in the preset database are not complete or have not been updated in time, resulting in the failure of the SQL statement execution. In this case, you can add, delete or modify the tables in the preset database to meet the query requirements as much as possible.

[0062] In practical applications, a multi-model fusion strategy can be used to comprehensively generate SQL statements to further improve the practicality and reliability of SQL statements. Figure 2 In some specific examples, the machine query sentence finally generated in each round can be comprehensively determined based on the machine query sentences generated by multiple language models respectively.

[0063] Specifically, for the SQL statements output by multiple language models in each round, the SQL statement with the most occurrences can be selected or a more complex weighted calculation method can be used to summarize the best SQL statement as the machine query statement finally generated in each round. For example, a weight can be assigned to each model, and this weight can be determined based on the performance of the model on the training set (e.g., the better the performance, the higher the weight assigned) or other evaluation indicators. Then, the weighted score of the SQL statements output by each model is calculated, and the SQL statement with the highest weighted score can be used as the best SQL statement. The multiple language models here can be obtained using different training sets, algorithms or model structures, without limitation.

[0064] In actual applications, user feedback information can be added as an additional knowledge source to better correct SQL statements that fail to execute. Figure 2 In some specific examples, the process of "generating prompts for the next round" in the above step 23 may include: obtaining error correction information fed back by the user regarding execution failure information; and generating prompts for the next round based on the error correction information, execution failure information of the machine query statement, the machine query statement and the user's question.

[0065] As explained above, when building an interactive query system, obtaining user feedback on execution failure information can help the system better understand user needs and gradually correct errors until the correct SQL statement is generated. Suppose a user wants to query "all orders with sales exceeding 1 million in 2023" in a database, but the SQL statement generated in the previous round (SELECT*FROM orders WHEREyear='2023'AND sales>'1000000') is incorrect, resulting in execution failure. The execution failure information may be Error: Column'sales'does not exist in table'orders'. After the user sees the execution failure information, the following error correction information may be provided: it should be the sales_amount field, not sales. Accordingly, this error correction information and execution failure information can be combined as an additional knowledge source for the language model to generate the next round of prompts. This prompt can include user feedback on the error and instructions to guide the system or language model to further correct the query statement. For example, the prompt for the next round may be: In the SQL statement generated in the previous round, the `sales` field was used, but according to the structure of the preset database, this field does not exist in the `orders` order table. It is recommended to replace the field `sales` with the field `sales_amount` to generate a new machine query statement.

[0066] based on Figure 2In some specific examples, the preset conditions include: the machine query statement finds the reply content in the preset database, the machine query statement is consistent with the previous machine query statement, or the total number of times the machine query statement is generated reaches a preset number.

[0067] Specifically, without considering computing power or time constraints, if each newly generated SQL statement is inconsistent with the last generated SQL statement, you can return to the loop step 21 and other operations indefinitely until the SQL statement generated by the model is consistent with the last one; but this may also mean that additional information has not been introduced at this time, or the model cannot understand and use this part of the additional information. In a practical environment, the accuracy of the task of converting natural language to SQL statements, i.e., nl2sql (Natural Language to SQL), cannot reach 100%, and due to computing power or time constraints, you can consider looping for a preset number of times (such as 5 times) and still fail, that is, stop the loop, which may also mean that this model cannot solve the problem, and you can try to replace the model or retrain the model and other countermeasures. Of course, you can also return an empty reply content at this time.

[0068] In summary, the embodiment of the present application uses the execution failure information of the machine query statement as the secondary input of the language model, which is equivalent to introducing additional external knowledge into the language model. It can avoid the language model from relying entirely on user questions and failing to accurately understand user intentions. At the same time, it can prompt the language model to self-diagnose the logical errors of the machine query statements it generates based on evidence, thereby improving the accuracy and availability of converting user questions into machine query statements and ensuring the credibility of the answers.

[0069] Compared to Figure 2 The examples shown illustrate that the above-mentioned additional or detailed example contents or possible implementation methods do not necessarily have to be executed during the specific implementation. If more than two examples or possible implementation methods are added, these examples or possible implementation methods can be implemented in combination or separately. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logic, which can be determined according to the actual scenario.

[0070] See also Figure 4 , the second aspect of the present application provides a specific embodiment of a user question processing system, the system comprising: a generating unit 401, a querying unit 402;

[0071] The generating unit 401 is used to input the prompt generated based on the user question into the trained language model to prompt the language model to generate a machine query sentence of the current round corresponding to the user question;

[0072] The query unit 402 is used to execute a machine query statement to query the answer content of the user's question in a preset database, and obtain the execution result of the machine query statement;

[0073] The generation unit 401 is also used to generate the next round of prompts as new prompts based on the execution failure information of the machine query statement, the machine query statement and the user question if the execution result of the machine query statement is failure, and return to execute the step of inputting the new prompts into the trained language model until the preset conditions are met and stop inputting the new prompts into the language model.

[0074] In some examples, the execution failure information is used to indicate that there is a compilation error in the machine query statement;

[0075] The new prompt is input into the trained language model to prompt the language model to locate and analyze the compilation errors in the machine query statement, and modify the content according to the error analysis result to generate a new machine query statement.

[0076] In some examples, the execution failure information is used to indicate that the referenced field in the machine query statement does not exist in the preset database;

[0077] A new prompt is input into the trained language model to prompt the language model to search for similar semantic fields of the referenced field in a preset database, or to infer the correct semantic field of the referenced field based on the context of the referenced field in the machine query statement; the similar semantic field or the correct semantic field is used to replace the referenced field to correct the machine query statement.

[0078] In some examples, the machine query sentence finally generated in each round is determined based on a comprehensive combination of machine query sentences generated by multiple language models.

[0079] In some examples, the generating unit 401 is specifically used to: obtain error correction information fed back by the user regarding the execution failure information;

[0080] Generate prompts for the next round based on error correction information, execution failure information of machine query statements, machine query statements and user questions.

[0081] In some examples, the preset conditions include: the machine query statement searches for answer content in a preset database, the machine query statement is consistent with the previous machine query statement, or the total number of times the machine query statement is generated reaches a preset number.

[0082] In the embodiment of the present application, the operations performed by each unit of the user problem handling system are similar to the operations described in the first aspect or any specific method embodiment of the first aspect, and will not be described in detail here. Of course, the specific implementation process of each operation in the first aspect of the present application can also refer to the relevant description of the second aspect.

[0083] See also Figure 5 The electronic device 500 of the embodiment of the present application may include one or more processors (such as central processing units (CPU)) 501 and a memory 505, in which one or more applications or data are stored.

[0084] The memory 505 may be a volatile storage or a persistent storage. The program stored in the memory 505 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Furthermore, the processor 501 may be configured to communicate with the memory 505 and execute a series of instruction operations in the memory 505 on the electronic device 500.

[0085] The electronic device 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0086] The processor 501 can execute the operations performed by the aforementioned first aspect or any specific method embodiment of the first aspect, and the details will not be repeated here.

[0087] The present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect or any specific implementation of the first aspect.

[0088] The present application provides a computer program product comprising instructions or a computer program. When the computer program product is run on a computer, the computer is enabled to execute the method described in the first aspect or any specific implementation of the first aspect.

[0089] It is understood that in various embodiments of the present application, the sequence number of each step does not mean the order of execution, and the execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The operation content added or refined in each example scheme of the above method, system or device (if any) does not necessarily have to be executed in the specific implementation. If more than two operations are added, these operations can be implemented in combination or separately, depending on the actual scenario.

[0090] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system (if any) and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0091] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system or device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0092] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0093] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0094] If the integrated unit 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 this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product (or computer program product) is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a business server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. A method for handling user problems, characterized in that: include: Inputting the prompt generated based on the user question into the trained language model to prompt the language model to generate a machine query statement of the current round corresponding to the user question; Execute the machine query statement to query the answer content of the user question in a preset database, and obtain the execution result of the machine query statement; If the execution result of the machine query statement is failure, a prompt for the next round is generated as a new prompt based on the execution failure information of the machine query statement, the machine query statement and the user question, and the process returns to the step of inputting the new prompt into the trained language model until the preset conditions are met and the new prompt is stopped from being input into the language model.

2. The method for handling user problems according to claim 1, characterized in that: The execution failure information is used to indicate that there is a compilation error in the machine query statement; The new prompt is input into the trained language model to prompt the language model to locate and analyze the content of the compilation error in the machine query statement, and modify the content according to the error analysis result to generate a new machine query statement.

3. The user problem handling method according to claim 1, characterized in that: The execution failure information is used to indicate that the referenced field in the machine query statement does not exist in the preset database; The new prompt is input into a trained language model to prompt the language model to search for a similar semantic field of the reference field in the preset database, or to infer the correct semantic field of the reference field based on the context of the reference field in the machine query statement; the similar semantic field or the correct semantic field is used to replace the reference field to correct the machine query statement to obtain a new machine query statement.

4. The method for handling user problems according to claim 1, characterized in that: The machine query sentence finally generated in each round is comprehensively determined based on the machine query sentences respectively generated by the multiple language models.

5. The method for handling user problems according to any one of claims 1 to 4, characterized in that: The generating of the next round of prompts based on the execution failure information of the machine query statement, the machine query statement and the user question includes: Obtaining error correction information fed back by the user regarding the execution failure information; A prompt for the next round is generated based on the error correction information, the execution failure information of the machine query statement, the machine query statement and the user question.

6. The method for handling user problems according to any one of claims 1 to 4, characterized in that: The preset conditions include: the machine query statement searches for the reply content in the preset database, the machine query statement is consistent with the previous machine query statement, or the total number of times the machine query statement is generated reaches a preset number.

7. A user problem handling system, characterized in that: include: generating unit, querying unit; The generating unit is used to input the prompt language generated based on the user question into the trained language model to prompt the language model to generate a machine query sentence of the current round corresponding to the user question; The query unit is used to execute the machine query statement to query the answer content of the user question in a preset database, and obtain the execution result of the machine query statement; The generation unit is also used to generate a prompt for the next round as a new prompt based on the execution failure information of the machine query statement, the machine query statement and the user question if the execution result of the machine query statement is failure, and return to execute the step of inputting the new prompt into the trained language model until the preset conditions are met and stop inputting the new prompt into the language model.

8. An electronic device, characterized in that: include: Processor and memory; The processor is configured to communicate with the memory and execute instructions in the memory to implement the method according to any one of claims 1 to 6.

9. A readable storage medium, characterized in that: The readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Query method and device based on large language model, equipment and medium

    CN120821736A

  • A query method, device and equipment based on a large language model and a medium

    CN120821736B