A task execution method, device and equipment for a large model intelligent agent
By using pending data, business process prompt words and special request prompt words in the big model agent, the call of task tools is solved, and the randomness and uncontrollability of task execution is improved, and the accuracy and controllability of task execution are improved.
Patent Information
- Application Number
- CN202411282482.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-09-13
AI Technical Summary
Large model agents have randomness and uncontrollability when executing tasks, resulting in low accuracy in task execution.
By obtaining the pending data, business process prompt words and special request prompt words, input them into the big model, obtain the output results of the task tool, and update the input data through the intermediate prompt words until the final result is obtained, controllability of the task tool calls is achieved.
It improves the accuracy and controllability of large-scale agents when performing tasks, ensuring that the call of task tools meets business process requirements.
Smart Images

Figure CN118886445B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a task execution method, device and equipment for a large-model intelligent agent. Background Art
[0002] A big model agent refers to an application framework based on a big model that has the ability to plan, think, remember, and use tools, and can autonomously complete a given task. The big model can be a generative language processing model such as a big language model or a multimodal model. The core of the agent is to use big models as general problem solvers and connect them with external resources to complete tasks.
[0003] At present, when large-model intelligent agents perform tasks, they generally decide autonomously what task tools to call to perform the corresponding tasks. This is highly random and uncontrollable, which results in low accuracy in the results of the large-model intelligent agents performing tasks.
[0004] Therefore, how to control the task execution process of large model intelligent agents is an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present application provide a task execution method, device and equipment for a large-model intelligent agent, so as to solve the problem in the prior art that the large-model intelligent agent calls tools to execute tasks with high randomness and uncontrollability.
[0006] In a first aspect, the present application provides a task execution method for a large model agent, the method comprising:
[0007] Acquire the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when acquiring the input data including the first preset content;
[0008] The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtains the output result of the task tool called by the large model;
[0009] If the output result is not the final result, the large model agent determines the intermediate prompt word containing the output result, uses the intermediate prompt word to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained.
[0010] In a second aspect, the present application provides a task execution device for a large model intelligent agent, the device comprising:
[0011] An acquisition module, used to acquire data to be processed, business process prompt words saved for the task type corresponding to the data to be processed, and special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when acquiring the input data including the first preset content;
[0012] A processing module is used for the large model agent to input the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtain the output result of the task tool called by the large model; if the output result is not the final result, the large model agent determines the intermediate prompt words containing the output result, uses the intermediate prompt words to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained.
[0013] In a third aspect, the present application also provides an electronic device, comprising a processor, wherein the processor is used to implement the steps of the task execution method of the large model intelligent agent as described above when executing a computer program stored in a memory.
[0014] In a fourth aspect, the present application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the task execution method of any large model intelligent agent as described above.
[0015] Because in the embodiment of the present application, the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words are obtained and input into the big model as input data, so that when the big model obtains the input data including the first preset content, it calls the task tool according to the requirements of the input data, and obtains the output result of the task tool called by the big model. If the output result is not the final result, the big model agent determines the intermediate prompt words containing the output result, and uses the intermediate prompt words as the latest input data, and continues to execute the step of inputting the input data into the big model. By inputting the special requirement prompt words, the task tool called when the big model executes the task is controlled, thereby realizing the controllability of the task tool calling of the big model agent during the task execution, thereby improving the accuracy of task execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A flowchart of a task execution process of a large model agent provided in an embodiment of the present application;
[0018] Figure 2 A task tool calling diagram provided in an embodiment of the present application;
[0019] Figure 3 A schematic diagram of a task execution process provided in an embodiment of the present application;
[0020] Figure 4 A schematic diagram of the structure of a task execution device for a large model intelligent agent provided in an embodiment of the present application;
[0021] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiment is only a part of the embodiment 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 belong to the scope of protection of this application.
[0023] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0024] It should be noted that the terms "including" and "having" and their variations involved in the documents of this application 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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] The terms "first" and "second" in this document are used for descriptive purposes only and should not be understood as explicitly or implicitly indicating relative importance or implicitly indicating the number of technical features indicated. Therefore, features defined as "first" and "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0026] The word “exemplary” is used hereinafter to mean “serving as an example, example, or illustration.” Any embodiment described as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0027] The embodiment of the present application provides a task execution method, device and equipment for a large model intelligent agent, in which the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words are obtained; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when the input data including the first preset content is obtained; the large model intelligent agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtains the output result of the task tool called by the large model; if the output result is not the final result, the large model intelligent agent determines the intermediate prompt words containing the output result, uses the intermediate prompt words to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained. Using the large model as the intelligent agent decision-making subject, the business process logic is integrated into the development of the prompt words and task tools of the large model, so that the large model intelligent agent can follow the business process to the greatest extent during the execution of the intelligent agent strategy, and call the corresponding task tool to realize the business output, meeting the requirements of the actual business scenario. The following is an explanation in conjunction with each embodiment.
[0028] It should be noted that the descriptions with {} in the following embodiments of the present application indicate that the contents therein are variable contents and can be modified according to task requirements.
[0029] Figure 1 A flowchart of a task execution process of a large model agent provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the process includes the following steps:
[0030] S101: Obtain data to be processed, business process prompt words saved for the task type corresponding to the data to be processed, and special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when obtaining the input data including the first preset content.
[0031] The task execution method of the large model intelligent agent provided in the present application is applied to an electronic device, which may be a server, a PC, a mobile terminal, etc.
[0032] In an embodiment of the present application, when an electronic device performs a task, it can obtain data to be processed. The data to be processed can be input by a user, sent by other electronic devices connected to the electronic device, or obtained by the electronic device from a preset storage location. The specific content of the data to be processed is determined by the task to be performed. If the task to be performed is a text-to-SQL (Text2SQL) task, then the data to be processed can be "query the number of drivers in Qingdao". If the task to be performed is a writing task, then the data to be processed can be "write an essay about spring". The embodiment of the present application does not limit the task types of executable tasks.
[0033] Since electronic devices can perform tasks of different task types, and tasks of different task types require different operations performed by the large model, in an embodiment of the present application, different business process prompts can be saved in advance for different task types. Exemplarily, for the task type Text2SQL, the saved business process prompt can be "Convert the following question into a corresponding database query statement, first perform a similar text search, then perform intent recognition, and finally generate an SQL statement. Convert the sentence '{question}' into a corresponding SQL query statement or reply by calling an external tool. If there is no corresponding SQL, output a non-final result."
[0034] In the embodiment of the present application, after the data to be processed is obtained, in order to enable the large model to execute the corresponding task, the business process prompt words saved for the task type corresponding to the data to be processed can be obtained. The task type corresponding to the data to be processed can be determined by semantic analysis of the data to be processed after the data to be processed is obtained, or can be input together with the data to be processed when the user inputs the data to be processed.
[0035] In order to control the task tool called by the large model, in an embodiment of the present application, a special requirement prompt word can also be obtained. The special requirement prompt word is used to prompt the large model to call the task tool according to the requirements of the input data when it obtains the input data including the first preset content. In other words, by inputting the special requirement prompt word, the calling of the task tool by the large model is controlled. Exemplarily, the special requirement prompt word can be "When the next step of calling the tool appears, please be sure to call the corresponding tool", where "the next step of calling the tool" can be understood as the first preset content. In other words, the first preset content is the text requiring the tool to be called.
[0036] S102: The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtains the output result of the task tool called by the large model.
[0037] After obtaining the data to be processed, the business process prompt words and the special requirement prompt words, the large model agent can splice the data to be processed, the business process prompt words and the special requirement prompt words to obtain the input data. When splicing, the splicing can be performed in any order. After obtaining the input data, the input data can be input into the large model, so that the large model calls the corresponding task tool according to the business processing requirements, and obtains the output result of the task tool called by the large model. Exemplarily, the output result can be "the current task has been completed, and the next step is to continue to call the {intention analysis} tool", "no need to continue to call other tools, directly output the current result: AAAA", "the SQL statement determined based on the input is: BBBB". In an embodiment of the present application, the output of each task tool can be rewritten in advance, and the calling order between different task tools can be configured according to the execution process of tasks of different task types. Among them, the large model can be a generative language processing model such as a large language model and a multimodal model.
[0038] The core parts of the big model agent application include big models, task tools, and agent implementation strategy frameworks. Among them, the big model can choose specific open source models or commercial models according to business needs. Task tools need to describe the task tools and develop and encapsulate the implementation logic according to business scenario requirements. The implementation framework of the big model agent strategy body can be a multi-agent strategy framework or a single-agent strategy framework.
[0039] S103: If the output result is not the final result, the large model agent determines the intermediate prompt word containing the output result, uses the intermediate prompt word to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained.
[0040] After obtaining the output result of the task tool called by the large model, it can be determined whether the output result is the final result. The final result can be understood as the result output by the theoretical last task tool in the task execution process of the corresponding task type. In an embodiment of the present application, the information of the last task tool in the task execution process can be saved in advance for different task types. After obtaining the output result, it can be determined whether the task tool required to be called in the previous output result of the output result is the last task tool based on the information of the last task tool. In an embodiment of the present application, the output result obtained may also include the identification information of the corresponding task tool, such as the name of the task tool, that is, the identification information of the corresponding task tool is output together when the output result of each task tool is output. So as to facilitate the subsequent determination of whether the output result is the result output by the last task tool based on the identification information and the information of the last task tool saved in advance, thereby determining whether the output result is the final result.
[0041] If it is determined that the output result is not the final result, the large model agent can determine the intermediate prompt word containing the output result, and use the intermediate prompt word to update the input data, and continue to perform the step of inputting the input data into the large model until the final result is obtained. When the large model agent determines the intermediate prompt word, it can directly input the output result into the large model so that the large model continues to perform corresponding operations based on the output result, or it can splice the output result with other prompt words and input them into the large model.
[0042] Because in the embodiment of the present application, the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words are obtained and input into the big model as input data, so that when the big model obtains the input data including the first preset content, it calls the task tool according to the requirements of the input data, and obtains the output result of the task tool called by the big model. If the output result is not the final result, the big model agent determines the intermediate prompt words containing the output result, and uses the intermediate prompt words as the latest input data, and continues to execute the step of inputting the input data into the big model. By inputting the special requirement prompt words, the task tool called when the big model executes the task is controlled, thereby realizing the controllability of the task tool calling of the big model agent during the task execution, thereby improving the accuracy of task execution.
[0043] In order to further improve the accuracy of the task execution of the large model agent, on the basis of the above embodiment, in the embodiment of the present application, if the output result includes the first preset content and the task tool to be called, the large model agent determines that the intermediate prompt words containing the output result include:
[0044] The large model agent concatenates the input data and the output result to obtain the intermediate prompt word.
[0045] In an embodiment of the present application, if the output result of the task tool called by the large model includes the first preset content and the task tool to be called, it means that the current task has not been completed and other task tools need to be called to continue to complete the task. When the large model agent determines the intermediate prompt word containing the output result, it can splice the previous input data and the obtained output result to obtain the intermediate prompt word. Since the output result includes the first preset content and the task tool to be called, after receiving the input data, the large model can call the task tool according to the requirements of the special requirement prompt word and the requirements of the input data, thereby realizing the controllability of the large model agent task tool call.
[0046] Specifically, if the output result is "{Intent recognition} has been completed, the next step must be to call the [{Text_to_SQL}] tool", it can be determined that the output result includes the first preset content and the task tool to be called. The large model intelligent agent can splice the previous input data and the output result to obtain the intermediate prompt word.
[0047] In order to further improve the accuracy of the large model agent task execution, on the basis of the above embodiments, in the embodiment of the present application, before the large model agent splices the input data and the output result, the method further includes:
[0048] The large model agent obtains the standard input requirements saved for the task tool to be called;
[0049] The output result is adjusted according to the standard input requirement.
[0050] Since different task tools are independent individuals, different task tools can independently implement their own different tasks, and the calling order between different task tools is determined according to the received data to be processed. This results in that when multiple task tools are combined to implement a certain task, the output result of the previous task tool is not the standard input of the next task tool. If the non-standard data is input into the next task tool, the task tool will not be able to correctly perform the relevant tasks, thereby obtaining an erroneous task execution result. For example, if the input format is wrong or the parameters are incorrect, the output result of the previous task tool must be corrected to ensure the normal progress of the task processing flow. In an embodiment of the present application, before the large model intelligent agent splices the input data and the output result, it can also obtain the standard input requirements saved for the task tool to be called, so as to adjust the output result according to the standard input requirements. For example, the format of the output result is adjusted, or the keywords of the output result are adjusted.
[0051] Specifically, assuming that task tool A is called after task tool B, the format corresponding to the annotation input requirements of task tool A is:
[0052] .
[0053] Since the keyword "utterance" does not exist in the standard input requirements of task tool A, after obtaining the output results of task tool B, the output results can be adjusted according to the standard input requirements. When making adjustments, "utterance" can be replaced with "input_text". The adjusted output results are:
[0054] .
[0055] In order to further improve the accuracy of task execution of the large model agent, on the basis of the above embodiments, in the embodiment of the present application, if the output result does not include the first preset content and the task tool to be called, the large model agent determines that the intermediate prompt words containing the output result include:
[0056] The large model agent concatenates the output result and the forced output prompt word to obtain the intermediate prompt word. The forced output prompt word is used to prompt the large model not to call other task tools and determine the output result as the final result.
[0057] If the output result of the task tool obtained is not the final result, and the output result does not include the first preset content and the task tool to be called, it means that the judgment made by the task tool is that no tool call is needed next, and the output result can be directly output. Then, when the large model agent determines the intermediate prompt word containing the output result, the output result and the forced output prompt word can be spliced to obtain the intermediate prompt word. The forced output prompt word is used to prompt the large model to no longer call other task tools and determine the output result as the final result. Exemplarily, the forced output prompt word can be "no need to call other tools, directly output the result". If the output result is not spliced with the forced output prompt word, the large model is likely to call other task tools because this is not the output result output by the last task tool in theory, thereby obtaining an erroneous task execution result. In an embodiment of the present application, when the output result does not include the first preset content and the task tool to be called, the output result is spliced with the forced output prompt word and input into the large model, which is equivalent to forcibly terminating the task execution, controlling that other task tools are no longer called, and improving the accuracy of task execution.
[0058] In order to further improve the accuracy of large model agent task execution, based on the above embodiment, in the embodiment of the present application, the method further includes:
[0059] Output the prompt information of the abnormal data to be processed.
[0060] Since the output is forced when it is not the final result, it is likely caused by the abnormality of the data to be processed. For example, the function that the data to be processed needs to implement is not a capability possessed by the large model of the large model agent. Therefore, in an embodiment of the present application, if the output result does not include the first preset content and the task tool to be called, a prompt message of the abnormality of the data to be processed can also be output. Exemplarily, the prompt message can be "Sorry, the current question is not supported. Currently, only some database tables are supported for query. You can ask other questions or change the way you say it." In an embodiment of the present application, the large model agent can directly output the prompt message, or it can input the prompt message into the large model according to the set format and output it by the large model.
[0061] Specifically, the prompt information can be input into the large model as follows:
[0062] .
[0063] In order to further improve the accuracy of task execution of the large model agent, on the basis of the above embodiments, in the embodiment of the present application, the process of determining whether the output result is the final result includes:
[0064] If the output result includes the second preset content, the output result is determined to be the final result.
[0065] In order to determine whether the output result is the final result, in an embodiment of the present application, a second preset content can be pre-configured, and the second preset content can be any content that indicates that the task has been completed. For example, the second preset content can be the tool name of the last task tool called to theoretically complete the corresponding task, or it can be a prompt message that "this output is the final result", or it can be the content required in the corresponding data to be processed. For example, if the data to be processed requires the generation of an SQL statement, then the second preset content can be an SQL statement. Exemplarily, when the data to be processed requires the generation of an SQL statement, if the output result includes a complete SQL statement, it can be determined that the output result is the final result.
[0066] In order to further improve the accuracy of task execution of the large model agent, based on the above embodiment, in the embodiment of the present application, before the large model agent inputs the data to be processed, the business process prompt word and the special requirement prompt word as input data into the large model, the method further includes:
[0067] Obtaining a functional description of each task tool stored for the task type;
[0068] The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, including:
[0069] The large model intelligent agent inputs the data to be processed, the business process prompt words, the special requirement prompt words and each functional description into the large model as input data, so that the large model determines the task tool to be called based on each functional description when calling the task tool for the first time for the data to be processed.
[0070] In order to make the big model understand the function of each task tool and the range of task tools that can be used, and to reasonably call the task tool when processing the data to be processed for the first time, in the embodiment of the present application, before inputting the input data into the big model, the function description of each task tool saved for the task type corresponding to the data to be processed can also be obtained. When the big model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the big model, each function description can be input into the big model together, so that the big model determines the task tool to be called based on each function description when calling the task tool for the data to be processed for the first time.
[0071] Specifically, for the task tool similar_text_search, this task tool is used to retrieve relevant text from the database for a given text. For the task execution process output, when there is a corresponding search result in the Retrieval-augmented Generation (RAG) library, the output result is "no need to call other tools, directly output the intermediate result [{tool output}]"; otherwise, the output result is "similar text retrieval has been completed, and the intent_detection tool must be called in the next step".
[0072] For the task tool of intent detection (intent_detection), the function of this task tool is to judge the user's intention based on the user's input text. For the task execution process output, it is determined whether the user's input is the intention to query the database. If it is not a database query, the output result is "no need to call other tools, directly output the intermediate result [{tool output}]"; otherwise, the output result is "intent recognition has been completed, and the next step must be to call the Text_to_SQL tool".
[0073] For the task tool Text_to_SQL, the function of this task tool is to generate SQL statements for querying the database based on the text, that is, to execute the logic of text-to-SQL and call the large model to output the corresponding SQL statements.
[0074] The output result of the task tool is described below with reference to a specific embodiment. Figure 2 A task tool calling diagram provided in an embodiment of the present application is shown in FIG. Figure 2 The following is an example of the Text2SQL task. Figure 2 As shown in the figure, when the large model agent processes data of the Text2SQL task type, it can call three task tools, namely similar text query, intent detection, and text to SQL.
[0075] When executing a task, first call the similar text query task tool to perform similar question retrieval, and determine whether a matching result is retrieved. If so, output the output result "No need to call other tools, directly output the intermediate result [{retrieval result}]", and then perform other operations based on the retrieval result. If no matching result is retrieved, output the output result "Similar text retrieval has been completed, and the intent detection tool must be called in the next step".
[0076] If the intent detection task tool is determined to be called based on the output results of similar text queries, the intent detection tool is called and the intent recognition of the data to be processed is performed. If the intent recognition result is a text-to-SQL intent, that is, a database query intent, the output result may be "intent recognition has been completed, and the text-to-SQL tool must be called in the next step." If the intent recognition result is not a database query intent, the output result may be "no need to call other tools, directly output the intermediate result [identified intent}]."
[0077] If it is determined to call the text-to-SQL task tool based on the output result of the intent detection, the text-to-SQL tool is called to convert the data to be processed into SQL statements.
[0078] In order to further improve the accuracy of task execution of the large model agent, based on the above embodiment, in the embodiment of the present application, before the large model agent inputs the data to be processed, the business process prompt word and the special requirement prompt word as input data into the large model, the method further includes:
[0079] Get the thought prompt words saved for the preset thought chain type;
[0080] The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, including:
[0081] The large model intelligent agent inputs the data to be processed, the business process prompt words, the special requirement prompt words and the thinking prompt words as input data into the large model. The thinking prompt words are used to prompt the large model to process the data to be processed and the business process prompt words according to the processing requirements in the thinking prompt words.
[0082] In order to further improve the accuracy of task execution of large model intelligent agents, in the embodiment of the present application, thought prompts corresponding to different thought chain types can be pre-saved, so that when the large model executes the corresponding task, it can perform better processing of the data to be processed based on the processing requirements of the thought prompts. Among them, the preset thought chain type can be Reason and Action (ReAct), or Plan-and-Execute, and of course other thought chain types, which can be configured as needed by technicians in this field. Among them, ReAct is a technology that combines reasoning and action with language models to solve various language reasoning and decision-making tasks. ReAct is equivalent to a few sample prompts (prompt) + Thought + Action + Observation. It is a commonly used prompt structure when calling tools, reasoning and planning. It first reasons and then executes. It executes a specific Action according to the environment and gives the thinking process Thought. Plan-and-Execute is mainly composed of two basic components: Planner and Executor. Among them, Planner is used to prompt the Large Language Model (LLM) to generate a multi-step plan to complete a large task. Executor is used to accept user queries and steps in the plan, and call one or more tools to complete the task. Once the execution is completed, the agent will be called again and issued a re-plan prompt, allowing it to decide whether to complete the response or whether to generate a subsequent plan (if the first plan does not achieve the expected effect).
[0083] In the process of business application, the large model agent generally needs to design and develop application tools according to the business process, select the agent strategy implementation framework and the large model for application development, and the technicians in this field can pre-configure the thinking chain type for saving thinking prompts as needed. Among them, the thinking prompts saved for the preset thinking chain type can be the original prompts provided in the relevant technology, and the embodiment of the present application does not limit this, and the technicians in this field can configure it as needed.
[0084] The task execution process of the large model agent is described below with reference to a specific embodiment. Figure 3 A schematic diagram of a task execution process provided in an embodiment of the present application, Figure 3 The Text2SQL task is used as an example for explanation. When the large model agent performs any task, it can obtain business process prompts. The task process prompts are saved for the task type corresponding to the data to be processed. The task process prompts can be "Convert the following question into the corresponding database query statement, first perform similarity text retrieval, then perform intent recognition, and finally generate SQL statements." At the same time, it can obtain special requirement prompts, which can be "When the next step of calling the tool appears, please be sure to call the corresponding tool."
[0085] After obtaining the business process prompt words and the special requirement prompt words, the data to be processed, the business process prompt words and the special requirement prompt words may be concatenated to obtain input data.
[0086] After obtaining the input data, determine whether the input data requires the output of a non-final result. If not, input the input data into the large model to obtain the output result of the task tool called by the large model. If the output result is the final result, it can be further determined whether the final result is the output result of any intermediate task tool. If so, output a prompt message indicating that the data to be processed is abnormal; if not, that is, the final result is the output result of the last task tool in theory, then the output result can be directly output. If the output result obtained is a non-final result, adjust the output result according to the standard input requirements. Concatenate the adjusted output result with the input data to obtain an intermediate prompt word, and use the intermediate prompt word to update the input data to obtain the latest input data, and continue to execute the step of determining whether the input data requires the output of a non-final result.
[0087] If the input data requires the output of a non-final result, the input data is concatenated with the mandatory output prompt word to obtain the latest input data, which is then input into the large model to obtain the final result. If the output result included in the input data is a non-final result, and the output result does not include the first preset content and the task tool to be called, it can be considered that the input data requires the output of a non-final result.
[0088] In an embodiment of the present application, a local large model reasoning service can be constructed according to the LLM method of langchain, including the configuration of various parameters of the large model, the output of prompt words and the output of results. This service is mainly used to call the large model during each step of the strategy execution of the large model agent.
[0089] During the development and packaging process of the task tool, the output part of this application is designed and developed according to the business process to solve the problem of downstream tool connection of a single task tool; the improved design of prompt words and the logical processing before and after large model reasoning solve the problem of unstable calling of task tools by large model intelligent entities and failure to call tools according to business processes, and reduces the number of overall large model execution calls, thereby reducing the overall execution time of the large model intelligent entity and improving execution efficiency.
[0090] The large-model intelligent entity combined with business processes constructed in this application can improve the large-model intelligent entity's compliance with business processes in handling business, and can call corresponding task tools according to business processes to achieve business output, thereby generally improving the controllability of the large-model intelligent entity's calls to business tools.
[0091] Based on the same inventive concept, the embodiment of the present application also provides a task execution device for a large model intelligent agent, Figure 4 A schematic diagram of the structure of a task execution device for a large model agent provided in an embodiment of the present application, the device comprising:
[0092] The acquisition module 401 is used to acquire the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when acquiring the input data including the first preset content;
[0093] Processing module 402 is used for the large model agent to input the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtain the output result of the task tool called by the large model; if the output result is not the final result, the large model agent determines the intermediate prompt words containing the output result, uses the intermediate prompt words to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained.
[0094] In a possible implementation, if the output result includes the first preset content and the task tool to be called, the processing module 402 is specifically used for the large model agent to splice the input data and the output result to obtain the intermediate prompt word.
[0095] In a possible implementation, the processing module 402 is also used for the large model agent to obtain standard input requirements saved for the task tool to be called; and adjust the output result according to the standard input requirements.
[0096] In a possible implementation, if the output result does not include the first preset content and the task tool to be called, the processing module 402 is specifically used for the large model agent to splice the output result and the forced output prompt word to obtain the intermediate prompt word, and the forced output prompt word is used to prompt the large model not to call other task tools and determine the output result as the final result.
[0097] In a possible implementation, the processing module 402 is further configured to output prompt information indicating that the data to be processed is abnormal.
[0098] In a possible implementation, the processing module 402 is specifically configured to determine that the output result is a final result if the output result includes second preset content.
[0099] In a possible implementation, the acquisition module 401 is further used to acquire a functional description of each task tool saved for the task type;
[0100] The processing module 402 is specifically used for the large model agent to input the data to be processed, the business process prompt words, the special requirement prompt words and each of the functional descriptions as input data into the large model, so that when the large model calls the task tool for the first time for the data to be processed, it determines the task tool to be called based on each of the functional descriptions.
[0101] In a possible implementation, the acquisition module 401 is further used to acquire thought prompt words saved for a preset thought chain type;
[0102] The processing module 402 is specifically used for the large model intelligent body to input the data to be processed, the business process prompt words, the special requirement prompt words and the thinking prompt words as input data into the large model, and the thinking prompt words are used to prompt the large model to process the data to be processed and the business process prompt words according to the processing requirements in the thinking prompt words.
[0103] Based on the same inventive concept, an embodiment of the present application further provides an electronic device, Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, it includes: a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504;
[0104] The memory 503 stores a computer program. When the program is executed by the processor 501, the processor 501 performs the following steps:
[0105] Acquire the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when acquiring the input data including the first preset content;
[0106] The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtains the output result of the task tool called by the large model;
[0107] If the output result is not the final result, the large model agent determines the intermediate prompt word containing the output result, uses the intermediate prompt word to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained.
[0108] In a possible implementation manner, if the output result includes the first preset content and the task tool to be called, the large model agent determines that the intermediate prompt words containing the output result include:
[0109] The large model agent concatenates the input data and the output result to obtain the intermediate prompt word.
[0110] In a possible implementation manner, before the large model agent splices the input data and the output result, the method further includes:
[0111] The large model agent obtains the standard input requirements saved for the task tool to be called;
[0112] The output result is adjusted according to the standard input requirement.
[0113] In a possible implementation manner, if the output result does not include the first preset content and the task tool to be called, the large model agent determines that the intermediate prompt words containing the output result include:
[0114] The large model agent concatenates the output result and the forced output prompt word to obtain the intermediate prompt word. The forced output prompt word is used to prompt the large model not to call other task tools and determine the output result as the final result.
[0115] In a possible implementation, the method further includes:
[0116] Output the prompt information of the abnormal data to be processed.
[0117] In a possible implementation, the process of determining whether the output result is a final result includes:
[0118] If the output result includes the second preset content, the output result is determined to be the final result.
[0119] In a possible implementation manner, before the large model agent inputs the to-be-processed data, the business process prompt words and the special requirement prompt words as input data into the large model, the method further includes:
[0120] Obtaining a functional description of each task tool stored for the task type;
[0121] The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, including:
[0122] The large model intelligent agent inputs the data to be processed, the business process prompt words, the special requirement prompt words and each functional description into the large model as input data, so that the large model determines the task tool to be called based on each functional description when calling the task tool for the first time for the data to be processed.
[0123] In a possible implementation manner, before the large model agent inputs the to-be-processed data, the business process prompt words and the special requirement prompt words as input data into the large model, the method further includes:
[0124] Get the thought prompt words saved for the preset thought chain type;
[0125] The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, including:
[0126] The large model intelligent agent inputs the data to be processed, the business process prompt words, the special requirement prompt words and the thinking prompt words as input data into the large model. The thinking prompt words are used to prompt the large model to process the data to be processed and the business process prompt words according to the processing requirements in the thinking prompt words.
[0127] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 502 is used for communication between the above electronic device and other devices. The memory may include a random access memory (RAM) and may also include a non-volatile memory (NVM), such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0128] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processing processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0129] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program executable by a processor. When the program runs on the processor, the processor implements the steps of the task execution method of the large model intelligent agent described in the above embodiments.
[0130] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0131] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0132] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0134] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A task execution method for a large model agent, characterized in that: The method comprises: Acquire the data to be processed, the business process prompt words saved for the task type corresponding to the data to be processed, and the special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when acquiring the input data including the first preset content; The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, and obtains the output result of the task tool called by the large model; If the output result is not a final result, the large model agent determines an intermediate prompt word containing the output result, uses the intermediate prompt word to update the input data, and continues to perform the step of inputting the input data into the large model until a final result is obtained; If the output result includes the first preset content and the task tool to be called, the large model agent determines that the intermediate prompt words containing the output result include: The large model agent concatenates the input data and the output result to obtain the intermediate prompt word.
2. The method according to claim 1, characterized in that Before the large model agent splices the input data and the output result, the method further includes: The large model agent obtains the standard input requirements saved for the task tool to be called; The output result is adjusted according to the standard input requirement.
3. The method according to claim 1, characterized in that If the output result does not include the first preset content and the task tool to be called, the large model agent determines that the intermediate prompt words containing the output result include: The large model agent concatenates the output result and the forced output prompt word to obtain the intermediate prompt word. The forced output prompt word is used to prompt the large model not to call other task tools and determine the output result as the final result.
4. The method according to claim 3, characterized in that The method further comprises: Output the prompt information of the abnormal data to be processed.
5. The method according to any one of claims 1 to 4, characterized in that: The process of determining whether the output result is a final result includes: If the output result includes the second preset content, the output result is determined to be the final result.
6. The method according to claim 1, characterized in that Before the large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, the method further includes: Obtaining a functional description of each task tool stored for the task type; The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, including: The large model intelligent agent inputs the data to be processed, the business process prompt words, the special requirement prompt words and each functional description into the large model as input data, so that the large model determines the task tool to be called based on each functional description when calling the task tool for the first time for the data to be processed.
7. The method according to claim 1, characterized in that Before the large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, the method further includes: Get the thought prompt words saved for the preset thought chain type; The large model agent inputs the data to be processed, the business process prompt words and the special requirement prompt words as input data into the large model, including: The large model intelligent agent inputs the data to be processed, the business process prompt words, the special requirement prompt words and the thinking prompt words as input data into the large model. The thinking prompt words are used to prompt the large model to process the data to be processed and the business process prompt words according to the processing requirements in the thinking prompt words.
8. A task execution device for a large model intelligent agent, characterized in that: The device comprises: An acquisition module, used to acquire data to be processed, business process prompt words saved for the task type corresponding to the data to be processed, and special requirement prompt words; wherein the special requirement prompt words are used to prompt the large model to call the task tool according to the requirements of the input data when acquiring the input data including the first preset content; A processing module, used for the large model agent to input the data to be processed, the business process prompt word and the special requirement prompt word as input data into the large model, and obtain the output result of the task tool called by the large model; if the output result is not a final result, the large model agent determines an intermediate prompt word containing the output result, uses the intermediate prompt word to update the input data, and continues to execute the step of inputting the input data into the large model until the final result is obtained; If the output result includes the first preset content and the task tool to be called, the processing module is specifically used for the large model intelligent agent to splice the input data and the output result to obtain the intermediate prompt word.
9. An electronic device, characterized in that: The electronic device comprises a processor, and the processor is used to implement the steps of the task execution method of the large model intelligent agent as described in any one of claims 1 to 7 when executing the computer program stored in the memory.
Citation Information
Patent Citations
Task execution method and device, equipment, medium and program product
CN118193754A