Task execution method and device, storage medium and computer program product
By disassembling and analyzing the tasks of the agent with the pre-trained task planning model, the task execution accuracy problem caused by the agent's lack of professional knowledge and planning experience is solved, and a higher level of Task execution accuracy and robustness.
Patent Information
- Application Number
- CN202411579183.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
AI Technical Summary
Due to the lack of professional knowledge and planning experience, the agent is unable to plan a complete and accurate task process, resulting in poor accuracy of task execution results.
By obtaining the description text of the task to be executed, using the pre-trained task planning model for analysis, dividing the task into multiple subtasks, and generating task planning prompt words for each subtask, including calling tools and input parameters. For professional nouns, determine their noun interpretation and splice them into the task planning prompt word to improve the accuracy of task execution.
It effectively improves the agent's professional knowledge understanding ability and task planning accuracy, improves the robustness of task execution, and ensures the accuracy of task execution results.
Smart Images

Figure CN119514687A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a task execution method and device, a storage medium, and a computer program product. Background Art
[0002] With the development of big model technology, a series of applications based on big models have emerged. Among them, the intelligent agent, as a computing entity with autonomous decision-making ability, can achieve specific goals or tasks by retrieving memory, autonomous reasoning and planning, perceiving the environment and executing tool behaviors. Therefore, the intelligent agent has also become one of the core applications of big model technology.
[0003] In actual applications, the agent usually takes the user input as the overall execution goal. The specific process of achieving this overall goal is as follows: First, the agent dynamically splices the agent's tool list, the function description of each tool in the tool list, the input parameter description, and the output parameter description into the task planning prompt, and inputs this task planning prompt into the general model to obtain several subtasks that need to be performed to complete the overall goal or task; then, execute each subtask in steps, where each subtask contains the tool to be called, the tool input parameters, and the sub-goal of this step. However, the agent still has the following problems in the above application process:
[0004] (1) The general large model does not have professional domain knowledge and planning experience. As a result, when faced with a given goal, the intelligent agent based on the general large model cannot provide a complete, accurate and executable task execution process like a domain expert.
[0005] (2) The general large model has few professional terms in the training corpus during the training phase, and is not able to understand professional terms in the execution process of the intelligent agent. No effective solution has been proposed so far to address the above problems. Summary of the invention
[0006] The embodiments of the present application provide a task execution method and device, a storage medium, and a computer program product to at least solve the technical problem that the intelligent agent is unable to plan a complete and accurate task process due to its lack of professional knowledge and planning experience, resulting in poor accuracy of task execution results.
[0007] According to one aspect of an embodiment of the present application, a task execution method is provided, comprising: obtaining a description text of a first task to be executed; analyzing the description text of the first task using a pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes a plurality of first subtasks obtained by dividing the first task and a task planning prompt word corresponding to each first subtask, and the task planning prompt word includes at least: a calling tool and input parameters of the calling tool when executing the first subtask; for each first subtask, determining a first entity noun of at least one profession in the first subtask, and determining a noun explanation corresponding to the first entity noun of each profession; splicing the first entity noun of each profession and the corresponding noun explanation to the task planning prompt word corresponding to the first subtask, and executing the first subtask according to the spliced task planning prompt word to obtain a corresponding execution result.
[0008] Optionally, the training process of the task planning model includes: obtaining a training sample set and a sample label set, wherein the training sample set includes a plurality of description texts of historical tasks as training samples, and the sample label set includes a task planning strategy corresponding to each historical task as a sample label; constructing an initial learning model including at least a feature extraction module, a similarity calculation module, a sample screening module and a task planning module; and iteratively training the initial learning model using the training sample set and the sample label set to obtain a task planning model.
[0009] Optionally, the feature extraction module includes at least a word embedding layer and a pooling layer, wherein the word embedding layer is used to convert each word in the description text of the task into a word vector, and the pooling layer is used to integrate each word vector into a corresponding task vector; the similarity calculation module includes at least a distance network, wherein the distance network is used to calculate the vector similarity between the task vectors of any two tasks; a sample screening module, used to select target training samples whose vector similarity is higher than a preset similarity threshold from multiple groups of training samples; and a task planning module, used to integrate sample labels corresponding to the target training samples.
[0010] Optionally, the initial learning model is iteratively trained using a training sample set and a sample label set to obtain a task planning model, including: for each training batch in the iterative training process, each training sample of the training batch is input into the initial learning model to obtain each task planning strategy output by the initial learning model, a target loss function is constructed using the task planning strategy and the corresponding sample labels, and the model parameters of the initial learning model are adjusted according to the target loss function.
[0011] Optionally, the first task is analyzed using a pre-trained task planning model to obtain a corresponding first task planning strategy, including: using a feature extraction module to extract features from the description text of the first task and the description text of historical tasks in multiple groups of training samples to obtain a corresponding first task vector and multiple historical task vectors; using a similarity calculation module to calculate the vector similarity between the first task vector and each historical task vector; using a sample screening module to select target training samples whose vector similarity is higher than a preset similarity threshold from multiple groups of training samples; using a task planning module to integrate sample labels corresponding to the target training samples to obtain a first task planning strategy corresponding to the first task.
[0012] Optionally, determine the first entity noun of at least one profession in the first subtask, and determine the corresponding term explanations of the first entity noun of each profession, including: extracting multiple first entity nouns in the first subtask; for each first entity noun, determine whether the first entity noun is included in a preset professional term library, wherein the professional term library includes: multiple entity nouns of different professions in different fields and the corresponding term explanations of the entity nouns of each profession; if included, determine that the first entity noun is professional, and determine the corresponding term explanations of the first entity noun of the profession; if not included, determine that the first entity noun is unprofessional.
[0013] Optionally, before splicing the first entity nouns of each profession and the corresponding noun explanations to the task planning prompt words corresponding to the first subtask, the method also includes: for each input parameter of the calling tool called when executing the first subtask, looping the following steps until a preset number of loops is reached or the verification result of the input parameter is passed: verifying the input parameters using preset verification rules; if the verification result of the input parameter is failed verification, determining the failure reason for the input parameter failing the verification, and regenerating the input parameters based on the verification rules and the failure reason.
[0014] According to another aspect of an embodiment of the present application, a task execution device is also provided, including: an acquisition module, used to acquire a description text of a first task to be executed; a determination module, used to analyze the description text of the first task using a pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes multiple first subtasks obtained by dividing the first task and task planning prompts corresponding to each first subtask, and the task planning prompts include at least: a calling tool and input parameters of the calling tool when executing the first subtask; an execution module, used to determine, for each first subtask, a first entity noun of at least one profession in the first subtask, and determine the corresponding noun explanations of the first entity nouns of each profession; splice the first entity nouns of each profession and the corresponding noun explanations to the task planning prompts corresponding to the first subtask, and execute the first subtask according to the spliced task planning prompts to obtain the corresponding execution results.
[0015] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned task execution method by running the computer program.
[0016] According to another aspect of an embodiment of the present application, a computer program product is further provided. The computer program product includes a stored computer program, wherein the computer program implements the above-mentioned task execution method when executed by a processor.
[0017] In an embodiment of the present application, the intelligent agent uses the task planning model to intelligently disassemble and analyze the description text of the first task, and obtains a reasonable and accurate first task planning strategy (i.e., the multiple first subtasks obtained by dividing the first task and the task planning prompt words corresponding to each first subtask) to reduce the errors in the execution of subsequent tasks; then, for each first subtask, the professional first entity noun and the corresponding noun explanation within the first subtask are determined, and the first entity nouns of each profession and their corresponding noun explanations are spliced with the task planning prompt words of the first subtask, and the first subtask is executed according to the task planning prompt words to obtain accurate execution results. During the entire task execution process, the intelligent agent's professional knowledge understanding ability and task planning accuracy can be effectively improved, and the purpose of improving the robustness of task execution can be achieved, thereby solving the technical problem that the intelligent agent cannot plan a complete and accurate task process due to its lack of professional knowledge and planning experience, resulting in poor accuracy of task execution results. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 It is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a task execution method according to an embodiment of the present application;
[0020] Figure 2 is a flowchart of an optional task execution method according to an embodiment of the present application;
[0021] Figure 3 is a schematic structural diagram of an optional task execution device according to an embodiment of the present application;
[0022] Figure 4 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings 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 of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] In addition, the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0026] Example 1
[0027] According to an embodiment of the present application, a method embodiment of a task execution method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0028] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a task execution method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0029] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0030] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the task execution method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the task execution method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0033] In the above operating environment, Figure 2 is a flowchart of an optional task execution method according to an embodiment of the present application, such as Figure 2 As shown, the method at least includes steps S202-S206, wherein:
[0034] Step S202: Obtain a description text of a first task to be executed.
[0035] The description text of the first task can be understood as a specific question or demand in text form submitted by the user to the agent through the human-computer interaction module. This demand can be a query, an operation instruction, or a problem to be solved. For example, "query the number of user logins in the past seven days, and obtain the user role information with the least number of logins" can be the description text of a task to be processed by the agent.
[0036] Step S204: Analyze the description text of the first task using the pre-trained task planning model to obtain the corresponding first task planning strategy.
[0037] Generally, when an agent receives a task, it understands the task based on historical experience to clarify the requirements of the task, thereby determining the list of tools required to perform the task, the functional description of each tool in the list, and the input parameter description. However, this task division method may not be able to accurately decompose complex problems. Therefore, in order to improve the accuracy of the agent's task planning and disassembly, the embodiment of the present application proposes to analyze the description text of the first task through a task planning model to obtain the corresponding first task planning strategy, wherein the first task planning strategy includes multiple first subtasks obtained by dividing the first task and the task planning prompt words corresponding to each first subtask, and the task planning prompt words at least include: the calling tool when executing the first subtask (referring to a software module or application programming interface API that can complete a specific function) and the input parameters of the calling tool (referring to a series of information that needs to be provided to the tool when calling the tool).
[0038] As an optional implementation, the training process of the above task planning model includes:
[0039] Step S1, obtaining a training sample set and a sample label set.
[0040] The training sample set includes a plurality of description texts of historical tasks as training samples; and the sample label set includes a task planning strategy corresponding to each historical task as a sample label.
[0041] Specifically, for the manual content corresponding to each historical task, the preset document title enhancer can be used to parse the manual file name and manual title, and the manual content can be automatically divided into text blocks corresponding to several historical subtasks through the adaptive segmenter. For each historical subtask, the corresponding calling tool and input parameters of the calling tool can be set according to expert experience or historical experience.
[0042] Step S2, constructing an initial learning model that at least includes a feature extraction module, a similarity calculation module, a sample screening module and a task planning module.
[0043] Among them, the specific structure and function of each module in the initial learning model are as follows:
[0044] The feature extraction module at least includes a word embedding layer and a pooling layer, wherein the word embedding layer is used to convert each word in the task description text into a word vector, and the pooling layer is used to integrate each word vector into a corresponding task vector;
[0045] The similarity calculation module at least includes a distance network, wherein the distance network is used to calculate the vector similarity between the task vectors of any two tasks;
[0046] The sample screening module is used to select target training samples whose vector similarity is higher than a preset similarity threshold from multiple groups of training samples;
[0047] The task planning module is used to integrate the sample labels corresponding to the target training samples, where the integration can be understood as screening and reorganizing the sample labels corresponding to the target training samples.
[0048] Step S3, iteratively train the initial learning model using the training sample set and the sample label set to obtain a task planning model.
[0049] Optionally, the above step S3 can be implemented by the following steps: for each training batch in the iterative training process, each training sample of the training batch is input into the initial learning model to obtain each task planning strategy output by the initial learning model, and the target loss function is constructed using the task planning strategy and the corresponding sample labels, and the model parameters of the initial learning model are adjusted according to the target loss function.
[0050] It should be noted that the task planning model can be loaded into the memory, for example, the raw data of the task planning model can be loaded from the non-volatile memory into the volatile memory, so that the processor runs the task planning model. The raw data of the task planning model refers to unprocessed data, usually including parameters and structural data of the task planning model. The structural data can be a calculation relationship based on the parameters, such as the forward propagation calculation relationship between the intermediate layers and the neurons. Specifically, the structural data can include code related to the structure of the task planning model, such as code for executing related calculations between the intermediate layers and the neurons.
[0051] In one embodiment, an area for loading the task planning model can be divided in the memory, which can include a structure data storage area and a parameter storage area. The structure data storage area is used to store structure-related codes, and the parameters referenced by it can point to the address of a specific parameter in the parameter storage area through a pointer. During the training process of the task planning model, it may be necessary to frequently update the parameters, and the parameter values in the parameter storage area can be updated.
[0052] As an optional implementation, in the technical solution provided in the above step S204, the agent can use the above trained task planning model to analyze the first task according to the following process to obtain the corresponding first task planning strategy, including:
[0053] Step S2041, using a feature extraction module to perform feature extraction on the description text of the first task and the description texts of the historical tasks in the multiple groups of training samples, to obtain a corresponding first task vector and multiple historical task vectors;
[0054] Step S2042, using a similarity calculation module to calculate the vector similarity between the first task vector and each historical task vector;
[0055] Step S2043, using a sample screening module to select target training samples whose vector similarity is higher than a preset similarity threshold from multiple groups of training samples;
[0056] Step S2044: Using the task planning module, sample labels corresponding to the target training samples are integrated to obtain a first task planning strategy corresponding to the first task.
[0057] In this embodiment, when the agent analyzes the first task, it first converts the description text of the first task and the historical task into a vector form to obtain the corresponding first task vector and multiple historical task vectors. It should be noted that the agent can directly store the converted multiple historical task vectors in the historical task vector library. Then, the agent performs a neighbor search in multiple historical tasks in the training sample set to find one or more target historical tasks that are most similar to the first task. Since these target historical tasks all have the same one or more subtasks as the first task, it is also necessary to find the task planning prompts (calling tools and input parameters of calling tools) corresponding to each subtask that is the same as the first task from the task planning strategies corresponding to these target historical tasks, and integrate the task planning prompts of each subtask according to the order of each subtask to obtain the first task planning strategy corresponding to the first task. In this way, the agent can understand the user's intention more accurately and quickly, accurately decompose the task to obtain multiple subtasks, and clearly execute the steps of each subtask and the details of the calling tool, avoiding the confusion and inefficiency that may be caused by directly executing complex tasks.
[0058] Continuing with the above example, the task planning model can be used to disassemble and analyze the first task: "Query the number of user logins in the past seven days, and obtain the user role information with the least number of logins" to obtain multiple subtasks and the task planning prompts corresponding to each subtask:
[0059] Subtask 1: "Get current time". The calling tool for this subtask is "Get current time_API", and the input parameter is empty.
[0060] Subtask 2: "Query the user with the least number of logins". The calling tool for this subtask is "Agent Test_Panshi Login Count_API". The time information "seven days" is extracted from the description text. According to the description text, it can be inferred that the input parameter start_time is the current time obtained in the first step pushed forward by 7 days, and the input parameter end_time is the current time obtained in the first step".
[0061] Subtask three: "Query user role". The calling tool corresponding to this subtask is "Intelligent Agent Test_Panshi User Information_API". The input parameter name is the user name obtained in the second step.
[0062] Step S206, for each first subtask, determine the first entity noun of at least one profession within the first subtask, and determine the corresponding term explanations of the first entity nouns of each profession; splice the first entity nouns of each profession and the corresponding term explanations to the task planning prompt words corresponding to the first subtask, and execute the first subtask according to the spliced task planning prompt words to obtain the corresponding execution results.
[0063] In the technical solution provided in step S206, since the agent does not have professional domain knowledge, it cannot provide a complete, accurate and executable task execution process like a domain expert when facing a given goal, so the accuracy of autonomous reasoning planning in the professional domain is low. In addition, when the agent executes each subtask, the output result of the tool called when the subtask is currently executed is usually the input parameter of the tool called when executing the next subtask. Therefore, once the accuracy of the execution result of any subtask is poor, it will gradually affect the accuracy of the execution results of subsequent subtasks.
[0064] Therefore, the embodiment of the present application proposes that when executing each first subtask in sequence, the entity nouns within the first subtask can be extracted, and professional judgment can be made, and the entity nouns of each profession and the corresponding term explanations can be added to the task planning prompt words to enhance the intelligent agent's understanding of professional field tasks.
[0065] As an optional implementation, in the technical solution provided in the above step S206, the agent can perform professional determination on the entity noun according to the following method, including:
[0066] Step S2061: extract multiple first entity nouns in the first subtask.
[0067] Step S2062, for each first entity noun, determine whether the first entity noun is included in a preset professional noun library, wherein the professional noun library includes: entity nouns of multiple professional disciplines in different fields and the corresponding glossary of each professional entity noun; if included, the first entity noun is determined to be professional (that is, the first entity noun is a professional noun), and the corresponding glossary of the professional first entity noun is determined; if not included, the first entity noun is determined to be unprofessional (that is, the first entity noun is a non-professional noun).
[0068] In this embodiment, the entity professional terminology library may include professional terms in different fields and corresponding terminology explanations in different scenarios, for example: {"IP address":" is a unique identifier for a device in a network. There are currently two main versions of IP addresses: IPv4 and IPv6. An IPv4 address is a 32-bit binary number, usually expressed in dotted decimal form, such as 1.1.1.1, containing four numbers between 0 and 255. An IPv6 address is a 128-bit binary number, usually expressed in eight groups of hexadecimal numbers separated by colons, such as 2001:0db8:85a3:0000:0000:8a2e:0370:7334"}.
[0069] After obtaining the first entity nouns and corresponding definition of each profession within the first subtask through the above steps S2061-S2062, the first entity nouns and corresponding definition of each profession can be spliced into the task planning prompt words corresponding to the first subtask, so as to facilitate the subsequent understanding of the professional nouns that appear in the interaction process of the intelligent agent.
[0070] Furthermore, during the execution of the task by the agent, the description of the input parameters given by the user when calling the API interface is relatively simple, resulting in low accuracy in the parameter extraction of the general large model before calling the API, which leads to low accuracy in the execution of the agent. In order to ensure the accuracy of the subsequent execution of the first subtask, the embodiment of the present application can also verify the input parameters of each calling tool required for executing the first subtask obtained in the above step S204 according to the following steps, including:
[0071] Step 1: Use the preset verification rules to verify the input parameters;
[0072] Step 2: When the verification result of the input parameter is passed, the first entity noun of each profession and the corresponding noun explanation are directly spliced to the task planning prompt word corresponding to the first subtask.
[0073] Step 3: When the verification result of the input parameter is verification failure, determine the failure reason of the input parameter failure to pass the verification, regenerate the input parameter according to the verification rules and the failure reason, and re-execute the verification process until the preset number of cycles is reached or the verification result of the input parameter is verification passed.
[0074] The verification rule may be in the form of a regular expression, which may be a regular expression originally set by the agent or a user-defined regular expression. This application does not impose any specific restrictions on the setting of the verification rule. In addition, the setting of the number of loops is to prevent the agent from falling into an infinite loop when verifying input parameters.
[0075] Furthermore, the intelligent agent plans the task prompts for the first subtask based on the first entity nouns of various professions and the corresponding noun explanations, so that the intelligent agent can accurately understand the task and input the correct input parameters to the calling tool required to execute the first subtask, so as to improve the accuracy of the output results of the first subtask.
[0076] Based on the scheme defined by the above steps S202 to S206, it can be learned that in the embodiment, the intelligent agent obtains a reasonable and accurate first task planning strategy (i.e., multiple first subtasks obtained by dividing the first task and the task planning prompt words corresponding to each first subtask) by using the task planning model to intelligently disassemble and analyze the description text of the first task, so as to reduce errors in the execution of subsequent tasks; then, multiple first entity nouns in the first subtask are extracted, and the professionalism of each first entity noun is determined to select professional first entity nouns from the multiple first entity nouns in the first subtask, and determine the noun interpretation of each professional first entity noun; at the same time, the input parameters in the task planning prompt words corresponding to the first subtask are verified to ensure the accuracy of the input parameters of the intelligent agent when calling the tool, so as to avoid tool call failure or inaccurate tool input results due to incorrect input parameters; finally, after splicing the first entity nouns of each profession and their corresponding noun interpretations into the task planning prompt words containing the verified input parameters, the first subtask is executed according to the task planning prompt words to obtain accurate execution results. During the entire task execution process, the intelligent agent's ability to understand professional knowledge, task planning accuracy, and parameter extraction accuracy can be effectively improved, thereby achieving the purpose of improving the robustness of task execution. This solves the technical problem that the intelligent agent is unable to plan a complete and accurate task process due to its lack of professional knowledge and planning experience, resulting in poor accuracy of task execution results.
[0077] Example 2
[0078] Based on Embodiment 1 of the present application, an embodiment of a task execution device is also provided, and the device executes the task execution method of the above embodiment when it is running. Figure 3 is a schematic diagram of the structure of an optional task execution device according to an embodiment of the present application, such as Figure 3 As shown, the task execution device at least includes an acquisition module 32, a determination module 34 and an execution module 36, wherein:
[0079] An acquisition module 32, used to acquire a description text of a first task to be executed;
[0080] The determination module 34 is used to analyze the description text of the first task by using the pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes a plurality of first subtasks obtained by dividing the first task and a task planning prompt word corresponding to each first subtask, and the task planning prompt word at least includes: a calling tool and input parameters of the calling tool when executing the first subtask;
[0081] The execution module 36 is used to determine, for each first subtask, the first entity noun of at least one profession within the first subtask, and determine the corresponding term explanations of the first entity nouns of each profession; splice the first entity nouns of each profession and the corresponding term explanations to the task planning prompt words corresponding to the first subtask, and execute the first subtask according to the spliced task planning prompt words to obtain the corresponding execution result.
[0082] It should be noted that the various modules in the above-mentioned task execution device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.
[0083] Example 3
[0084] According to an embodiment of the present application, a non-volatile storage medium is further provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the task execution method in Example 1.
[0085] Optionally, the device where the non-volatile storage medium is located implements the following steps by running the program: obtaining a description text of the first task to be executed; using a pre-trained task planning model to analyze the description text of the first task to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes multiple first subtasks obtained by dividing the first task and task planning prompts corresponding to each first subtask, and the task planning prompts include at least: a calling tool and input parameters of the calling tool when executing the first subtask; for each first subtask, determining the first entity noun of at least one profession in the first subtask, and determining the corresponding noun explanations of the first entity nouns of each profession; splicing the first entity nouns of each profession and the corresponding noun explanations to the task planning prompts corresponding to the first subtask, and executing the first subtask according to the spliced task planning prompts to obtain the corresponding execution results.
[0086] According to an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein when the computer program is executed by a processor, the task execution method in Example 1 is implemented.
[0087] Optionally, the computer program executes the following steps: obtaining a description text of a first task to be executed; analyzing the description text of the first task using a pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes multiple first subtasks obtained by dividing the first task and task planning prompts corresponding to each first subtask, and the task planning prompts include at least: a calling tool and input parameters of the calling tool when executing the first subtask; for each first subtask, determining a first entity noun of at least one profession in the first subtask, and determining a glossary corresponding to the first entity noun of each profession; splicing the first entity noun of each profession and the corresponding glossary to the task planning prompt corresponding to the first subtask, and executing the first subtask according to the spliced task planning prompt to obtain a corresponding execution result.
[0088] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the task execution method in Example 1 is executed when the program is running.
[0089] Optionally, the following steps are executed when the program is running: obtaining a description text of the first task to be executed; using a pre-trained task planning model to analyze the description text of the first task to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes multiple first subtasks obtained by dividing the first task and task planning prompts corresponding to each first subtask, and the task planning prompts include at least: a calling tool and input parameters of the calling tool when executing the first subtask; for each first subtask, determining the first entity noun of at least one profession in the first subtask, and determining the corresponding term explanations of the first entity nouns of each profession; splicing the first entity nouns of each profession and the corresponding term explanations to the task planning prompts corresponding to the first subtask, and executing the first subtask according to the spliced task planning prompts to obtain the corresponding execution results.
[0090] According to an embodiment of the present application, an electronic device is also provided, wherein: Figure 4 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Figure 4 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the task execution method in the above-mentioned embodiment 1 when running.
[0091] Optionally, the processor is configured to execute the following steps through a computer program: obtaining a description text of a first task to be executed; analyzing the description text of the first task using a pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes multiple first subtasks obtained by dividing the first task and task planning prompts corresponding to each first subtask, and the task planning prompts include at least: a calling tool and input parameters of the calling tool when executing the first subtask; for each first subtask, determining the first entity noun of at least one profession in the first subtask, and determining the corresponding noun explanations of the first entity nouns of each profession; splicing the first entity nouns of each profession and the corresponding noun explanations to the task planning prompts corresponding to the first subtask, and executing the first subtask according to the spliced task planning prompts to obtain the corresponding execution results.
[0092] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0093] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0094] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, 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 units or modules, which can be electrical or other forms.
[0095] 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 over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0096] 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.
[0097] 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, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0098] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A task execution method, characterized in that: include: Obtaining a description text of a first task to be executed; Analyze the description text of the first task using a pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes a plurality of first subtasks obtained by dividing the first task and a task planning prompt word corresponding to each of the first subtasks, and the task planning prompt word at least includes: a calling tool when executing the first subtask and input parameters of the calling tool; For each of the first subtasks, determine the first entity noun of at least one profession within the first subtask, and determine the corresponding term explanations for the first entity nouns of each profession; splice the first entity nouns of each profession and the corresponding term explanations to the task planning prompt words corresponding to the first subtask, and execute the first subtask according to the spliced task planning prompt words to obtain the corresponding execution results.
2. The method according to claim 1, characterized in that The training process of the task planning model includes: Acquire a training sample set and a sample label set, wherein the training sample set includes description texts of multiple historical tasks as training samples, and the sample label set includes a task planning strategy corresponding to each of the historical tasks as a sample label; Constructing an initial learning model including at least a feature extraction module, a similarity calculation module, a sample screening module and a task planning module; The initial learning model is iteratively trained using the training sample set and the sample label set to obtain the task planning model.
3. The method according to claim 2, characterized in that The feature extraction module includes at least a word embedding layer and a pooling layer, wherein the word embedding layer is used to convert each word in the description text of the task into a word vector, and the pooling layer is used to integrate each of the word vectors into a corresponding task vector; The similarity calculation module at least includes a distance network, wherein the distance network is used to calculate the vector similarity between task vectors of any two tasks; The sample screening module is used to select target training samples whose vector similarity is higher than a preset similarity threshold from multiple groups of training samples; The task planning module is used to integrate sample labels corresponding to the target training samples.
4. The method according to claim 2, characterized in that: Iteratively training the initial learning model using the training sample set and the sample label set to obtain the task planning model includes: For each training batch in the iterative training process, each training sample of the training batch is input into the initial learning model to obtain each task planning strategy output by the initial learning model, and a target loss function is constructed using the task planning strategy and the corresponding sample labels, and the model parameters of the initial learning model are adjusted according to the target loss function.
5. The method according to claim 3, characterized in that: The first task is analyzed by using a pre-trained task planning model to obtain a corresponding first task planning strategy, including: Using the feature extraction module to perform feature extraction on the description text of the first task and the description texts of the historical tasks in the multiple groups of training samples to obtain a corresponding first task vector and multiple historical task vectors; Calculating the vector similarity between the first task vector and each of the historical task vectors using the similarity calculation module; Selecting target training samples whose vector similarity is higher than a preset similarity threshold from the multiple groups of training samples using the sample screening module; The task planning module is used to integrate sample labels corresponding to the target training samples to obtain a first task planning strategy corresponding to the first task.
6. The method according to claim 1, characterized in that Determining the first entity noun of at least one profession in the first subtask, and determining the noun explanation corresponding to the first entity noun of each profession, including: Extracting a plurality of first entity nouns in the first subtask; For each first entity noun, determine whether the first entity noun is included in a preset professional noun library, wherein the professional noun library includes: entity nouns of multiple professional disciplines in different fields and the corresponding noun explanations of each professional entity noun; if included, determine that the first entity noun is professional, and determine the corresponding noun explanation of the first entity noun of the profession; if not included, determine that the first entity noun is unprofessional.
7. The method according to claim 1, characterized in that Before splicing the first entity nouns and the corresponding noun explanations of each of the professions to the task planning prompt words corresponding to the first subtask, the method further includes: For each input parameter of the calling tool called when executing the first subtask, the following steps are executed in a loop until a preset number of loops is reached or the verification result of the input parameter is verified to be passed: Verifying the input parameters using preset verification rules; When the verification result of the input parameter is that the verification fails, the failure reason of the input parameter failing the verification is determined, and the input parameter is regenerated according to the verification rule and the failure reason.
8. A task execution device, characterized in that: include: An acquisition module, used to acquire a description text of a first task to be executed; A determination module is used to analyze the description text of the first task by using a pre-trained task planning model to obtain a corresponding first task planning strategy, wherein the first task planning strategy includes a plurality of first subtasks obtained by dividing the first task and a task planning prompt word corresponding to each of the first subtasks, and the task planning prompt word at least includes: a calling tool when executing the first subtask and input parameters of the calling tool; An execution module is used to determine, for each of the first subtasks, the first entity noun of at least one profession within the first subtask, and determine the corresponding term explanations of the first entity nouns of each profession; splice the first entity nouns of each profession and the corresponding term explanations to the task planning prompt words corresponding to the first subtask, and execute the first subtask according to the spliced task planning prompt words to obtain the corresponding execution results.
9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, wherein the device where the non-volatile storage medium is located executes the task execution method according to any one of claims 1 to 7 by running the computer program.
10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the task execution method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Task execution method, device and system, electronic device and storage medium
CN120723411A