Task execution method and device, electronic equipment and storage medium
By generating tool selection prompt words and entering tool selection model, the problem of difficult to determine the target tool due to the numerous tools in the tool pool is solved, and the accuracy of the target tool and task execution efficiency are improved to meet user needs.
Patent Information
- Application Number
- CN202410921723.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-15
AI Technical Summary
In the prior art, there are many tools in the tool pool, which makes it difficult to determine the target tool, poor accuracy, and unable to effectively meet user needs.
The tool selection prompt words are generated based on user input information, pre-selected tool information in the tool pool, and model work requirements, and input them into the pre-built tool selection model to determine and call the target tool to perform tasks.
It reduces the difficulty of determining the target tool among a large number of tools, improves the accuracy of the target tool, and ensures that the tasks to be executed corresponding to the user input information are quickly and effectively executed, meeting user needs.
Smart Images

Figure CN118963932A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of generative artificial intelligence, and in particular to a task execution method, device, electronic device and storage medium. Background Art
[0002] With the continuous development of artificial intelligence technology, large models for identifying user intent have been widely used. In the prior art, the user intent is determined by identifying input information, and the target tool is determined in the tool pool according to the user intent to perform the task to be performed corresponding to the user intent, thereby meeting the user's needs.
[0003] However, in the process of implementing the present invention, it was found that the prior art has at least the following technical problems: there are a large number of tools in the tool pool, and it is difficult and inaccurate to determine the target tool from the large number of tools by inputting information, which is not conducive to effectively and accurately meeting user needs. Summary of the invention
[0004] The embodiments of the present invention provide a task execution method, device, electronic device and storage medium to achieve the purpose of improving the accuracy of the determined target tool and better meet the user needs.
[0005] According to one aspect of the present invention, there is provided a task execution method, comprising:
[0006] Generate tool selection prompt words based on user input information, tool information of pre-selected tools in the tool pool and pre-set model work requirements;
[0007] Inputting the tool selection prompt word into a pre-built tool selection model to obtain output information, and determining a target tool from the pre-selected tools based on the output information;
[0008] The target tool is called to enable the target tool to execute the task to be executed corresponding to the user input information.
[0009] According to another aspect of the present invention, there is provided a task execution device, the device comprising:
[0010] A prompt word generation module, used for generating a tool selection prompt word based on user input information, tool information of a pre-selected tool in a tool pool and a pre-set model work requirement;
[0011] A target tool determination module, used for inputting the tool selection prompt word into a pre-built tool selection model to obtain output information, and determining a target tool from the pre-selected tools based on the output information;
[0012] The target tool calling module is used to call the target tool so that the target tool executes the task to be executed corresponding to the user input information.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the task execution method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the task execution method described in any embodiment of the present invention when executed.
[0018] The technical solution of the embodiment of the present invention generates tool selection prompt words based on user input information, tool information of pre-selected tools in a tool pool and pre-set model working requirements; the tool selection prompt words are input into a pre-built tool selection model. Since the tool selection prompt words include tool information and model working requirements, they can help the tool selection model to make decisions, and determine the target tool from the pre-selected tools through the output information of the tool selection model, thereby reducing the difficulty of determining the target tool from a large number of tools; it is beneficial to improve the accuracy of the determined target tool; and by calling the target tool, the task to be executed corresponding to the user input information is quickly and effectively executed, which can better meet user needs.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 is a flowchart of a task execution method provided according to an embodiment of the present invention;
[0022] Figure 2 is a flowchart of another task execution method provided according to an embodiment of the present invention;
[0023] Figure 3 is a flowchart of another task execution method provided according to an embodiment of the present invention;
[0024] Figure 4 is a schematic diagram of a tool selection process provided according to an embodiment of the present invention;
[0025] Figure 5 is a structural schematic diagram of a task execution device provided according to an embodiment of the present invention;
[0026] Figure 6 It is a structural diagram of an electronic device for implementing the task execution method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "etc." and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.
[0030] Before introducing the technical solution, an example description of the application scenario can be given first. This technical solution can be applied to scenarios where the user's intention is identified through user input information when interacting with the user, and the task to be performed corresponding to the user's intention is performed. A tool selection model is provided in this technical solution. The tool selection model is a large model (Large Model) for user identification and tool selection. A large model, also known as a large language model or a basic model, refers to a machine learning model with a large parameter scale and a complex computing structure, such as a GPT model, a Gemini model, and a Yanxi large model. The tool selection model is used to identify the user's input information, and determine the target tool for performing the task to be performed, and the task to be performed is performed by calling the target tool. This technical solution can be applied to different fields such as automatic writing, chatbots, virtual assistants, voice assistants, and automatic translation.
[0031] Figure 1 This is a flowchart of a task execution method provided according to an embodiment of the present invention. This embodiment is applicable to the case where a target tool is determined and the task to be executed corresponding to the user input information is executed by calling the target tool. The method can be executed by a task execution device, which can be implemented in the form of hardware and / or software.
[0032] like Figure 1 As shown, the method of this embodiment may specifically include:
[0033] S110 , generating a tool selection prompt based on user input information, tool information of a pre-selected tool in a tool pool, and pre-set model work requirements.
[0034] In this embodiment, user input information is obtained by interacting with the user. The user input information may be all or part of the information input by the user after multiple rounds of interaction; or the user input information may be the information input by the user after any round of interaction. The user input information may be different types of information, such as at least one type of text, image, audio, and video.
[0035] After obtaining the user input information, the tool selection prompt words can be generated based on the user input information, the tool information of the pre-selected tools in the tool pool and the model work requirements. Among them, the tool pool is used to store the tools that can be called and the corresponding application program interface; the corresponding tool is called through the application program interface to trigger the tool to perform the task. Some or all tools can be selected in the tool pool in advance, and the tool selection prompt words are generated based on the tool information of the pre-selected tools. Exemplarily, the tool pool may include at least one tool among data tools, search tools, drawing tools, databases and compilers. The tool information includes the name of the tool, English code, tool field, tool selection example, enumeration value, parameter description and at least one of the input and output parameters. The model work requirements are used to indicate at least one of the output parameter format, model skills, model roles and work objectives of the tool selection model.
[0036] For example, the model role can be a method identification expert; the model skills are: understanding and analyzing the tasks input by the user, identifying and matching methods in the method list, arranging multiple methods in order to solve complex tasks; giving a standardized response when the method cannot be identified. Correspondingly, the work goals can be: providing accurate method identification; ensuring that the output format meets the preset parsing standards; ensuring that the user input is effectively processed; giving a standardized response when the method cannot be identified.
[0037] In a specific implementation, a text consisting of user input information, tool information of all tools in the tool pool, and pre-set model work requirements can be used as a tool selection prompt. Alternatively, candidate tools associated with the user input information can be screened out in the tool pool, and a text consisting of user input information, tool information of the candidate tools, and model work requirements can be used as a tool selection prompt. It should be noted that the tool selection prompt can be a word, a phrase, a question, or a complete sentence; it is used to guide the tool selection model to determine the target tool.
[0038] Optionally, tool selection prompt words are generated based on user input information, tool information of pre-selected tools in the tool pool and pre-set model work requirements, including: generating tool selection prompt words based on user input information, name, tool selection example and model work requirements.
[0039] In this embodiment, the tool information includes the name of the pre-selected tool and the tool selection example; the tool selection example includes the correspondence between the sample input information and the selected tool. The sample input information may be the information actually input by the user in the actual application, and the selected tool corresponding to the sample input information is the tool actually called after the sample input information is obtained in the actual application. Exemplarily, in the tool selection example, multiple tools in the tool pool may be selected as tools; for each selected tool, there are multiple sample input information corresponding to it, thereby improving the diversity and richness of the tool selection examples.
[0040] Specifically, a text containing user input information, tool name, tool selection example and model working requirements can be generated as a tool selection prompt, so that the tool selection prompt reflects the correspondence between the sample input information and the selected tool, making it easier for the tool selection model to learn the correspondence and determine the corresponding target tool for the user input information, which is conducive to improving the accuracy of the determined target tool.
[0041] S120: Input the tool selection prompt word into a pre-built tool selection model to obtain output information, and determine a target tool from the pre-selected tools based on the output information.
[0042] In this embodiment, the output information may include the target name of the target tool corresponding to the tool selection prompt word determined by the tool selection model. The number of target tools may be one or more. When the number of target tools is multiple, the output information also includes the tool execution order of each target tool. The tool corresponding to the target name output by the output information among the tools may be determined as the target tool.
[0043] S130: Calling a target tool so that the target tool executes a task to be executed corresponding to the user input information.
[0044] Among them, the task to be executed is the task that needs to be executed to meet the user intention corresponding to the user input information. For example, if the user input information is "I want to send a business new customer SMS", the SMS sending tool is used as the target tool, and the task to be executed can be the task of sending the new customer content text in the form of SMS. The user information who needs to receive the SMS and the new customer content text are used as input parameters of the SMS sending tool, and the task to be executed is completed by calling the SMS sending tool.
[0045] The technical solution of the embodiment of the present invention generates tool selection prompt words based on user input information, tool information of pre-selected tools in a tool pool and pre-set model working requirements; the tool selection prompt words are input into a pre-built tool selection model. Since the tool selection prompt words include tool information and model working requirements, they can help the tool selection model to make decisions, and determine the target tool from the pre-selected tools through the output information of the tool selection model, thereby reducing the difficulty of determining the target tool from a large number of tools; it is beneficial to improve the accuracy of the determined target tool; and by calling the target tool, the task to be executed corresponding to the user input information is quickly and effectively executed, which can better meet user needs.
[0046] Figure 2 It is a flowchart of another task execution method provided according to an embodiment of the present invention. The implementation method of determining the target tool includes: determining the task execution sequence value corresponding to each first subtask constituting the task to be executed based on the output information; using the selected tool corresponding to each first subtask as the target tool; the implementation method of calling the target tool includes: based on the order of the task execution sequence value from small to large, calling the target tools corresponding to the task execution sequence value in sequence. Among them, the explanation of the terms that are the same or corresponding to the above embodiments will not be repeated here. Figure 2 As shown, the method includes:
[0047] S210 , generating tool selection prompt words based on user input information, tool information of each tool in the tool pool and pre-set model work requirements.
[0048] S220, input the tool selection prompt word into a pre-built tool selection model to obtain output information, determine the task execution order value corresponding to each first subtask constituting the task to be executed based on the output information, and use the selected tool corresponding to each first subtask as the target tool.
[0049] In this embodiment, the task to be executed can be divided into at least one first subtask. For example, the task to be executed can be "I want to send a service new member SMS to users aged 25-35", which can be divided into two first subtasks of "obtaining user group identification" and "sending SMS to a group". At the same time, two target tools can be determined, which are used to obtain user group identification and send SMS to a group.
[0050] In order to ensure that the tasks to be executed can be completed accurately and effectively, the output information may include the first subtasks corresponding to the tasks to be executed and the task execution order, and the task execution order values corresponding to the first subtasks corresponding to the tasks to be executed are determined through the output information. For example, since the user group ID is required when executing the SMS subtask, the task execution order value corresponding to "obtain user group ID" may be 1, which is executed before "group SMS", and the task execution order value corresponding to "group SMS" may be 2, that is, the target tool for obtaining the user group ID is called first, and then the target tool for group SMS is called.
[0051] S230 . Based on the order of the task execution sequence values from small to large, target tools corresponding to the task execution sequence values are called in sequence.
[0052] In a specific implementation, the corresponding target tools can be sorted in order of the task execution order value from small to large, and the target tools can be called in sequence according to the sorting. Specifically, the input parameter corresponding to the currently called target tool can be input into the target tool, so as to execute the first subtask corresponding to the target tool and obtain the output parameter of the target tool; based on the output parameter, the input parameter of the next target tool to be called is determined, so as to continue to execute the corresponding first subtask, until all the first subtasks are completed, which means that the task to be executed corresponding to the user input information is completed.
[0053] This embodiment provides a method for splitting and arranging the tasks to be executed corresponding to the user input information, thereby splitting the tasks to be executed into multiple first subtasks according to the chain thinking technology, and correspondingly determining the target tools corresponding to each subtask, which is more conducive to the refined completion of the tasks to be executed.
[0054] In order to avoid the situation where the target tool cannot execute the subtask normally due to the missing input parameters of the target tool, the method of calling the target tools corresponding to the task execution order values in sequence based on the order of task execution order values from small to large may include: determining the input parameters and output parameters corresponding to each target tool; when the input parameters and output parameters corresponding to each target tool meet the preset conditions, calling the target tools corresponding to the task execution order values in sequence based on the order of task execution order values from small to large.
[0055] In a specific implementation, the target tool information corresponding to the target tool can be determined through the tool information stored in the tool pool, and the target tool information includes the input parameters and output parameters of the target tool. Two target tools with adjacent task execution order values are called adjacent target tools, and the adjacent target tool called first is determined as the previous adjacent tool, and the adjacent target tool called later is determined as the next adjacent tool. Determine whether the input parameters and output parameters of each pair of adjacent target tools corresponding to the user input information meet the preset conditions. If they all meet the conditions, the target tools are called in sequence to execute the first subtask corresponding to the currently called target tool.
[0056] Among them, the preset conditions include that in each pair of adjacent target tools with adjacent task execution order values, the output parameters of the previous adjacent tool are associated with the input parameters of the next adjacent tool. It should be noted that the association of the output parameters of the previous adjacent tool with the input parameters of the next adjacent tool means that the output parameters of the previous adjacent tool include all the input parameters of the next adjacent tool. For example, the output parameters of the previous adjacent tool include A and B, and the input parameters of the next adjacent tool are also A and B; or, the output parameters of the previous adjacent tool include A, B and C, and the input parameters of the next adjacent tool are A and B.
[0057] This embodiment calls the target tool to execute the subtask when the output parameters of the previous adjacent tool and the input parameters of the next adjacent tool meet the preset conditions, thereby ensuring that the input parameters required for the target tool to execute the subtask are not missing and that the target tool can work normally, which is beneficial to improving the accuracy and effectiveness of task execution.
[0058] Furthermore, after determining the input parameters and output parameters corresponding to each target tool, it also includes: when the input parameters and output parameters corresponding to each target tool do not meet the preset conditions, determining the missing input parameters corresponding to the target tool, and generating parameter query information based on the missing input parameters; sending the parameter query information to the user terminal to obtain the missing input parameters through feedback information from the user terminal; and based on the missing input parameters, calling the target tools corresponding to the task execution order value in sequence.
[0059] In a specific implementation, if the output parameters of the previous adjacent tool in any pair of adjacent target tools cannot contain the input parameters of the next adjacent tool, it means that the input parameters and output parameters corresponding to the target tool do not meet the preset conditions. In order to ensure that the target tool can be executed normally, the adjacent target tool that does not meet the preset conditions can be determined, and the output parameters of the previous adjacent tool and the input parameters of the next adjacent tool in the adjacent target tool are compared to determine the missing input parameters corresponding to the next adjacent tool. Obtain the missing input parameters by asking the user. For example, the output parameters of the previous adjacent tool include A and B, and the input parameters of the next adjacent tool are A, B and C, then C is the missing input parameter. Alternatively, the output parameters of the previous adjacent tool include A and B, and the input parameters of the next adjacent tool are C and D, then C and D are both missing input parameters.
[0060] In order to ensure that the target tool can perform the task normally, a parameter query message can be generated, and the parameter query message includes the name of the missing input parameter. The parameter query message is sent to the user terminal, and the feedback message sent by the user terminal is obtained. The missing input parameter is obtained by parsing the feedback message. When the parameter combination consisting of the missing input parameter and the output parameter of each target tool can contain the input parameter required by each target tool, the target tool is called in sequence to execute the subtask corresponding to the currently called target tool. For example, the output parameters of the previous adjacent tool include A, B and C, and the input parameters of the next adjacent tool are B, C and D, then D is the missing input parameter. After D is obtained by parsing the feedback information, the parameter combination consisting of the missing input parameter and the output parameter of the previous adjacent tool includes A, B, C and D, including the input parameter of the next adjacent tool. At this time, the target tool can be called once to execute the corresponding subtask.
[0061] This embodiment generates parameter query information and conducts multiple rounds of inquiries with the user when the output parameters of the previous adjacent tool and the input parameters of the next adjacent tool do not meet the preset conditions, thereby guiding the user to provide the missing input parameters, thereby flexibly and effectively obtaining the missing input parameters.
[0062] Optionally, a target tool is determined from pre-selected tools based on the output information, including: determining a second subtask to be executed in the task to be executed based on the output information, and determining the selected tool corresponding to the second subtask as the target tool; calling the target tool so that the target tool executes the task to be executed corresponding to the user input information, including: calling the target tool so that the target tool executes the second subtask; when the subtask execution result corresponding to the second subtask does not match the final execution result corresponding to the task to be executed, repeating the operation of determining the target tool from the pre-selected tools and executing the subtask by calling the target tool until the current execution result obtained matches the final execution result, thereby ending the execution operation of the task to be executed.
[0063] In a specific implementation, the second subtask currently to be executed in the tasks to be executed can be determined based on the output information. For example, the task to be executed can be "I want to send a business new member SMS to users aged 25-35 years old". If you want to execute the task to be executed, the second subtask that needs to be executed first is "obtain user group identification". Then the selected tool corresponding to "obtain user group identification" can be determined as the target tool.
[0064] Specifically, by calling the target tool, the subtask execution result corresponding to the second subtask is obtained. For example, when the second subtask is "obtaining the user group identifier", the subtask execution result is obtaining the user group identifier. In order to ensure that the task to be executed is completely executed, it can be determined whether the task execution result corresponding to the second subtask matches the final execution result that the subtask to be executed wants to obtain. If it matches, it means that the task to be executed is completely executed, and the execution operation of the task to be executed can be ended; if it does not match, the latest second subtask to be executed can be determined, and the selected tool of the latest second subtask is used as the target tool, and the latest target tool is called to continue to execute the task to be executed until the task execution result matches the final execution result, and then the task execution operation is ended.
[0065] Exemplarily, the task to be executed may be "I want to send a text message to attract new users aged 25-35", and the final execution result should be sending text messages to the user group. When the second subtask is "obtaining the user group identifier", the subtask execution result is obtaining the user group identifier, rather than obtaining the user group identifier, and the two do not match. In the case of a mismatch, it means that the task to be executed has not been fully executed, and the second subtask that needs to be executed can be determined, that is, "group text messages", and the target tool corresponding to "group text messages" can be called to execute the second subtask. The subtask execution result corresponding to "group text messages" is to send text messages to the user groups separately, which matches the final execution result, which means that the task to be executed has been fully executed, and the execution operation of the task to be executed can be ended.
[0066] This embodiment provides another method for splitting and arranging the tasks to be executed corresponding to the user input information. After the current second subtask to be executed is executed, the next second subtask to be executed is determined and executed, thereby completing the execution process of the tasks to be executed, thereby ensuring that the tasks to be executed are completely and effectively executed.
[0067] Figure 3 It is a flowchart of another task execution method provided according to an embodiment of the present invention. The method of generating tool selection prompt words may include: based on user input information, a preset recall method and tool information of pre-selected tools in a pre-built tool pool, determining at least one first candidate tool in the tool pool; wherein the preset recall method includes a word segmentation recall method and / or a semantic vector recall method; based on user input information, first candidate information of the first candidate tool and model working requirements, generating tool selection prompt words. Among them, the explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 3 As shown, the method includes:
[0068] S310: Determine at least one first candidate tool in the tool pool based on user input information, a preset recall method, and tool information of pre-selected tools in a pre-built tool pool.
[0069] Among them, the preset recall method includes a word segmentation recall method and / or a semantic vector recall method.
[0070] It should be noted that the tool pool usually contains a large number of tools. If the tool selection prompt words are composed based on the tool information of each tool, the tool selection prompt words will be redundant, which is not convenient for the tool selection model to learn and make decisions. Therefore, some first candidate tools can be screened out in the tool pool first, and tool selection prompt words can be generated based on the first candidate information of the first candidate tools, making the tool selection prompt words more convenient and improving the convenience of the tool selection model in determining the target tool.
[0071] In a specific implementation, when the preset recall method is the word segmentation recall method, the method of determining at least one first candidate tool in the tool pool may include: performing word segmentation processing on the user input information to obtain a first word segmentation; performing word segmentation processing on the tool information corresponding to each tool in the tool pool to obtain a second word segmentation; for each tool, determining a first matching degree between the first word segmentation and the second word segmentation corresponding to the tool; based on the first matching degree corresponding to each tool, determining at least one first candidate tool in the tool pool. The first candidate information is the tool information of the first candidate tool.
[0072] In this embodiment, the first matching degree between the first participle and the second participle can be determined by using the TF-IDF (term frequency–inverse document frequency) method of the Elasticsearch index. The first matching degree between the first participle and the second participle can also be determined based on the similarity calculation method CQR&CTR in the field of natural language understanding.
[0073] It should be noted that since the tool information is a description of the tool, the higher the first matching degree between the first participle and the second participle, the closer the match between the user input information and the tool information is. A preset number of tools with the highest first matching degree can be screened out as first candidate tools, so that the determined first candidate tools are more suitable for the task to be executed corresponding to the user input information.
[0074] Furthermore, when the preset recall method is the semantic vector recall method, the method for determining at least one first candidate tool in the tool pool may include: extracting the user semantic feature vector corresponding to the user input information and the tool semantic feature vector corresponding to each tool information; for each tool, determining the second matching degree between the user semantic feature vector and the tool semantic feature vector corresponding to the tool based on the cosine matching algorithm; based on the second matching degree corresponding to each tool, determining at least one first candidate tool in the tool pool.
[0075] Specifically, a preset number of tools with the second highest matching degree may be determined as first candidate tools, so that the determined first candidate tools are more suitable for the tasks to be executed corresponding to the user input information.
[0076] S320: Generate tool selection prompt words based on user input information, first candidate information of the first candidate tool, and model work requirements.
[0077] Optionally, the user input information, the first candidate information and the model work requirements may constitute text content, and the text content may be determined as a tool selection prompt word.
[0078] This embodiment uses a preset recall method to quickly determine the first candidate tool, and generates a tool selection prompt word based on the first candidate information, user input information and model tool requirements, so as to filter out the target tool from the first candidate tools, thereby narrowing the scope of the target tool, which is beneficial to reducing the working difficulty of the tool selection model and improving the accuracy of determining the target tool.
[0079] In a specific implementation, based on the user input information, the first candidate information of the first candidate tool and the model working requirements, the method of generating tool selection prompt words can also be: for each first candidate tool, determining the information similarity between the user input information and the first candidate information corresponding to the first candidate tool based on a pre-built semantic vector model; determining the second candidate tool from the first candidate tools based on a preset similarity threshold and each information similarity; generating tool selection prompt words based on the user input information, the second candidate tools and the model working requirements.
[0080] Since the word segmentation recall method and the semantic vector recall method can quickly determine the first candidate tool, but the accuracy of the matching degree determination is not high, in order to further accurately narrow the scope of the target tool, the information similarity between the user input information and the first candidate information of each first candidate tool can be determined based on the pre-built semantic vector model. Among them, the semantic vector model is the reranker part of the bge (BAAI General Embedding) model with a cross-encoder structure.
[0081] Specifically, for each first candidate tool, a text pair is formed by the first candidate information corresponding to the first candidate tool and the user input information, and the information similarity between the first candidate information and the user input information in each text pair is determined. The first candidate tool with information similarity greater than a preset similarity threshold is determined as the second candidate tool, and a tool selection prompt is generated based on the user input information, the second candidate information and the model work requirements.
[0082] In this embodiment, the second candidate tool is screened out from the first candidate tool through the semantic vector model, thereby further narrowing the scope of determining the target tool and improving the accuracy of the determined target tool.
[0083] In this embodiment, the first candidate information includes tool description information corresponding to at least one description type; the preset similarity threshold includes a preset type similarity threshold corresponding to each tool description information; the information similarity includes the description similarity between at least one tool description information and the user input information; based on the preset similarity threshold and each information similarity, the second candidate tool is determined in the first candidate tool, including: for each first candidate tool, when each description similarity is greater than the preset type similarity threshold corresponding to the description similarity, the first candidate tool is determined as the second candidate tool.
[0084] The tool description information may include at least one of a tool selection example, a name, a parameter description, and an enumeration value; since the basic correlation between different tool description information and user input information is different; for example, the correlation between the tool selection example and the user input information is high, but the possibility of a high similarity between the tool parameter description and the user input information is not high. Therefore, in order to meet the differences between different tool description information, different preset type similarity thresholds may be set for different tool description information.
[0085] In a specific implementation, when determining whether a first candidate tool can be used as a second candidate tool, for each first candidate tool, the description similarity between the user input information and each tool description information of the first candidate tool can be determined through a semantic vector model. If each description similarity is greater than a preset type similarity threshold associated with the corresponding tool description information, the first candidate tool can be determined as the second candidate tool; if there is a case where the description similarity is less than or equal to the corresponding preset type similarity threshold, the first candidate tool cannot be determined as the second candidate tool.
[0086] S330: Input the tool selection prompt word into a pre-built tool selection model to obtain output information, and determine the target tool from among the tools based on the output information.
[0087] S340: Call the target tool to enable the target tool to execute the task to be executed corresponding to the user input information.
[0088] This embodiment takes into account the differences in description information of different tools and provides different preset type similarity thresholds, so as to facilitate more accurate screening of the second candidate tool.
[0089] The above describes in detail the implementation example corresponding to the task execution method. In order to make the technical scheme of the present method further clear to those skilled in the art, the task execution process is specifically described below using the user input information "I want to send a service to attract new users to users aged 25-35" as an example.
[0090] Before entering the task execution process, you need to design a tool registration format. When registering a tool, you need to provide tool description information such as the tool's Chinese name, English code, tool field, trigger range, tool description, tool selection example, parameter name, enumeration value, parameter description and parameter example. The tool description information will be used as a reference for large model identification tools and parameter extraction and filling.
[0091] like Figure 4 As shown, when user input is received, the tool category is recalled through the user input information and the preset recall method to determine the first candidate tool. And, based on the pre-built semantic vector model, the second candidate tool is selected from the first candidate tools. Exemplarily, the number of second candidate tools can be reduced to 5. In the process of selecting the first candidate tool and the second candidate tool, due to the large number of tools in the tool pool, the tools and parameters can be clarified by multiple interactions with the user.
[0092] Furthermore, based on the prompt of COT concept, the text content consisting of user input information, second candidate information and model work requirements is provided to the tool selection model as tool selection prompt words, so that the tool selection model can perform task decomposition and tool arrangement, that is, select the target tool from the second candidate tools and determine the tool execution order of the target tool. There are two forms of arrangement:
[0093] In the first way, the tool selection model gives the task execution link at one time based on the tool selection prompt words. For example, "I want to send a business acquisition SMS to users aged 25-35" will be broken down into ["obtain user group identifier", "group SMS"].
[0094] In the second method, the tool selection model selects only one target tool at a time and executes the subtask corresponding to the target tool. When the execution result of the target tool is obtained, the next target tool is selected until it is completely completed. For example, if the user inputs "I want to send a business new SMS to users aged 25-35", the "Get user group identification" target tool is first determined and called, and the execution result is the group identification. Then the "Group SMS" target tool is determined and executed, and the execution result is successful sending.
[0095] Based on the determined target tool and the tool execution order, a task chain is formed and the task chain is stored in the task stack. The target tool is called in the tool execution order to execute the task in the task chain. When calling the target tool, the input parameters required by the target tool must be sent to the parameter filling module and the parameters must be filled in according to the preset parameter filling rules. For example, the user input information is "I want to send a business new SMS to users aged 25-35", and the previous execution result is that the group identifier is xxxxx. The current target tool is "group SMS", and the required input parameters of the target parameter are "group identifier", "sending content" and "sending time". The obtained group identifier can be sent to the parameter filling module. Since the "sending content" and "sending time" are unknown, an interactive inquiry with the user can be established to clarify the parameters interactively, so as to obtain the "sending content" and "sending time" to complete the parameter filling, so as to execute the currently selected target tool. After executing the currently selected target tool, a new target tool is selected from the task stack for execution until all target tools are called and the obtained execution results are returned to the user terminal.
[0096] This embodiment accurately identifies the target tool from a large number of tools in the tool pool, and when the user input information is unclear, clarifies the tool and parameters, resulting in multiple rounds of interaction, thereby selecting the most accurate tool as the target tool. In addition, according to different user input information, by expanding the tools in the tool pool, different tasks can be flexibly completed, which has high scalability.
[0097] Figure 5 1 is a schematic diagram of the structure of a task execution device provided according to an embodiment of the present invention, and the device is used to execute the task execution method provided in any of the above embodiments. The device and the task execution method of the above embodiments belong to the same inventive concept, and the details not described in detail in the embodiment of the task execution device can refer to the embodiment of the above task execution method. Figure 5 As shown, the device comprises:
[0098] A prompt word generation module 10, for generating a tool selection prompt word based on user input information, tool information of a pre-selected tool in a tool pool and a preset model work requirement;
[0099] A target tool determination module 11 is used to input the tool selection prompt word into a pre-built tool selection model to obtain output information, and determine the target tool from the pre-selected tools based on the output information;
[0100] The target tool calling module 12 is used to call the target tool so that the target tool executes the task to be executed corresponding to the user input information.
[0101] Based on any optional technical solution in the embodiment of the present invention, optionally, the tool information includes the name of the pre-selected tool and a tool selection example; the tool selection example includes the correspondence between the sample input information and the selected tool; the prompt word generation module 10 includes:
[0102] The tool selection prompt word generation submodule is used to generate tool selection prompt words based on user input information, name, tool selection example and model work requirements.
[0103] Based on any optional technical solution in the embodiment of the present invention, optionally, the target tool determination module 11 includes:
[0104] A task execution sequence value determination submodule, used to determine the task execution sequence values corresponding to each first subtask constituting the task to be executed based on the output information;
[0105] The target tool calling module 12 includes:
[0106] The target tool calling submodule is used to call the target tools corresponding to the task execution sequence values in order from small to large.
[0107] Based on any optional technical solution in the embodiments of the present invention, optionally, the target tool calls a submodule, including:
[0108] An input parameter determination unit, used to determine the input parameters and output parameters corresponding to each target tool;
[0109] The first module calling unit is used to call the target tools corresponding to the task execution sequence values in order from small to large when the input parameters and output parameters corresponding to the target tools meet the preset conditions;
[0110] The preset condition includes that, in each pair of adjacent target tools with adjacent task execution order values, the output parameter of the previous adjacent tool is associated with the input parameter of the next adjacent tool.
[0111] Based on any optional technical solution in the embodiments of the present invention, optionally, the following further includes:
[0112] a missing input parameter determination unit, configured to, after determining the input parameters and output parameters corresponding to each target tool, determine the missing input parameters corresponding to the target tool if the input parameters and output parameters corresponding to each target tool do not meet the preset conditions, and generate parameter query information based on the missing input parameters;
[0113] An information sending unit, used to send parameter query information to a user terminal, so as to obtain missing input parameters through feedback information from the user terminal;
[0114] The second module calling unit is used to call the target tools corresponding to the task execution order values in sequence based on the missing input parameters.
[0115] Based on any optional technical solution in the embodiment of the present invention, optionally, the target tool determination module 11 includes:
[0116] A second subtask determination submodule, used to determine the second subtask currently to be executed in the tasks to be executed based on the output information, and determine the selected tool corresponding to the second subtask as the target tool;
[0117] The target tool calling module 12 includes:
[0118] The sub-module for ending the task to be executed is used to call the target tool so that the target tool executes the second sub-task. When the sub-task execution result corresponding to the second sub-task does not match the final execution result corresponding to the task to be executed, the operation of determining the target tool in the pre-selected tools and executing the sub-task by calling the target tool is repeated until the current execution result obtained matches the final execution result, thereby ending the execution operation of the task to be executed.
[0119] Based on any optional technical solution in the embodiment of the present invention, optionally, the prompt word generating module 10 includes:
[0120] A first candidate tool determination submodule is used to determine at least one first candidate tool in the tool pool based on user input information, a preset recall method, and tool information of a tool pre-selected in a pre-built tool pool; wherein the preset recall method includes a word segmentation recall method and / or a semantic vector recall method;
[0121] The prompt word generation submodule is used to generate a tool selection prompt word based on user input information, first candidate information of the first candidate tool and model work requirements.
[0122] Based on any optional technical solution in the embodiments of the present invention, optionally, the prompt word generation submodule includes:
[0123] an information similarity determination unit, configured to determine, for each first candidate tool, the information similarity between the user input information and the first candidate information corresponding to the first candidate tool based on a pre-built semantic vector model;
[0124] A second candidate tool determining unit, configured to determine a second candidate tool from the first candidate tools based on a preset similarity threshold and each information similarity;
[0125] The prompt word generating unit is used to generate a tool selection prompt word based on user input information, the second candidate tool and the model work requirements.
[0126] Based on any optional technical solution in the embodiment of the present invention, optionally, the first candidate information includes tool description information corresponding to at least one description type; the preset similarity threshold includes a preset type similarity threshold corresponding to each tool description information; the information similarity includes description similarity between at least one tool description information and user input information;
[0127] The second candidate tool determination unit comprises:
[0128] The second candidate tool determination subunit is configured to determine, for each first candidate tool, when each description similarity is greater than a preset type similarity threshold corresponding to the description similarity, the first candidate tool as a second candidate tool.
[0129] The technical solution of the embodiment of the present invention generates tool selection prompt words based on user input information, tool information of pre-selected tools in a tool pool and pre-set model working requirements; the tool selection prompt words are input into a pre-built tool selection model. Since the tool selection prompt words include tool information and model working requirements, they can help the tool selection model to make decisions, and determine the target tool from the pre-selected tools through the output information of the tool selection model, thereby reducing the difficulty of determining the target tool from a large number of tools; it is beneficial to improve the accuracy of the determined target tool; and by calling the target tool, the task to be executed corresponding to the user input information is quickly and effectively executed, which can better meet user needs.
[0130] It is worth noting that in the embodiment of the above-mentioned task execution device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0131] Figure 6Schematic diagram of the structure of an electronic device that implements the task execution method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0132] like Figure 6 As shown, the electronic device 20 includes at least one processor 21, and a memory connected to the at least one processor 21, such as a read-only memory (ROM) 22, a random access memory (RAM) 23, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 21 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 22 or the computer program loaded from the storage unit 28 to the random access memory (RAM) 23. In RAM23, various programs and data required for the operation of the electronic device 20 can also be stored. The processor 21, ROM22 and RAM23 are connected to each other through a bus 24. An input / output (I / O) interface 25 is also connected to the bus 24.
[0133] A number of components in the electronic device 20 are connected to the I / O interface 25, including: an input unit 26, such as a keyboard, a mouse, etc.; an output unit 27, such as various types of displays, speakers, etc.; a storage unit 28, such as a disk, an optical disk, etc.; and a communication unit 29, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 29 allows the electronic device 20 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0134] The processor 21 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 21 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 21 executes the various methods and processes described above, such as a task execution method.
[0135] In some embodiments, the task execution method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 28. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 20 via the ROM 22 and / or the communication unit 29. When the computer program is loaded into the RAM 23 and executed by the processor 21, one or more steps of the task execution method described above may be performed. Alternatively, in other embodiments, the processor 21 may be configured to execute the task execution method in any other appropriate manner (e.g., by means of firmware).
[0136] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0137] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0138] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0139] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0140] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0141] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0142] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0143] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A task execution method, characterized in that: include: Generate tool selection prompt words based on user input information, tool information of pre-selected tools in the tool pool and pre-set model work requirements; Inputting the tool selection prompt word into a pre-built tool selection model to obtain output information, and determining a target tool from the pre-selected tools based on the output information; The target tool is called to enable the target tool to execute the task to be executed corresponding to the user input information.
2. The method according to claim 1, characterized in that The tool information includes the name of the pre-selected tool and a tool selection example; the tool selection example includes the correspondence between the sample input information and the selected tool; Generate tool selection prompts based on user input information, tool information of pre-selected tools in the tool pool, and pre-set model work requirements, including: The tool selection prompt is generated based on the user input information, the name, the tool selection example and the model work requirement.
3. The method according to claim 1, characterized in that The step of determining a target tool from among the pre-selected tools based on the output information comprises: Determine, based on the output information, a task execution order value corresponding to each first subtask constituting the task to be executed; taking the selected tool corresponding to each of the first subtasks as the target tool; The calling of the target tool so that the target tool executes the task to be executed corresponding to the user input information includes: Based on the order of the task execution sequence values from small to large, the target tools corresponding to the task execution sequence values are called in sequence.
4. The method according to claim 3, characterized in that The calling of target tools corresponding to the task execution sequence values in sequence from small to large based on the task execution sequence values includes: Determine the input parameters and output parameters corresponding to each of the target tools; When the input parameter and the output parameter corresponding to each target tool meet the preset conditions, the target tools corresponding to the task execution sequence values are called in sequence based on the order of the task execution sequence values from small to large; The preset condition includes that, in each pair of adjacent target tools with adjacent task execution order values, the output parameter of the previous adjacent tool is associated with the input parameter of the next adjacent tool.
5. The method according to claim 4, characterized in that After determining the input parameters and output parameters corresponding to each of the target tools, the method further includes: When the input parameters and the output parameters corresponding to each of the target tools do not meet the preset conditions, determining the missing input parameters corresponding to the target tools, and generating parameter query information based on the missing input parameters; Sending the parameter query information to the user terminal to obtain the missing input parameter through feedback information from the user terminal; Based on the missing input parameters, target tools corresponding to the task execution order values are called in sequence.
6. The method according to claim 1, characterized in that The step of determining a target tool from among the pre-selected tools based on the output information comprises: Determine a second subtask currently to be executed in the tasks to be executed based on the output information, and determine a selected tool corresponding to the second subtask as the target tool; The calling of the target tool so that the target tool executes the task to be executed corresponding to the user input information includes: Invoking the target tool to enable the target tool to perform the second subtask; When the subtask execution result corresponding to the second subtask does not match the final execution result corresponding to the task to be executed, repeat the operation of determining the target tool from the pre-selected tools and executing the subtask by calling the target tool until the current execution result matches the final execution result, thereby terminating the execution operation of the task to be executed.
7. The method according to claim 1, characterized in that The generating of tool selection prompt words based on user input information, tool information of pre-selected tools in the tool pool and pre-set model work requirements includes: Based on the user input information, the preset recall method and the tool information of the pre-selected tool in the pre-built tool pool, at least one first candidate tool is determined in the tool pool; wherein the preset recall method includes a word segmentation recall method and / or a semantic vector recall method; The tool selection prompt word is generated based on the user input information, the first candidate information of the first candidate tool and the model work requirement.
8. The method according to claim 7, characterized in that The generating the tool selection prompt word based on the user input information, the first candidate information of the first candidate tool and the model work requirement includes: For each of the first candidate tools, determining the information similarity between the user input information and the first candidate information corresponding to the first candidate tool based on a pre-built semantic vector model; Based on a preset similarity threshold and each of the information similarities, determining a second candidate tool from the first candidate tools; The tool selection prompt is generated based on the user input information, the second candidate tool and the model work requirement.
9. The method according to claim 8, characterized in that The first candidate information includes tool description information corresponding to at least one description type; the preset similarity threshold includes a preset type similarity threshold corresponding to each of the tool description information; the information similarity includes a description similarity between at least one of the tool description information and the user input information; The determining of a second candidate tool from the first candidate tools based on a preset similarity threshold and each of the information similarities includes: For each of the first candidate tools, when each of the description similarities is greater than a preset type similarity threshold corresponding to the description similarity, the first candidate tool is determined as the second candidate tool.
10. A task execution device, characterized in that: include: A prompt word generation module, used for generating a tool selection prompt word based on user input information, tool information of a pre-selected tool in a tool pool and a pre-set model work requirement; A target tool determination module, used for inputting the tool selection prompt word into a pre-built tool selection model to obtain output information, and determining a target tool from the pre-selected tools based on the output information; The target tool calling module is used to call the target tool so that the target tool executes the task to be executed corresponding to the user input information.
11. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the task execution method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the task execution method according to any one of claims 1 to 9 when executed.
Citation Information
Cited By
Device and method for task-driven semantic communication, and program product
WO2026189310A1
