Natural language request processing method and device, equipment, medium and program product
By identifying the task intent type and generating accurate prompts in the intelligent system, the problems of inaccurate intent recognition and insufficient contextual understanding are solved, resulting in higher user satisfaction and work efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-10
AI Technical Summary
Existing intelligent systems suffer from problems such as inaccurate intent recognition, insufficient contextual understanding, lack of standardized output, and complex user operations when processing users' natural language requests, resulting in low user satisfaction.
By receiving natural language requests from users, determining the task intent type, loading appropriate preset prompt word templates from a preset template library, generating accurate prompt words by combining key user information, and obtaining the answer using a large language model.
It improves the accuracy of answers matching user intent and the system's ability to provide personalized responses, reduces user operation steps, and enhances user satisfaction and work efficiency.
Smart Images

Figure CN121833916A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence, and in particular to a natural language request processing method and device, equipment, medium and program product. BACKGROUND
[0002] A bank or other financial institution can provide intelligent services for customers through an intelligent system. For example, a user can ask questions, query information, or make optimization suggestions in the intelligent system through natural language.
[0003] In some implementations, after extracting keywords in the natural language, an answer is retrieved from a database or knowledge base based on keyword matching or shallow natural language processing (NLP) technology, and the answer is returned to the user.
[0004] However, the above implementation has the problem that the returned answer does not match the user's real needs, reducing system credibility and user satisfaction. SUMMARY
[0005] The embodiments of the present application provide a natural language request processing method, device, equipment, medium and program product, which are used to process a natural language request into an accurate prompt word after receiving the natural language request of a user, so as to obtain a more accurate answer from a large language model (LLM) (referred to as a large model) based on the accurate prompt word, and improve user satisfaction.
[0006] In a first aspect, the embodiments of the present application provide a natural language request processing method, which comprises:
[0007] receiving a natural language request of a user;
[0008] determining a task intent type corresponding to the natural language request, the task intent type being obtained based on classification of the user's intent in a bank business scenario;
[0009] loading a corresponding preset prompt word template from a preset template library according to the task intent type, the template library being provided with a corresponding relationship between one or more task intent types and preset prompt word templates;
[0010] obtaining a prompt word according to the preset prompt word template and key information of the user, the key information of the user being related to the user's intent.
[0011] In a second aspect, the embodiments of the present application provide a natural language request processing device, which comprises:
[0012] a receiving module configured to receive a natural language request of a user;
[0013] determining a task intent type corresponding to the natural language request, the task intent type being obtained based on classification of the user's intent in a banking scenario;
[0014] loading a preset prompt word template corresponding to the task intent type from a preset template library according to the task intent type, the template library being configured with a correspondence between one or more task intent types and preset prompt word templates;
[0015] obtaining a prompt word according to the preset prompt word template and key information of the user, the key information of the user being related to the user's intent.
[0016] In a third aspect, an electronic device is provided, and the electronic device includes a memory and a processor. The memory stores computer-executable instructions. The processor executes the computer-executable instructions stored in the memory, so that the processor executes the implementation manner of the first aspect.
[0017] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the computer-executable instructions are used to implement the implementation manner of the first aspect.
[0018] In a fifth aspect, a computer program product is provided, and the computer program product includes a computer program. When the computer program is executed by a processor, the computer program implements the implementation manner of the first aspect.
[0019] The natural language request processing method, device, equipment, medium, and program product provided in the embodiments of the present application can perform intent recognition on a natural language request to obtain a task intent type corresponding to the natural language request. Based on the task intent type, a preset prompt word template that is suitable can be matched. A more accurate prompt word can be obtained by using the preset prompt word template and key information of the user, which is conducive to obtaining a more accurate answer that matches the user's intent from a large model based on the accurate prompt word, and improving the satisfaction of the user. BRIEF DESCRIPTION OF DRAWINGS
[0020] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0021] Figure 1 A flowchart of a natural language request processing method provided in the embodiments of the present application is shown.
[0022] Figure 2 A process schematic block diagram of processing a user's question based on an intelligent bank prompt word system provided in the embodiments of the present application is shown.
[0023] Figure 3A schematic diagram of the structure of the natural language request processing device provided in the embodiments of this application;
[0024] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0025] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0027] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation access points for users to choose to authorize or refuse.
[0028] Furthermore, the technical solution involved in this application, which involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.) and the use of artificial intelligence technology for automated decision-making, and makes decisions that have a significant impact on personal rights based on the results of automated decision-making, provides users with corresponding operation entry points for users to choose to agree to or reject the results of automated decision-making; if the user chooses to reject, the process will proceed to the expert decision-making process.
[0029] In this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0030] In the embodiments of this application, the use of terms such as "first" and "second" is to distinguish between identical or similar items that have essentially the same function and effect. For example, "first electronic device" and "second electronic device" are merely used to distinguish different electronic devices and do not limit their order of execution. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0031] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following associated objects have an "or" relationship.
[0032] It should be noted that the natural language request processing methods, apparatus, devices, media, and program products provided in this application can be used in the field of natural language processing technology in the financial technology field, and can also be used in any field other than the financial technology field. The application fields of the natural language request processing methods, apparatus, devices, media, and program products in this application are not limited.
[0033] The following is an explanation of some terms used in the embodiments of this application:
[0034] Large Language Models: Large language models are a natural language processing technique based on deep learning. After being trained on massive amounts of text data, they are able to understand, generate, and manipulate human language.
[0035] NLP Intent Recognition Models: Intent recognition models are a technique in natural language processing used to identify the core purpose or intent from a user's linguistic input. They can utilize deep learning models or rule-based classification methods. Deep learning models can be, for example, transformer-based deep learning models or models based on bidirectional encoder representations.
[0036] Chain of Thought (COT) technology: Chain of Thought technology is a technique that guides models to reason step by step and solve complex problems, aiming to simulate the human thinking process.
[0037] Few-shot prompting is a technique that guides a large language model to complete a task by providing a small number of examples (such as prompt words).
[0038] Large Model Prompt Engineering (LLM) is a technique that guides a large language model to output a target answer by designing and optimizing input text (such as prompts).
[0039] Automatic Prompt Engineering (APE): APE is the process of generating and optimizing prompts using automated technologies. For example, it involves the automated generation of prompts using intent recognition models or templates.
[0040] For example, in the field of intelligent services for banks and other fintech companies, intelligent systems already exist for handling customer inquiries, generating recommended answers, and supporting business processes. Existing intelligent systems for customer service and business support can rely on the following technologies:
[0041] Rule-based systems use rules and preset templates to generate responses. User-posed questions are matched against predetermined rules and templates to find the best answer. These systems are suitable for structured problems, but lack flexibility and intelligence when handling complex and variable tasks.
[0042] Existing question-answering systems provide answers based on keyword matching or simple natural language processing techniques. These systems extract keywords from databases or frequently asked questions (FAQs) and return answers, but they have weak capabilities in understanding natural language and uncovering the deeper intent of questions.
[0043] Large-model-based systems utilize pre-trained language models (such as neural network models based on encoder representations) for tasks like text generation, question answering, text classification, and language translation. These systems improve model performance in specific scenarios by pre-training on large amounts of text data and fine-tuning for specific tasks. However, they still face challenges when handling complex business scenarios, particularly regarding accuracy in specific task scenarios, standardized output, and contextual supplementation.
[0044] In other words, existing intelligent systems have at least the following problems:
[0045] Inaccurate intent recognition: Most existing intelligent systems identify user questions through rules or simple keyword matching, which cannot accurately determine the user's true intent, especially when the user's request is vague or complex, often failing to provide a suitable answer.
[0046] Insufficient contextual understanding: Existing intelligent systems often do not take into account the user's background information and historical queries, so the generated answers may not be complete or accurate enough, and they cannot provide personalized responses for different scenarios and user needs.
[0047] Lack of standardized output: Although some intelligent systems generate standardized answers, the format, content, and style of the output often vary across different task scenarios, resulting in inconsistent final answers and affecting user experience and satisfaction.
[0048] Complex user operations: In some intelligent systems, users need to manually provide a lot of background information or engage in complex interactions with the system, which increases the user's operational burden and leads to high communication costs and low efficiency.
[0049] In view of this, embodiments of this application provide a natural language request processing method. This method can perform intent recognition on natural language requests to obtain the task intent type corresponding to the natural language request. Based on the task intent type, a suitable preset prompt word template can be matched. Using the preset prompt word template and the user's key information can yield more accurate prompt words, which is beneficial for subsequently obtaining a more accurate answer matching the user's intent from a larger model based on the accurate prompt words, thereby improving user satisfaction.
[0050] The technical solutions of this application will be described in detail below with reference to specific embodiments. The specific embodiments described below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0051] The method provided in this application can be applied to applications, websites, or mini-programs with natural language request processing capabilities. The natural language request processing capability is implemented on the application, website, or mini-program. For example, a computer with a deployed natural language request processing application implements the natural language request processing capability by running the application. Another example is a terminal electronic device, such as a mobile phone, with a deployed natural language request processing mini-program, which implements the natural language request processing capability by running the mini-program.
[0052] Figure 1 This is a flowchart illustrating a natural language request processing method provided in an embodiment of this application. The executing entity of this method can be an electronic device with corresponding data storage and computing capabilities, such as a computer, server, or server cluster. Figure 1 As shown, the method includes:
[0053] S101 receives the user's natural language request.
[0054] In this embodiment of the application, a natural language request may include any natural language content input by the user.
[0055] For example, an electronic device can provide an interface or interface for receiving user input. Users can input via voice, text, images, video, etc., and the parsed text content from the user input can be used as a natural language request acquired by the electronic device. Alternatively, the parsed text content from the user input can be processed, such as by correction and key information recognition, to obtain processed text content. This processed text content can also be used as a natural language request acquired by the electronic device; this application does not limit this approach.
[0056] S102, determine the task intent type corresponding to the natural language request. The task intent type is obtained by classifying the user's intent based on the banking business scenario.
[0057] In this embodiment, the task intent type is obtained by classifying user intents based on banking business scenarios. These scenarios include, but are not limited to, one or more of the following: knowledge learning, task planning, customer service, intelligent analysis, text editing, business requirement improvement, code improvement, and general tasks. Any task intent type can correspond to one or more banking business scenarios, which will not be elaborated further.
[0058] For example, a natural language processing model can be used to identify keywords in a natural language request, obtain the user's core intent, and determine the task intent type. The input of the natural language model is the natural language request, and the output is the task intent type. The specific implementation of the natural language model is not limited.
[0059] S103, Load the corresponding preset prompt word template from the preset template library according to the task intent type. The template library has one or more correspondences between task intent types and preset prompt word templates.
[0060] In this embodiment of the application, a preset template library is provided with a correspondence between one or more task intent types and preset prompt word templates. The preset prompt word templates can be general prompt word templates that have been tested in the early stage and are applicable to the corresponding task intent types. The general prompt word templates can include key information filling parts, operation step execution parts, etc., and this embodiment of the application does not limit them.
[0061] After obtaining the task intent type, the corresponding preset prompt word template can be matched in the preset template library and loaded.
[0062] S104. Obtain prompts based on preset prompt templates and key information of the user. The key information of the user is related to the user's intent.
[0063] In this embodiment of the application, the key information of the user can be any information related to the user's intent, such as keywords in natural language requests or information in the user's historical business information, etc., so that the key information can help enrich the user's intent. This embodiment of the application does not limit this.
[0064] For example, by supplementing the user's key information into the corresponding part of the preset prompt word template, a more accurate prompt word that matches the business scenario can be obtained. Of course, the user's key information can also be supplemented into the corresponding part of the preset prompt word template, and the template can be further optimized to obtain an accurate prompt word. This application embodiment does not limit this approach.
[0065] In summary, this application provides a natural language request processing method. This method can identify the intent of a natural language request and obtain the task intent type corresponding to the natural language request. Based on the task intent type, a suitable preset prompt word template can be matched. Using the preset prompt word template and the user's key information can yield more accurate prompt words, which is beneficial for subsequently obtaining a more accurate answer matching the user's intent from a larger model based on the accurate prompt words, thereby improving user satisfaction.
[0066] exist Figure 1 Based on the illustrated embodiment, in one possible implementation, obtaining prompt words according to a preset prompt word template and key information includes: obtaining the user's historical business records; combining information from the natural language request and information on the task intent type matching the historical business records to obtain key information; supplementing the key information into the preset prompt word template to obtain a prompt word template; and generating prompt words according to the prompt word template.
[0067] In this embodiment of the application, the user's historical business records may refer to the historical business records of a period of time before the natural language request is received. For example, the user's historical business records can be obtained by querying the user's account information.
[0068] Furthermore, information related to the task intent type can be retrieved from historical business records to refine the context surrounding that task intent type. By combining key content from the natural language request with the relevant context from historical business records, and adding it to the preset prompt template, a prompt template that meets the current business requirements can be obtained, thus helping to arrive at appropriate prompts.
[0069] Optionally, the priority of contextual supplementation can be dynamically adjusted based on the task intent type. For example, in customer service scenarios, user identity information is prioritized, while in code improvement scenarios, code structure is prioritized. In the "account query" task, the system prioritizes retrieving the user's transaction records for the past three months. This enhanced targeting through contextual supplementation improves the personalization of the answers.
[0070] Furthermore, prompt words can be generated based on the prompt word template. For example, the prompt word template can be subjected to integrity verification or standardization to obtain prompt words, or the prompt word template can be further subjected to arbitrary optimization processing to obtain prompt words. This application embodiment does not limit this.
[0071] In one possible implementation, generating prompt words based on a prompt word template includes: performing logical reasoning on the prompt word template using a chain-thinking COT algorithm and a few-shot prompting algorithm to generate prompt words.
[0072] For example, the prompt word template sets the task objective and output format. Using few-sample prompts, a small number of examples are embedded in the prompt word template to demonstrate the reasoning process from input to output. Combined with chain thinking, this guides the model to break down the problem step by step.
[0073] For example, one can first analyze the requirements, then invoke relevant knowledge, and finally generate the result. By constraining the reasoning logic with prompt word templates and providing examples as references, the model can gradually deduce and generate prompt words that meet the requirements. Based on this, a balance can be struck between template-based structuring and model reasoning flexibility, thereby improving the quality of the generated results.
[0074] In one possible implementation, determining the task intent type corresponding to a natural language request includes: parsing the natural language request using a natural language processing model to generate a semantic feature vector; and classifying the semantic feature vector using a pre-defined knowledge graph to obtain the task intent type.
[0075] For example, semantic features of natural language requests can be parsed using models based on bidirectional encoder representations or natural language processing models based on transformer architectures, generating semantic feature vectors. Semantic feature vectors can be understood as abstract representations of the natural language requests after understanding them, and can be represented using high-dimensional vectors.
[0076] A knowledge graph can be understood as a structured carrier of semantic knowledge. A knowledge graph can include multiple triples, each containing "first entity - relation - second entity". The first and second entities can be different things, and the relation represents the relationship between them. A knowledge system, i.e., a knowledge graph, can be constructed using multiple triples. A pre-defined knowledge graph can be based on a specific business domain, such as an internal knowledge graph for a bank.
[0077] An internal bank knowledge graph can be constructed based on the bank's internal business rules, products, services, and policy terms. After generating semantic feature vectors, combining them with the internal knowledge graph allows for intent classification. For example, by comparing and matching semantic feature vectors with triples, and classifying the semantic feature vector into the category to which the corresponding triple belongs, the task intent type can be obtained.
[0078] Based on this, by combining semantic analysis with knowledge graphs, the accuracy of intent recognition can be improved, and intent classification across task scenarios (such as customer service or code improvement) can be supported, reducing misjudgment of task types.
[0079] In one possible implementation, the knowledge graph is shared among multiple institutions through a federated learning framework.
[0080] For example, multiple institutions could be branches or sub-branches of the same bank. A federated learning framework can be deployed across these multiple bank branches. For instance, the federated learning framework can be implemented using the respective server architectures of these multiple bank branches, allowing them to share a knowledge graph.
[0081] For example, Bank A and Bank B are two branches under the same head office. Bank A's customer service templates can be used by Bank B, but user data remains local. Bank B's knowledge graph resources can also be used by Bank A, again without leaving local user data. This allows for the sharing of prompt templates and contextual supplementation rules, while protecting user privacy.
[0082] Based on this, knowledge graphs can be shared among multiple institutions through a federated learning framework, which expands the coverage of the template library and improves its adaptability to various scenarios and tasks.
[0083] In one possible implementation, the method further includes: inputting the prompt word into a large language model to obtain the answer corresponding to the prompt word.
[0084] For example, a large language model can be any artificial intelligence model used to process natural language. For instance, it can be a pre-trained general-purpose large language model; it can be a large language model fine-tuned for business scenarios by adapting an existing large language model; or it can be a large language model obtained by training the model on a dataset of business corpora after building the model architecture, etc.
[0085] After the prompt word is input into the large language model, it can perform word segmentation to divide the prompt word into several small text blocks, each corresponding to a token. By encoding each text block, word embedding can be performed to capture the semantic relationships and contextual information of the words in the prompt word. The large language model then performs semantic prediction, semantic probability distribution calculation, and semantic selection on the information after word embedding to obtain the answer corresponding to the prompt word.
[0086] Based on this, since the prompt words are highly accurate, by inputting the highly accurate prompt words into a large language model, a more accurate answer can be returned to the user. This answer is more in line with the user's question, thereby improving user satisfaction.
[0087] In one possible implementation, the method further includes: dynamically adjusting the keywords and logical steps in the preset prompt template based on user feedback ratings of the generated answers.
[0088] For example, user feedback ratings for generated answers can be obtained in several ways. For instance, multiple preset score buttons can be set up for rating the answers. Users can choose one of these preset score buttons based on how useful the answer is to the question, thus obtaining feedback ratings. These preset score buttons could be, for example, five buttons ranging from 1 to 5 points, or three buttons representing useful, average, and useless. Alternatively, an input box can be set up, allowing users to manually enter their feedback rating based on the usefulness of the answer to the question.
[0089] After receiving user feedback ratings for the generated answers, the keywords and logical steps in the preset prompt template can be dynamically adjusted. For example, analysis can be conducted based on lower feedback ratings to pinpoint problems in the prompt template. This includes analyzing whether keywords are missing, whether there are semantic deviations in keywords, whether there is redundancy in prompts, whether there are logical jumps or incoherences, and whether there is logical confusion.
[0090] By dynamically adjusting the keywords and logical steps in the preset prompt template to address identified problems after analysis, the quality of the prompts can be optimized. This allows the prompt quality to be dynamically improved based on user feedback, thereby enhancing the usability of the answers.
[0091] Figure 2 This is a schematic block diagram illustrating the process of processing user queries using an intelligent banking prompt word system provided in this embodiment of the application. The following is in conjunction with... Figure 2 The methods provided in the embodiments of this application will be further described.
[0092] like Figure 2As shown, the intelligent banking prompt system can receive user questions (also known as user input or user natural language requests). The content of the user question can be a natural language question submitted by the user through the system interface. Natural language questions can relate to banking business scenarios such as customer service, knowledge retrieval, document polishing, code improvement, and intelligent analysis; this embodiment does not limit these specific scenarios.
[0093] After receiving a user's question, the intelligent banking prompt system can proceed to the Automatic Prompt Engineering (APE) stage. APE includes, for example, NLP intent recognition, adaptation of universal prompts for multi-task scenarios, supplementation of key information, and prompt generation.
[0094] NLP intent recognition can determine the core intent and task type of a user's question, laying the foundation for subsequent prompt word generation. For example, the system uses natural language intent recognition technology to perform semantic analysis and intent classification on user questions. Semantic analysis is used to extract keywords and semantic features from user questions. Intent classification is used to categorize user intents based on banking business scenarios (such as "customer service questions" or "knowledge learning tasks"), obtaining the task intent type. Furthermore, the accuracy of intent classification can be improved by incorporating the bank's internal knowledge graph and rule base.
[0095] The multi-task scenario universal prompt word adaptation can select the corresponding task scenario template based on the identified task intent type. Task scenarios include, for example, one or more of the following: knowledge learning, task planning, customer service, intelligent analysis, text writing and polishing, business requirement improvement, code improvement, and general tasks.
[0096] Task scenario templates can be pre-designed and stored in a template library. If the template library includes a task scenario knowledge base, then the multi-task scenario universal prompt word adaptation can call the task scenario knowledge base built into the large model, match the user's question to the specific scenario, and load the initial prompt word template (also known as the preset prompt word template) according to the task scenario.
[0097] Key information supplementation, also known as contextual information supplementation, is used to add key information related to the user's question to the initial prompt template, enhancing the generation effect. For example, by using key identifiers in the user input (such as customer name, business type), the user's historical business records can be retrieved. Combined with the task scenario, appropriate contextual information can be determined from the historical business records. Contextual information includes, for example, the last transaction amount, service history, bank policies, and process specifications.
[0098] Furthermore, the contextual information can be optimized, such as by organizing key information to form concise, structured contextual content. This contextual information is then added to the initial prompt template to obtain the prompt template. This automatically supplements the user's key information, reducing the complexity of user background information input and improving the convenience of operation and user satisfaction.
[0099] During prompt word generation, thought chain reasoning (COT) and few-shot prompts can be used to logically deduce the content of the prompt word template, generating high-quality prompt words. For example, the complex task of generating standardized prompt words from a prompt word template can be broken down into multiple steps, with each step reasoned out separately. Few-shot prompting techniques can then be used to enhance the accuracy and completeness of the generated prompt words. In this way, the system can accurately identify user needs and generate prompt words that meet task requirements, ensuring that subsequent prompt word input into a large language model results in more accurate and consistent output.
[0100] Furthermore, the generated prompts can be optimized into a standardized format. This allows the system to generate consistent, standardized prompts across different task scenarios, improving the professionalism and consistency of the responses.
[0101] Using standardized prompts to invoke a large language model (LLM) can generate high-quality answers or responses. The generated answer is then returned to the user, completing the task loop. For example, the system can pass standardized prompts to an LLM. The LLM combines the prompts with the context to generate an answer for the target task. The generated answer can then be returned to the user.
[0102] Because the system can automatically generate accurate prompts by combining the user's natural language, it reduces the number of user steps and shortens the task completion time by about 30%-40%, greatly improving work efficiency.
[0103] Optionally, feedback optimization can also be configured. For example, the system can collect user satisfaction data on the answers, and continuously adjust the generation logic based on user feedback to improve the accuracy and intelligence of task processing.
[0104] It is understood that the Large Language Model (LLM) and Natural Language Intent Recognition (NLP Intent Recognition) modules can be replaced with other Large Language Model (LLM) and Natural Language Intent Recognition (NLP Intent Recognition) algorithms, and this application embodiment does not limit this.
[0105] The natural language request processing method of this application embodiment will be illustrated below with a specific example.
[0106] Step 1: Intent recognition.
[0107] For example, intent recognition models can be used to identify a user's core intent in order to determine the type of task, such as knowledge learning, customer service, code improvement, etc.
[0108] The prompt words for this intent recognition model can be, for example:
[0109] Your task is to analyze user input to identify the user's core intent and task type. The user's task may fall into one of the following categories:
[0110] Knowledge learning (users want to acquire knowledge on a specific topic).
[0111] Customer service (users want help with customer support).
[0112] Article polishing (users request optimization of text content).
[0113] Business requirement improvement (users want to make suggestions for improvement to banking business processes or functions).
[0114] Code improvements (users want the code optimized or fixed).
[0115] Image generation (users wish to create or obtain image descriptions).
[0116] Please carefully analyze the user's input, determine the task type, and output the following structure:
[0117] **Intent Type**: {Explicit Task Type};
[0118] **Specific Requirements**: {Briefly describe the user's problem or requirement};
[0119] **Task Objective**: {The final result the user hopes to achieve};
[0120] For example, the user input might be: "I wrote a loop structure in Python for my development project, but it runs a bit slowly. How can I improve it?"
[0121] The intent recognition model can output:
[0122] Intent type: Code improvement.
[0123] Specific requirement: Optimize the performance of Python code.
[0124] Task objective: Obtain optimization suggestions to improve code execution speed.
[0125] Step 2: Extracting key information.
[0126] After identifying the intent type, it is necessary to further extract the key information required to complete the task, such as the user's experience level and relevant background information. For example, key information extraction models can be used to extract key information.
[0127] The prompt words for the key information extraction model can be set as follows:
[0128] Based on the user's intent type and specific needs, as well as the content of previous interactions, extract key information from the user input and supplement the contextual information needed to complete the task. Please try to identify the following:
[0129] 1. **User's existing knowledge**: The user's level of experience in this field (e.g., beginner, intermediate, etc.).
[0130] 2. **Relevant background information:** such as the projects involved, the tools or frameworks used, etc.
[0131] 3. **History or Additional Notes** (if any): Solutions previously tried by the user or specific problems encountered.
[0132] Please output the extraction results in the following structure:
[0133] **Existing Knowledge**: {Describes the user's level of experience or knowledge base};
[0134] **Relevant Background Information**: {Background information related to the task};
[0135] **Additional Notes:** {Any known attempts and history};
[0136] Corresponding to the user input above, the key information extraction model can output:
[0137] Existing knowledge: Intermediate Python development experience.
[0138] Background information: The use of loop structures in the project may lead to performance bottlenecks.
[0139] Additional note: Users have tried running the code but found it to be slow.
[0140] Step 3: Prompt word generation.
[0141] For example, the prompt word generation model can use the results of intent recognition and key information extraction to generate final prompt words that are suitable for large models to understand, ensuring that the model can generate high-quality answers according to user needs.
[0142] The prompt words for the prompt word generation model can be set as follows:
[0143] You are currently playing the role of a **{role}**. Your task is to help the user complete the **{task objective}**. Please generate a concise and professional answer based on the following information.
[0144] Please refer to the following content to generate output:
[0145] 1. **User Basic Information**: {Name, Job Title, etc., if applicable};
[0146] 2. **Intent Type**: {Task type, such as code improvement, knowledge learning, etc.};
[0147] 3. **Specific Requirements**: {The user's specific problems or needs};
[0148] 4. **Existing Knowledge**: {User's experience level or basic knowledge};
[0149] 5. **Relevant Background Information**: {Task-related background, such as project requirements and frameworks used};
[0150] 6. **Supplementary Notes:** {User's attempt log or encountered problems};
[0151] **Output format requirements:**
[0152] The response should directly address the user's needs.
[0153] Use concise and clear language, and avoid lengthy technical terms.
[0154] If operational steps are involved, please list them out step by step.
[0155] The final prompt words generated in the example can be:
[0156] Your current role is a **code optimization assistant**. Your task is to help users optimize the performance of their Python code.
[0157] User's task requirements:
[0158] 1. **Intent Types**: Code improvements;
[0159] 2. **Specific requirement:** Optimize loop structures in Python code to improve execution speed;
[0160] 3. **Previous Knowledge:** Intermediate Python development experience;
[0161] 4. **Relevant Background Information:** The project uses a loop structure, which may lead to a performance bottleneck.
[0162] 5. **Additional Notes:** Users attempted to run the code but found it to be slow.
[0163] Based on this information, please provide code optimization suggestions, ensuring that the suggestions conform to Python best practices and that the optimized code structure contributes to improved performance. If steps are involved, please list them out step by step.
[0164] In this way, by calling the large model based on accurate prompts, the large model can generate accurate answers.
[0165] Figure 3 This is a schematic diagram of the structure of the natural language request processing device provided in the embodiments of this application, as shown below. Figure 3 As shown, this application provides a natural language request processing apparatus, which includes:
[0166] The receiving module 301 is used to receive natural language requests from users;
[0167] The determination module 302 is used to determine the task intent type corresponding to the natural language request. The task intent type is obtained by classifying the user's intent based on the banking business scenario.
[0168] The loading module 303 is used to load the corresponding preset prompt word template from the preset template library according to the task intent type. The template library has a correspondence between one or more task intent types and preset prompt word templates.
[0169] The prompt word obtaining module 304 is used to obtain prompt words based on a preset prompt word template and the user's key information, which is related to the user's intent.
[0170] In one possible implementation, the prompt word obtaining module 304 is specifically used for: obtaining the user's historical business records; combining the information of the natural language request and the information of the task intent type in the historical business records to obtain key information; supplementing the key information into a preset prompt word template to obtain a prompt word template; and generating prompt words based on the prompt word template.
[0171] In one possible implementation, the prompt word obtaining module 304 is further used to: perform logical reasoning on the prompt word template through the chain-thinking COT algorithm and the few-sample prompting algorithm to generate prompt words.
[0172] In one possible implementation, template 302 is determined and is specifically used for: parsing natural language requests through a natural language processing model to generate semantic feature vectors; and classifying the semantic feature vectors in conjunction with a preset knowledge graph to obtain the task intent type.
[0173] In one possible implementation, the knowledge graph is shared among multiple institutions through a federated learning framework.
[0174] In one possible implementation, the device further includes an answer-obtaining module for inputting prompt words into a large language model to obtain an answer corresponding to the prompt words.
[0175] In one possible implementation, the device further includes an adjustment module for dynamically adjusting the keywords and logical steps in a preset prompt template based on user feedback ratings of the generated answers.
[0176] The natural language request processing apparatus provided in this application embodiment can be used to execute the technical solution of the natural language request processing method in any of the above embodiments of this application. Its implementation principle and technical effect are similar, and will not be described again in this embodiment.
[0177] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 4 As shown, the electronic device of this embodiment may include: at least one processor 401; and a memory 402 communicatively connected to the at least one processor; wherein the memory 402 stores instructions that can be executed by the at least one processor 401, and the instructions are executed by the at least one processor 401 to cause the electronic device to perform the method as described in any of the above embodiments.
[0178] Optionally, the memory 402 can be either standalone or integrated with the processor 401.
[0179] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0180] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method of any of the foregoing embodiments.
[0181] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method of any of the foregoing embodiments.
[0182] In the several embodiments provided in this 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 merely illustrative. For instance, the division of modules is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0183] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.
[0184] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU) or other general-purpose processors. The processor can also be a Digital Signal Processor (DSP) or an Application Specific Integrated Circuit (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0185] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device, and may also be various media that can store program code, such as USB flash drives, portable hard drives, read-only memory (ROM), disks or optical discs.
[0186] The aforementioned storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof. Examples of storage media include Static Random-Access Memory (SRAM) or Electrically Erasable Programmable Read Only Memory (EEPROM).
[0187] Storage media can be, for example, erasable programmable read-only memory (EPROM) or programmable read-only memory (PROM). Storage media can also be read-only memory (ROM), magnetic storage, flash memory, magnetic disks, or optical disks. Storage media can be any available medium accessible to general-purpose or special-purpose computers.
[0188] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. The processor and storage medium can reside within an application-specific integrated circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components within an electronic device or host device.
[0189] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0190] The sequence numbers of the embodiments in this application are merely for description and do not represent the superiority or inferiority of the embodiments. Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0191] Based on this understanding, the technical solution of this application, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0192] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
[0193] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0194] It should be further noted that although the steps in the flowchart are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise explicitly stated in this document, there is no strict order requirement for the execution of these steps, and they can be executed in other orders.
[0195] Furthermore, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0196] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0197] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0198] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A natural language request processing method, characterized in that, The method includes: Receive natural language requests from users; Determine the task intent type corresponding to the natural language request, wherein the task intent type is obtained by classifying the user's intent based on the banking business scenario; According to the task intent type, the corresponding preset prompt word template is loaded from the preset template library. The template library has one or more correspondences between task intent types and preset prompt word templates. The prompt word is obtained based on the preset prompt word template and the user's key information, where the user's key information is related to the user's intent.
2. The method according to claim 1, characterized in that, The step of obtaining prompt words based on the preset prompt word template and the key information includes: Obtain the user's historical transaction records; The key information is obtained by combining the information from the natural language request and the information on the task intent type that is adapted in the historical business records; The key information is added to the preset prompt word template to obtain the prompt word template; The prompt word is generated based on the prompt word template.
3. The method according to claim 2, characterized in that, Generating the prompt word based on the prompt word template includes: The prompt words are generated by logically reasoning through the prompt word template using the chain-thinking COT algorithm and the few-shot prompt algorithm.
4. The method according to any one of claims 1-3, characterized in that, Determining the task intent type corresponding to the natural language request includes: The natural language request is parsed using a natural language processing model to generate a semantic feature vector; The semantic feature vector is classified by combining a pre-defined knowledge graph to obtain the task intent type.
5. The method according to claim 4, characterized in that, The knowledge graph is shared among multiple institutions through a federated learning framework.
6. The method according to any one of claims 1-3, characterized in that, The method further includes: The prompt words are input into the large language model to obtain the answers corresponding to the prompt words.
7. The method according to claim 6, characterized in that, The method further includes: Based on user feedback ratings of the generated answers, the keywords and logical steps in the preset prompt template are dynamically adjusted.
8. A natural language request processing device, characterized in that, The device includes: The receiving module is used to receive users' natural language requests; The determination module is used to determine the task intent type corresponding to the natural language request, wherein the task intent type is obtained by classifying the user's intent based on the banking business scenario; The loading module is used to load the corresponding preset prompt word template from the preset template library according to the task intent type. The template library has one or more correspondences between task intent types and preset prompt word templates. The prompt word obtaining module is used to obtain prompt words based on the preset prompt word template and the user's key information, wherein the user's key information is related to the user's intent.
9. An electronic device, characterized in that, include: Memory and processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.
11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-7.