Task Processing Method and Device Based on a Tool Model
Through the task processing method based on the tool model, user input instructions are automatically processed, tool search, information extraction and call are realized, which solves the limitations on the task type and number of tools of the existing system, and improves the system's adaptability and user experience.
Patent Information
- Application Number
- CN202311147384.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2043-09-06
AI Technical Summary
In the prior art, task processing systems based on large language models have "AI illusion" when actual business is implemented, that is, they produce smooth but unrealistic responses, and are limited by the multi-model construction and the number of preset tools, which affects the user experience freedom.
Using a task processing method based on the tool model, the user input instructions are obtained through pre-set task instructions, and work tasks are constructed, including tool search, information extraction and tool calls, and the call results are automatically generated without manually writing external interface calling programs.
It breaks through the limitations of task types and tools in traditional systems, improves the system's adaptability to different tasks and the generalization of tool use, and enhances user experience freedom.
Smart Images

Figure CN118427318B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer software technology, and in particular to a task processing method and device based on a tool model. Background Art
[0002] Currently, large language models trained with large amounts of text data have proven to have capabilities that surpass the training data itself, achieving significant improvements in classic natural language processing tasks such as question-answering and conversation. However, in actual business implementation, "AI hallucinations" still occur, whereby a coherent text response is generated during task processing, but the response does not conform to real-world logic.
[0003] The current mitigation methods mainly use multiple different models to build a dialogue system, and use each model to perform corresponding processing tasks, such as user intent judgment and user input information structuring, or use pre-written external interfaces to call external tools. This limits the processing of only preset task types and the use of pre-prepared tools, thus affecting the user experience freedom. Summary of the Invention
[0004] In view of this, the present application proposes a task processing method and device based on a tool model to solve the above problems.
[0005] On the one hand, this application proposes a task processing method based on a tool model, comprising the following steps:
[0006] Get user input instructions;
[0007] Using pre-set task instructions, constructing the corresponding work tasks of the tool model based on the user input instructions;
[0008] Execute the work task to call the tool and generate the tool call result;
[0009] Outputting the tool calling result;
[0010] The task instructions include tool search instructions, information extraction instructions and tool calling instructions.
[0011] As an optional implementation scheme of the present application, optionally, a pre-set task instruction is used to construct a work task corresponding to the tool model based on the user input instruction, including:
[0012] Searching for pre-screening tool information matching the user input instruction according to the tool search instruction;
[0013] Extracting entity information matching the user input instruction according to the pre-screening tool information and the information extraction instruction;
[0014] Compile a tool calling code according to the tool calling instruction and the entity information.
[0015] As an optional implementation scheme of the present application, optionally, when executing the work task, calling the tool and generating the tool calling result, it is implemented based on the written tool calling code.
[0016] As an optional implementation scheme of the present application, optionally, extracting entity information matching the user input instruction includes:
[0017] Determining whether the entity information meets corresponding preset requirements;
[0018] When the entity information is insufficient, the step of obtaining the user input instruction is entered again.
[0019] As an optional implementation scheme of the present application, optionally, after writing the tool calling code according to the tool calling instruction and the entity information, the method further includes:
[0020] The tool call code and the annotated answer code are used to calculate the loss function.
[0021] As an optional implementation scheme of the present application, optionally, executing the work task to call a tool and generating a tool call result include:
[0022] Execute the work task and call the tool;
[0023] Determine whether the entity information meets the corresponding preset requirements when the tool is called;
[0024] When there are insufficient parameters in the entity information, the corresponding tool call is automatically abandoned.
[0025] As an optional implementation scheme of the present application, optionally, after automatically abandoning the corresponding tool call, the method further includes:
[0026] Determine whether there is a tool that matches the entity information;
[0027] When there is no tool matching the entity information, the process proceeds to the step of obtaining user input instructions again.
[0028] In another aspect, the present application provides a device for implementing any of the above-mentioned tool model-based task processing methods, comprising:
[0029] An instruction acquisition module is configured to acquire user input instructions;
[0030] A task construction module is configured to use preset task instructions to construct a corresponding work task of the tool model based on the user input instructions;
[0031] A task execution module is configured to execute the work task, perform tool invocation, and generate a tool invocation result;
[0032] A result output module, outputting the tool calling result;
[0033] The task instructions include tool search instructions, information extraction instructions and tool calling instructions.
[0034] In another aspect, the present application provides an electronic device, comprising:
[0035] processor;
[0036] a memory for storing processor-executable instructions;
[0037] The processor is configured to implement any one of the above-mentioned tool model-based task processing methods when executing the executable instructions.
[0038] On another aspect of the present application, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, characterized in that when the computer program instructions are executed by a processor, any one of the above-mentioned tool model-based task processing methods is implemented.
[0039] Technical effects of the present invention:
[0040] This application constructs work tasks by combining pre-set task instructions with user input instructions, specifically including tool search, information extraction, and tool call, etc., and can realize task processing without configuring multiple different models for work tasks in the tool model system. Specifically, it includes: obtaining user input instructions; using pre-set task instructions to construct work tasks corresponding to the tool model based on the user input instructions; executing work tasks to call tools and generate tool call results; outputting tool call results; wherein, task instructions include tool search instructions, information extraction instructions and tool call instructions. That is, when this application executes a work task corresponding to the matching user input instruction, it automatically calls the tool and generates a tool call result. There is no need to manually write an external interface call program to automatically realize external tool calls, breaking through the limitations of traditional task-based dialogue systems that can only handle preset task types and the number of pre-prepared tools, improving the adaptability of this application system to different tasks, and the generalization of tool use, effectively enhancing the freedom of user experience.
[0041] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0043] Figure 1 It is a schematic diagram of the task processing method based on the tool model of the present invention;
[0044] Figure 2 It is shown as a flow chart of the implementation of the task processing method based on the tool model of the present invention. DETAILED DESCRIPTION
[0045] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
[0046] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0047] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.
[0048] Example 1
[0049] like Figure 1 As shown, on one hand, this application proposes a task processing method based on a tool model, comprising the following steps:
[0050] S100, obtaining a user input instruction;
[0051] S200, using pre-set task instructions to construct a corresponding work task of the tool model based on the user input instruction;
[0052] S300, executing the work task to call a tool and generating a tool call result;
[0053] S400, outputting the tool calling result;
[0054] The task instructions include tool search instructions, information extraction instructions and tool calling instructions.
[0055] In this embodiment, after the tool model receives user input instructions, it constructs a work task by combining pre-set task instructions with the user input instructions. Specifically, it includes tool search, information extraction, and tool call, etc., without configuring multiple different models for work tasks in the tool model system. At the same time, when executing a work task that matches the user input instruction, the tool call is automatically performed and the tool call result is generated. There is no need to manually write an external interface call program to automatically realize external tool calls. This breaks through the limitations of traditional task-based dialogue systems that can only handle preset task types and the number of pre-prepared tools. It improves the adaptability of the system of this application to different tasks and the generalization of tool use, effectively enhancing the freedom of user experience.
[0056] Specifically, in step S100, a user input instruction is obtained. After receiving the text of the user input instruction, in step S200, a corresponding work task is constructed based on the user input instruction using pre-set task instructions. The pre-set task instructions include tool search instructions, information extraction instructions, and tool call instructions. After receiving the user input instruction text, the tool model of the present application constructs a work task pipeline, sequentially performing tool search, information extraction, and tool call.
[0057] As an optional implementation scheme of the present application, optionally, a pre-set task instruction is used to construct a corresponding work task based on the user input instruction, including:
[0058] Searching for pre-screening tool information matching the user input instruction according to the tool search instruction;
[0059] Extracting entity information matching the user input instruction according to the pre-screening tool information and the information extraction instruction;
[0060] Compile a tool calling code according to the tool calling instruction and the entity information.
[0061] Among them, when searching for pre-screening tool information that matches the user input instruction according to the tool search instruction, it is necessary to search the tool information in the tool database according to the user input instruction and match the corresponding external tool. It should be noted that the tools in this application are not limited to software or APIs, but also include other machine learning or neural network models. For example, the pre-set tool search instruction is: "You are now a task scheduler, and the user's demand description is: XXXXX. Please select and output the most matching X tools from the existing tool resource library as the pre-screening tools for the next stage." In this way, the pre-screening tool information that matches the user input instruction is obtained.
[0062] Furthermore, when extracting entity information that matches the user input command based on the pre-screening tool information and information extraction instructions, it is necessary to extract key information from the user input command text, namely, entity information of a specific type, based on the pre-screening tool information that initially matched. For example, the pre-set information extraction instruction is: "User input is: XXXXX, please extract: Type 1, Type 2, ..., etc. from it and output it in table form." This obtains key information output in table form, with the table content specifically representing entity information of a specific type. In other words, the method of the present application, during the process of determining user intent and structuring user input information, does not require the use of a text classification model to determine the user intent type, nor does it require the use of an entity extraction model to structure the user input information. Instead, it utilizes pre-set task instruction templates to complete the pipeline task. For example, when searching for tools, there is no need to explicitly classify the intent of the user's text description. Instead, a vector search is used to match the tool descriptions in the tool database. Furthermore, when extracting information, a specific information extraction model is not required. Instead, the required information type is input into the tool model and the relevant content of the original input is automatically output.
[0063] It should be noted that when extracting information, it is necessary to determine whether there is insufficient information. As an optional implementation scheme of the present application, optionally, when extracting entity information that matches the user input instruction, it includes:
[0064] Determining whether the entity information meets corresponding preset requirements;
[0065] When the entity information is insufficient, the process proceeds to the step of obtaining the user input instruction again. That is, if the information is insufficient, the process returns to step S100 and obtains the user input instruction, thereby requesting more information from the user.
[0066] Furthermore, when writing tool call code based on the tool call instruction and entity information, after matching the external tool the user intends to use, the code for calling the external tool is automatically generated and filled with structured input information, i.e., entity information. After the tool call code is written, the tool call is executed in step S300, the work task is executed, and a tool call result is generated.
[0067] Among them, as an optional implementation scheme of the present application, optionally, when executing the work task to call the tool and generate the tool call result, it is implemented based on the written tool call code. That is, the tool call is performed by running the tool call code and the corresponding call result is generated. For example, the pre-set tool call instruction is: "The input information in the existing table form is as follows:
[0068] Type 1XXX
[0069] Type 2XXX
[0070] …
[0071] Please refer to the call reference code for calling tool A in the tool library, write a call code based on the input information, execute it, and feedback the running results to me.
[0072] That is to say, in the process of automatically writing tool call codes, by referring to the call reference codes of the corresponding call tools in the tool library, and combining the extracted entity information that matches the user input instructions, the tool call codes that match the user input instructions are written, thereby performing the corresponding tool calls and generating the corresponding call results, and then outputting the tool call results through step S400. It should be noted that the present application further achieves the purpose of matching user demand call tools by designing a structured tool library. As shown in Table 1, Table 1 shows a structured tool library, including tool names, tool types, specific uses, required parameters, and call code examples. For example, the tool name is Conference Treasure, the corresponding tool type is Meeting Appointment, the specific use is to send meeting invitations to participants via email, and to reserve meeting room time, and the required parameters include necessary parameters and optional parameters, where the necessary parameters for Conference Treasure include participants, email addresses, meeting descriptions, and meeting times, and the optional parameters are meeting room numbers. The call code example is pythonbook_meet.py--participant' a@ a.com , b@b.com '--desc'Discussion XXX' --time'2023 / 07 / 20 10:00:00' --room'201'. For example, if the task name is Knowledge Pass, the corresponding tool type is Knowledge Base Search for Specific Entities, and the specific purpose is to search for related entities or relationships within a specific knowledge base. Required parameters include the knowledge base name, definition, and search keywords. The calling code example is bashknowledge_search.sh 'artificial intelligence' 'define' 'big model'. This achieves the goal of using the tool model to understand each tool's purpose, characteristics, required parameters, and calling code.
[0073]
[0074]
[0075] Table 1 Structured tool library
[0076] The tool model-based task processing method of this application uses structured information understanding tools and matches vectorized tool vectors with vectorized user needs. It has the ability to match user text description requirements to specific tools and the ability to call different external tools.
[0077] As an optional implementation scheme of the present application, optionally, executing the work task to call a tool and generating a tool call result include:
[0078] Execute the work task and call the tool;
[0079] Determine whether the entity information meets the corresponding preset requirements when the tool is called;
[0080] When there are insufficient parameters in the entity information, the corresponding tool call is automatically abandoned.
[0081] As an optional implementation scheme of the present application, optionally, after automatically abandoning the corresponding tool call, the method further includes:
[0082] Determine whether there is a tool that matches the entity information;
[0083] When there is no tool matching the entity information, the process proceeds to the step of obtaining user input instructions again.
[0084] It should be noted that if there are input parameters during the call process, that is, if the entity information is insufficient, the tool needs to be automatically abandoned. And if no tool meets the extracted information, the process returns to step S100 to obtain user input instructions and request more user information.
[0085] It should also be noted that, as an optional implementation scheme of the present application, optionally, after writing the tool calling code according to the tool calling instruction and the entity information, the following is further included:
[0086] The tool call code and the annotated answer code are subjected to a loss function calculation. Specifically, after writing the tool call code, the manually annotated answer code is subjected to a loss calculation, and the gradient convergence model is backpropagated. A commonly used loss function, the cross-entropy loss function, is preferably used to calculate the distance between the output code text distribution and the annotated answer code distribution.
[0087] The specific function formula is:
[0088] Where x is the output code text, and y is the marked answer code text.
[0089] Furthermore, in order to enhance the task processing effect, this application collects data sets and conducts training for the three subtasks in the work task. As shown in Table 2, Table 2 shows the loss function corresponding to the specific task. Specifically, for the demand tool screening task, the input data is the user input text, and the output data is the selection of each tool. The corresponding example is: "0 / 1, 0 represents not used, 1 represents used", where the binary cross entropy loss function is used for training for the demand tool screening task; for the input entity extraction task, the input data is the user input text and the extracted entity type, and the output data is the entity and the corresponding type. The corresponding example is: "email address a@a.com", where the cross entropy loss function is used for training for the input entity extraction task; for the tool code writing task, the input data is the user input text and the extracted input parameters, and the output data is the code for the writing number. The corresponding example is: "bash knowledge_search.sh'artificial intelligence''definition''big model'", where the cross entropy loss function is used for training for the tool code writing task. That is, the system is trained separately for the three subtasks of screening tools based on different user needs, extracting specific types of entities from user input text, and writing tool call code. Targeted tuning is then performed based on the performance of specific tasks, resulting in better task processing results.
[0090]
[0091]
[0092] Table 2 Specific task loss function
[0093] In summary, if Figure 2 As shown, the specific workflow of the tool model system of the present application is as follows: receiving the user input instruction text, performing tool search, information extraction and tool call in sequence, and outputting the result to the user. When insufficient information appears during the information extraction process, the system returns to the step of receiving the user input instruction to seek more information from the user. In addition, tool search and tool call are performed separately using tool resources, wherein tool search is implemented through the tool database, and tool call is implemented through the tool API. At the same time, not only is the loss calculation and backpropagation gradient convergence model performed after the tool call code is written from the overall model, but also targeted tuning is performed for the three subtasks respectively, so that the tool model has the ability to complete a variety of real tasks. On the basis of ensuring the original language question and answer and dialogue functions, it further has business capabilities such as appointment work schedules and query of specific field knowledge to meet the real task needs of users.
[0094] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned control method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD). The storage medium can also include a combination of the above-mentioned types of memory.
[0095] Example 2
[0096] Furthermore, another aspect of the present application provides a device for implementing any of the above-mentioned tool model-based task processing methods. Since the working principle of the device in the embodiment of the present disclosure is the same or similar to the principle of the tool model-based task processing method in the embodiment of the present disclosure, the repeated parts will not be repeated. The device in the embodiment of the present application includes:
[0097] An instruction acquisition module is configured to acquire user input instructions;
[0098] A task construction module is configured to use preset task instructions to construct a corresponding work task of the tool model based on the user input instructions;
[0099] A task execution module is configured to execute the work task, perform tool invocation, and generate a tool invocation result;
[0100] A result output module, outputting the tool calling result;
[0101] The task instructions include tool search instructions, information extraction instructions and tool calling instructions.
[0102] Example 3
[0103] In another aspect, the present application provides an electronic device, comprising:
[0104] processor;
[0105] a memory for storing processor-executable instructions;
[0106] The processor is configured to implement any one of the above-mentioned tool model-based task processing methods when executing the executable instructions.
[0107] The control system of the embodiment of the present disclosure includes a processor and a memory for storing processor executable instructions, wherein the processor is configured to implement any of the above-mentioned tool model-based task processing methods when executing the executable instructions.
[0108] It should be noted that the number of processors can be one or more. Furthermore, the control system of the disclosed embodiment may also include an input device and an output device. The processor, memory, input device, and output device may be connected via a bus or other means, which are not specifically limited herein.
[0109] Memory, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and various modules, such as the program or module corresponding to the tool model-based task processing method in the embodiments of the present disclosure. The processor executes the software programs or modules stored in memory to perform various functional applications and data processing of the control system.
[0110] The input device can be used to receive input numbers or signals. The signals can be key signals related to user settings and function control of the device / terminal / server. The output device can include a display device such as a display screen.
[0111] Example 4
[0112] On another aspect of the present application, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, characterized in that when the computer program instructions are executed by a processor, any one of the above-mentioned tool model-based task processing methods is implemented.
[0113] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technical improvements to existing technologies, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A task processing method based on a tool model, characterized in that: The steps include: Get user input instructions; Using pre-set task instructions, constructing the corresponding work tasks of the tool model based on the user input instructions; Execute the work task to call the tool and generate the tool call result; Outputting the tool calling result; Wherein, the task instructions include tool search instructions, information extraction instructions and tool call instructions; Using pre-set task instructions, the tool model builds corresponding work tasks based on the user input instructions, including: Searching for pre-screening tool information matching the user input instruction according to the tool search instruction; Extracting entity information matching the user input instruction according to the pre-screening tool information and the information extraction instruction; When the entity information is insufficient, the step of obtaining a user input instruction is entered again; Writing a tool calling code according to the tool calling instruction and the entity information; When executing the work task, calling the tool and generating the tool calling result, it is implemented based on the written tool calling code; When the entity information contains insufficient parameters, the corresponding tool call is automatically abandoned; When writing the tool calling code, after matching the external tool that the user intends to use, the code for calling the external tool is automatically generated and filled in with the entity information; Refer to the call reference code of the corresponding calling tool in the tool library, and combine it with the extracted entity information that matches the user input instruction to write the tool calling code that matches the user input instruction; Model training is performed for three subtasks: screening tools based on different user needs, extracting specific entity types from user input text, and writing tool call code. Data sets were collected for each of the three subtasks in the work task. The binary cross-entropy loss function was used for training the requirement tool screening task, while the cross-entropy loss function was used for training the input entity extraction task and the tool code writing task. After writing the tool calling code, the loss is calculated with the manually annotated answer code, and the gradient convergence model is back-propagated.
2. The task processing method based on the tool model according to claim 1, characterized in that: Extracting entity information matching the user input instruction includes: Determine whether the entity information meets the corresponding preset requirements.
3. The task processing method based on the tool model according to claim 1, characterized in that: After writing the tool calling code according to the tool calling instruction and the entity information, the following steps are further included: The tool call code and the annotated answer code are used to calculate the loss function.
4. The task processing method based on the tool model according to claim 1, characterized in that: Execute the work task to call the tool and generate the tool call result, including: Execute the work task and call the tool; Determine whether the entity information meets the corresponding preset requirements when the tool is called.
5. The task processing method based on the tool model according to claim 4, characterized in that: After automatically abandoning the corresponding tool call, it also includes: Determine whether there is a tool that matches the entity information; When there is no tool matching the entity information, the process proceeds to the step of obtaining user input instructions again.
6. A task processing device based on a tool model, used to implement the task processing method based on a tool model according to any one of claims 1 to 5, characterized in that: include: An instruction acquisition module is configured to acquire user input instructions; A task construction module is configured to use preset task instructions to construct a corresponding work task of the tool model based on the user input instructions; A task execution module is configured to execute the work task, perform tool invocation, and generate a tool invocation result; A result output module, outputting the tool calling result; The task instructions include tool search instructions, information extraction instructions and tool calling instructions.
7. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the tool model-based task processing method according to any one of claims 1 to 5 when executing the executable instructions.
8. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the tool model-based task processing method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Human-computer interaction method
CN116701601A