Task processing method, system and device based on large model, equipment and medium
By generating and executing scripts, the complex computing tasks are separated, combined with the reasoning ability of the large language model, a closed-loop optimization mechanism is formed, which solves the shortcomings of the large language model in dealing with complex computing tasks, and achieves the accuracy and reliability of the calculation results.
Patent Information
- Application Number
- CN202510502429.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-04-22
AI Technical Summary
When traditional large language model systems deal with complex computing, cross-domain knowledge or need to perform tasks accurately, there are problems such as insufficient processing capabilities of computing tasks, lack of mathematical reasoning logic and insufficient high-precision computing capabilities, resulting in inaccurate output and difficult to meet practical application needs.
By generating the first prompt text, the large language model is guided to convert the user-side inference task requests into a specific first script, and hand it over to an external script executor for execution, dynamically adjust the subsequent inference process, and combine the inference ability of the large language model to form a closed-loop optimization mechanism.
It effectively solves the shortcomings of large language models when dealing with complex computing tasks, ensures the accuracy and reliability of calculation results, and can better meet the practical application requirements such as scientific computing and financial analysis that have high accuracy requirements.
Smart Images

Figure CN120012948A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of large language models, and in particular to a task processing method, system, device, equipment and medium based on a large model. Background Art
[0002] With the rapid development of artificial intelligence technology, natural language processing applications based on large language models are becoming more and more widespread. Large models have demonstrated strong reasoning capabilities in areas such as text generation, question answering, code completion, and data analysis. However, traditional large language model systems usually rely directly on the model itself for reasoning. Although this approach is effective in dealing with simple problems, it has significant limitations in scenarios involving complex calculations, cross-domain knowledge, or tasks that require precise execution.
[0003] However, when large language models directly reason about complex computational problems, they often output inaccurate results due to a lack of mathematical reasoning logic or high-precision computing capabilities. For example, when dealing with tasks such as scientific computing and financial analysis, the results obtained by direct reasoning of large language models may be biased and difficult to meet actual application needs. In addition, the tool call results are separated from the model's reasoning process, and it is impossible to perform closed-loop optimization of the intermediate execution results and the reasoning of the large language model, which makes it difficult for the large language model to dynamically adjust the reasoning path, thereby affecting the accuracy of the final result and decision-making ability. Summary of the invention
[0004] In view of this, embodiments of the present application provide a large model-based task processing method, system, apparatus, device and medium to overcome the above-mentioned problems or at least partially solve the above-mentioned problems.
[0005] A first aspect of an embodiment of the present application provides a task processing method based on a large model, the method comprising: Generate a first prompt text according to the reasoning task request from the user end; Generate a first script based on the first prompt text using a large language model; Execute the first script through a script executor to obtain a first execution result; generating a second prompt text according to the first execution result and the reasoning task request; Inference is performed based on the second prompt text using the large language model to obtain an inference task response to the inference task request.
[0006] Optionally, the first script carries metadata, wherein the metadata includes a dependency list; before executing the first script through the script executor, the method further includes: Determine whether the dependency list contains a dependency, where the dependency is an external resource required when the first script is executed; In the case where the dependency list includes a dependency, determining whether the dependency has been installed; If the dependency is not installed, download and install the dependency.
[0007] Optionally, the first execution result includes standard output, error information and calculation results; The method further comprises: Based on the standard output and error information, verify whether the calculation result is correct; In the event that the calculation result is erroneous, determining the type of error; In the case where the error type is a syntax error, regenerating a script corresponding to the calculation result, and executing the regenerated script; In the case where the error type is a logic error, enhancing the content of the first prompt according to the reasoning task request, and re-executing the first script; Generating a second prompt text according to the first execution result and the reasoning task request, including: When the calculation result is correct, a second prompt text is generated according to the first execution result and the reasoning task request.
[0008] Optionally, the method further comprises: Determining whether the reasoning task request contains multiple subtasks; In a case where the reasoning task request includes a plurality of subtasks executed sequentially, the first script includes a plurality of subscripts executed sequentially; The executing the first script by the script executor to obtain the first execution result includes: executing the multiple sub-scripts by the script executor in sequence according to the execution order of the multiple sub-tasks until the multiple sub-tasks are all completed to obtain the first execution result; Each subtask corresponds to a subscript, and the execution result of each subscript serves as input data for the next subscript to be executed.
[0009] Optionally, the metadata further includes a programming language environment, and the script executor includes a plurality of executors for executing different programming languages; and executing the first script through the script executor to obtain a first execution result includes: According to the programming language environment, determining whether the plurality of sub-scripts in the first script are scripts written in a plurality of different programming languages; In the case where the multiple sub-scripts are scripts written in multiple different programming languages, the multiple sub-scripts are sequentially executed by executors of corresponding programming languages among the multiple executors for executing different programming languages in the execution order of the multiple sub-tasks until the multiple sub-tasks are all completed, thereby obtaining the first execution result; Among them, in the process of executing the multiple sub-scripts, when there are sub-scripts written in different programming languages, the execution result of the current sub-script is converted into the programming language format required by the next sub-script to be executed through the data sharing interface, and used as input data of the next sub-script to be executed.
[0010] Optionally, the performing reasoning based on the second prompt text by using the large language model to obtain a reasoning task response to the reasoning task request includes: Determining, by the large language model, whether it is necessary to generate a second script based on the second prompt text; When it is necessary to generate the second script, executing the second script through the script executor to obtain a second execution result; generating a third prompt text according to the second execution result and the reasoning task request; Performing reasoning based on the third prompt text through the large language model to obtain a reasoning task response to the reasoning task request; In the case where the second script does not need to be generated, the reasoning task response of the reasoning task request is obtained by combining the large language model with the context in the reasoning task request.
[0011] A second aspect of an embodiment of the present application provides a task processing system based on a large model, the system comprising: Request processing module, large language model, dependency management module, script executor and result integration module, including: The request processing module is used to generate a first prompt text according to the reasoning task request from the user end; The large language model is used to generate a first script based on the first prompt text generated by the request processing module; The dependency management module is used to determine whether a dependency list in the metadata carried by the first script contains a dependency, where the dependency is an external resource required by the first script when it is executed; when the dependency list contains a dependency, determine whether the dependency has been installed; when the dependency is not installed, download and install the dependency; The script executor is used to execute the first script generated by the large language model to obtain a first execution result; The result integration module is further used to generate a second prompt text according to the first execution result obtained by the large language model and the reasoning task request; The large language model is further used to perform reasoning based on the second prompt text to obtain a reasoning task response to the reasoning task request.
[0012] A third aspect of an embodiment of the present application provides a task processing device based on a large model, the device comprising: A first prompt text generating module, used for generating a first prompt text according to an inference task request from a user terminal; A first script generating module, configured to generate a first script based on the first prompt text by using a large language model; A first execution result acquisition module, used to execute the first script through a script executor to obtain a first execution result; A second prompt text generating module, used for generating a second prompt text according to the first execution result and the reasoning task request; The reasoning task response acquisition module is used to perform reasoning based on the second prompt text through the large language model to obtain a reasoning task response to the reasoning task request.
[0013] According to a fourth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in the first aspect.
[0014] According to a fifth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored, wherein when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0015] Beneficial effects of this application: The embodiments of the present application provide a task processing method, system, apparatus, device and medium based on a large model, including: generating a first prompt text according to an inference task request from a user end; generating a first script based on the first prompt text through a large language model; executing the first script through a script executor to obtain a first execution result; generating a second prompt text according to the first execution result and the inference task request; and performing inference based on the second prompt text through the large language model to obtain an inference task response to the inference task request.
[0016] Through the technical solution of the present application, by generating a first prompt text, the large language model is guided to convert the user-side reasoning task request into a specific first script to execute the task, and the first script is handed over to an external script executor for execution, and then the subsequent reasoning process is dynamically adjusted according to the first execution result of the first script, thereby effectively solving the problem of the shortcomings of the large language model in processing complex computing tasks.
[0017] First, in response to the problem of insufficient computing task processing capabilities when a large language model directly infers complex computing problems, this application separates complex computing tasks from the direct reasoning of a large language model by generating a first prompt text, a first script, and executing the first script, and uses a special script executor to complete the execution of the script, thereby making up for the deficiencies of the large language model in mathematical reasoning logic and high-precision computing capabilities, ensuring the accuracy and reliability of the calculation results, and being able to better meet the actual application needs of scientific computing, financial analysis, and other high-precision requirements.
[0018] Secondly, in view of the shortcoming of the lack of result feedback mechanism in the related technology, this application feeds back the first execution result of the first script to the large language model again, and generates a new second prompt text based on this for the large language model to use as the basis for the next step of reasoning. This closed-loop mechanism enables the large language model to dynamically adjust the reasoning path according to the intermediate execution results, optimize the reasoning results, and obtain the reasoning task response that is finally returned to the user end, thereby improving the computational efficiency, accuracy and reliability of task execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application.
[0020] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application 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 labor.
[0021] Figure 1 It is a flowchart of a task processing method based on a large model provided by this application; Figure 2 is a flowchart of another large model-based task processing method provided by an embodiment of the present application; Figure 3 is a flowchart of another large model-based task processing method provided by an embodiment of the present application; Figure 4It is a schematic diagram of a framework of a task processing device based on a large model provided by an embodiment of the present application; Figure 5 It is a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] An embodiment of the present application provides a task processing method based on a large model. Figure 1 This is a flowchart of a task processing method based on a large model provided by this application, refer to Figure 1 , the method comprising: Step S11, generating a first prompt text according to the reasoning task request from the user end.
[0025] In this embodiment, the user end will initiate an inference task request to the task processing system based on the large model. After the request processing module in the system receives the inference task request, in order to convert the inference task request into a prompt text that is more specific and more in line with the input requirements of the large language model, the inference task request will be further combined with the preset prompt template to generate a first prompt text.
[0026] Among them, the task processing system based on the big model includes: request processing module, big language model, dependency management module, script executor and result integration module.
[0027] The inference request task is an instruction issued by the user to the system, which is used to indicate the specific task that the user wants the system to complete. The preset prompt template is a template pre-defined by the system, which is used to convert the user's inference task request into a more specific prompt text that better meets the input requirements of the large language model. The preset prompt template contains structured information, such as the script's programming language requirements, input and output formats, and dependency lists.
[0028] For example, the user's reasoning task request is "calculate the heat change of a chemical reaction". The preset prompt template requires the script to be written in Python language, and includes input and output format instructions, etc. The first prompt text obtained is: "Please generate a Python script and use the pandas library for data processing. The script receives the enthalpy values of reactants and products as input and calculates the reaction heat. The input format is JSON and the output is the numerical value of the reaction heat." Step S12: Generate a first script based on the first prompt text using a large language model.
[0029] In this embodiment, the large language model generates a script that can complete the reasoning task request, that is, the first script, based on the first prompt text generated by the request processing module in the system. In this process, the large language model parses the content in the first prompt text to understand the requirements of the reasoning task request, the input and output formats, and the programming language requirements, and then generates the first script, which is written in one or more specified programming languages (such as Python, JavaScript, Ruby, etc.).
[0030] For example, if the first prompt text requires the generation of a Python script to calculate the heat change of a chemical reaction, the large language model will generate a Python script containing the calculation logic and declare the required dependencies in the script, such as the pandas library, to obtain the specific code implementation required by the user, which will be run by the script executor to complete the task.
[0031] Step S13: execute the first script through a script executor to obtain a first execution result.
[0032] In this embodiment, after generating the first script, the large language model does not directly rely on the large language model for reasoning, but instead hands the first script to the system's built-in script executor for execution. The script executor is an external executor of the large language model. After executing the first script, the script executor obtains the execution result corresponding to the first script, that is, the first execution result.
[0033] This approach significantly reduces the computational load of the large language model when processing complex computational tasks by outsourcing the computational tasks corresponding to the first script to the script executor, rather than directly relying on the large language model for reasoning. Especially when faced with tasks that require a lot of computation (such as data cleaning, machine learning reasoning, etc.), using a dedicated script executor for parallel processing and efficient computing can significantly improve the response speed and computational efficiency of the large language model, thereby improving the user experience and enabling the large language model to run stably under high concurrent requests.
[0034] Step S14: Generate a second prompt text according to the first execution result and the reasoning task request.
[0035] In this embodiment, there is a two-way feedback mechanism between the large language model and the script executor. After the large language model sends the first script to the script executor for execution, the script executor will feed back the first execution result obtained to the large language model, so that the large language model uses the first execution result as input data for the next step of reasoning.
[0036] Specifically, after obtaining the first execution result, the result integration module of the system will combine the first execution result with the original reasoning task request to obtain the second prompt text and send it to the large language model, so that the large language model can determine the next operation according to the second prompt text.
[0037] Step S15, performing reasoning based on the second prompt text through the large language model to obtain a reasoning task response to the reasoning task request.
[0038] In this embodiment, after obtaining the second prompt text, the large language model will perform further reasoning based on the second prompt text, such as generating a new script according to the second prompt text and handing it over to the script executor for execution again, and repeating the above process to obtain the reasoning task response that is finally returned to the user end. Even if the result of the first execution is not ideal, a reasoning task response that meets the user's needs can be finally generated through multiple iterations, or the reasoning task response that is finally returned to the user end can be directly generated through the large language model according to the second prompt text.
[0039] Through the above embodiment, a first prompt text is generated by receiving an inference task request from the user end, so that the large language model can generate a first script for the inference task request based on the first prompt text, which reflects the flexibility of the script generation process. Then, the first script is handed over to an external script executor for execution to obtain a first execution result, thereby reducing the computational complexity of the large language model. The first execution result is then combined with the original inference task request to generate a second prompt text, and then the large language model performs inference based on the second prompt text, and finally obtains an inference task response that meets user needs.
[0040] This process not only achieves an efficient transformation from user needs to the execution of specific reasoning tasks, but also forms a closed reasoning loop through the feedback mechanism between the large language model and the script executor, enabling the system to dynamically adjust subsequent processing strategies based on the preliminary results of script execution, thereby improving the accuracy and reliability of reasoning task request processing. It not only reduces the amount of computation of the large language model, but also avoids the situation where the execution result is erroneous or unsatisfactory due to an inaccurate execution result, thereby enhancing the flexibility and adaptability of the system.
[0041] In combination with the above embodiments, the present application considers that in the scenario of dynamic script generation, the script operation may rely on a third-party library or a specific execution environment. However, the relevant technology has limited support for the parsing and management of dependencies, and often requires manual configuration or pre-installation of all possible dependencies, which is inefficient and difficult to cope with diverse execution requirements.
[0042] Based on this, an embodiment of the present application also provides another task processing method based on a large model. Figure 2 is a flowchart of another task processing method based on a large model provided in an embodiment of the present application, refer to Figure 2 In this method, the first script carries metadata, and the metadata includes a dependency list; before "executing the first script by the script executor" in step S13, steps S21 to S23 are further specifically included: Step S21, determining whether the dependency list contains a dependency, wherein the dependency is an external resource required when the first script is executed.
[0043] In this embodiment, before executing the first script through the script executor, the dependency management module of the system will first determine whether the dependency list in the metadata carried by the first script lists the dependencies required to execute the first script. The dependencies are external resources required to execute the first script. The external resources are usually third-party libraries or other necessary components, which provide additional functions for the script so that the script can complete complex tasks. For example, the dependency list is such as requirements.txt (Python) or package.json (JavaScript). requirements.txt is used to list the relevant information of the dependencies required for Python scripts, such as third-party libraries and their version numbers. package.json is used to define the dependencies required for JavaScript scripts.
[0044] For example, a Python script may require the numpy library for numerical calculations, or the pandas library for data analysis. If the required dependencies are not installed, the script may not execute properly. Through this step, you can identify the dependencies required for script execution in advance, and prepare for subsequent dependency management and script execution.
[0045] Step S22: When the dependency list includes a dependency, determine whether the dependency has been installed.
[0046] In this embodiment, if there are dependencies required by the first script in the dependency list, the system will further check whether these dependencies have been installed in the target execution environment of the first script, such as checking libraries or components in the local environment to determine the installation status of the dependencies.
[0047] For example, when the first script is a Python script, it is checked whether the numpy library has been installed in the Python environment. If the dependencies have been installed, the execution phase of the first script can be directly entered; if not, the next step is required to ensure that the first script will not fail during execution due to the lack of necessary dependencies, thereby improving the reliability and stability of the system.
[0048] Step S23: if the dependency is not installed, download and install the dependency.
[0049] In this embodiment, when it is found that the dependencies required by the first script have not been installed, the dependency management module of the system will automatically download and install the required dependencies. This process is completed through a dependency management tool (such as pip for Python or npm for JavaScript).
[0050] For example, if the first script requires the numpy library and it is not installed in the local environment, the numpy library will be automatically downloaded and installed through Python's pip install numpy command to ensure that all necessary external resources are available when the script is executed, avoiding execution failure due to missing dependencies.
[0051] For example, in an automated testing scenario, the client requests to generate a script to test the performance of a web service. The large language model generates a Python script that uses the `locust` library, but the target environment lacks this library. The dependency management module automatically parses the dependency list in the first script, dynamically installs `locust`, and configures its running environment. While the script executor is running, it performs performance testing, monitors resource usage and records logs, and finally generates a detailed test report for user reference.
[0052] For example, a user requests to calculate the heat change of a chemical reaction. After the system parses the user's request, it generates the following prompt and passes it to the large language model: "Please generate a Python script that takes as input the enthalpy values of the reactants and products and calculates the heat of reaction."* The first script generated by the large language model includes the calculation logic and carries dependencies, such as the `numpy` library. After the dependency management module resolves the dependency, it checks whether `numpy` is installed in the target environment. If not, it automatically downloads and configures it. Subsequently, the script runs in the Python executor and outputs the calculation results (for example, the heat of reaction is -256.7 kJ / mol). The execution results are verified and returned to the large language model, which generates a complete chemical reaction analysis report based on the results.
[0053] Through the automated dependency management and installation presented by the above technical solution, the system can dynamically adapt to the needs of different reasoning task requests without the need for users to manually configure dependencies, greatly improving the system's automation level and user experience.
[0054] In combination with the above embodiment, an embodiment of the present application further provides another task processing method based on a large model, in which the first execution result includes a standard output, an error message, and a calculation result; The method further comprises: Step S31, based on the standard output and error information, verify whether the calculation result is correct.
[0055] In this embodiment, in order to further ensure the accuracy and reliability of the system, a verification mechanism and error handling strategy for the calculation results are introduced. The first script is passed to the corresponding script executor for execution. Before the script is executed, the first execution result is captured in real time. The first execution result specifically includes standard output, error information and calculation results. By analyzing the standard output and error information in the first execution result returned by the script executor, it is verified whether the calculation result in the first execution result meets the expected format and correctness requirements. The standard output is the standard form of the result generated when the first script runs normally, and the error information is the problem encountered during the operation of the first script.
[0056] For example, the first script is a Python script that calculates the heat of a chemical reaction, and the standard output is the calculated heat value, while the error message may be "numpy library not found" or "syntax error: unexpected syntax structure". Therefore, it is preliminarily determined whether the first script is successfully executed and whether the calculation result is accurate based on the standard output and error message.
[0057] Step S32: if the calculation result is wrong, determine the error type.
[0058] In this embodiment, during the process of verifying the calculation result, when it is found that the calculation result has an error, the system will further determine the error type of the calculation result.
[0059] Specifically, the error types are divided into syntax errors and logic errors. Syntax errors refer to the code of the first script itself not conforming to the syntax rules of the programming language, such as spelling errors, missing brackets, etc. Logical errors refer to the code of the first script being syntactically correct but having logical problems, resulting in inaccurate calculation results, making it impossible for users to obtain ideal reasoning task responses.
[0060] For example, when the chemical reaction heat value calculated by the first script is significantly different from the expected value, it is a logic error; when the first script cannot be run due to a spelling error, it is a syntax error. By accurately identifying the error type, a basis is provided for subsequent processing.
[0061] Step S33, when the error type is a syntax error, regenerate the script corresponding to the calculation result and execute the regenerated script.
[0062] In this embodiment, when it is determined that the error type is a syntax error, the system will regenerate a script corresponding to the calculation result and execute it again.
[0063] For example, when there are spelling errors or grammatical structure problems in the first script, the large language module regenerates a grammatically correct first script based on the original first prompt text. Then, the script executor runs the newly generated first script again to verify whether the calculation result is correct. Through this step, the system can automatically correct grammatical errors and improve the reliability and efficiency of task processing.
[0064] Step S34, when the error type is a logic error, the content of the first prompt is enhanced according to the reasoning task request, and the first script is re-executed.
[0065] In this embodiment, when the error type is determined to be a logic error, the system will enhance the content of the first prompt text, regenerate the first script based on the enhanced first prompt text, and execute it. A logic error usually means that there is a problem with the logic or algorithm of the script, and the original prompt text needs to be supplemented or adjusted so that the large language model can generate a more accurate script.
[0066] For example, when the heat value of a chemical reaction calculated by the first script is inaccurate, the system may add more detailed calculation requirements or a more precise input data format in the first prompt text. Then, the large language model regenerates a new first script based on the enhanced first prompt text and hands it over to the script executor for execution again, thereby improving the accuracy of the calculation results.
[0067] The step S14 of “generating a second prompt text according to the first execution result and the reasoning task request” includes: Step S14-1, when the calculation result is correct, generate a second prompt text according to the first execution result and the reasoning task request.
[0068] In this embodiment, when the calculation result is verified to be correct, the system will generate a second prompt text based on the first execution result and the original reasoning task request, thereby realizing the integration of the execution result and the reasoning task request result and the subsequent reasoning closed loop, and by feeding back the correct calculation result in the first execution result to the large language model, a second prompt text is generated so that the large language model can perform deeper reasoning or generate more complete response content. For example, when the calorific value of the chemical reaction calculated by the first script is correct, the large language model can perform further reasoning based on the generated second prompt text.
[0069] Through the technical solution of the above embodiment, by introducing the verification mechanism and error handling strategy of the calculation results, it is possible to automatically identify and solve problems that occur during the script execution process, and ensure the accuracy and reliability of the calculation results. When verifying the calculation results, the system not only checks the standard output, but also analyzes the error information to comprehensively evaluate the script execution. When an error is found, the system can accurately distinguish between grammatical errors and logical errors and take corresponding measures. For grammatical errors, the system automatically corrects them by regenerating the script; for logical errors, the system optimizes the script logic by enhancing the first prompt text. This automated error handling mechanism not only improves the fault tolerance of the system, but also reduces manual intervention, improves the efficiency of task processing and user experience, and when the calculation results are correct, the system further integrates the results by generating a second prompt text to form a closed loop of reasoning, ensuring the integrity and accuracy of the content of the final reasoning task response.
[0070] In combination with the above embodiments, an embodiment of the present application further provides another task processing method based on a large model. Figure 3 is a flowchart of another task processing method based on a large model provided in an embodiment of the present application, refer to Figure 3 In this method, the method further includes step S41, and the step S13 specifically includes step S13-1-1: Step S41, determining whether the reasoning task request includes multiple subtasks; wherein, when the reasoning task request includes multiple subtasks executed sequentially, the first script includes multiple subscripts executed sequentially.
[0071] In this embodiment, a reasoning task request issued by the user end may contain multiple subtasks that need to be executed sequentially. Therefore, when the system receives the reasoning task request, it first analyzes whether the reasoning task request contains multiple subtasks. Subtasks refer to the parts of a complex task that can be executed independently and completed in a specific order.
[0072] For example, in a data analysis task, there may be three subtasks: data cleaning, data analysis, and result visualization. Through this step, the system can identify the complexity and structure of the task, thereby preparing for subsequent script generation and execution.
[0073] The "executing the first script through the script executor to obtain a first execution result" in the step S13 specifically includes: step S13-1-1, executing the multiple sub-scripts in sequence through the script executor in the execution order of the multiple sub-tasks until the multiple sub-tasks are completed to obtain a first execution result; wherein each sub-task corresponds to a sub-script, and the execution result of each sub-script serves as input data for the next sub-script to be executed.
[0074] In this embodiment, when the reasoning task request includes multiple subtasks, the first script generated by the large language model actually includes multiple sub-scripts executed sequentially, each sub-script corresponding to a subtask. The script executor will execute these sub-scripts in sequence according to the execution order of the subtasks.
[0075] For example, if the reasoning task request is to perform data analysis on a certain data set, including three subtasks: data cleaning, data analysis, and visualization of analysis results, then the first script corresponding to the reasoning task request contains three sub-scripts, where the first sub-script is responsible for data cleaning, the second sub-script is responsible for data analysis, and the third sub-script is responsible for visualization of analysis results. The execution result of each sub-script (except the last sub-script) will be used as the input data of the next sub-script. In this way, it can ensure that the dependencies between sub-tasks are correctly handled, and finally obtain the complete first execution result.
[0076] After each sub-script is run, the execution result of the first script (first execution result) is obtained, and then the first execution result is integrated with the reasoning task request to obtain the second prompt text and send it to the large language model. The large language model determines whether to perform the next step based on the second prompt text.
[0077] By adopting this multi-round integration approach, the system can be continuously corrected and adjusted through an iterative optimization process, and can provide more precise and stable execution results in complex computing tasks, further improving the reliability of calculations and the accuracy of responses.
[0078] Through the technical solution of the above embodiment, multiple subtasks in the reasoning task request can be identified, and each sub-script can be executed in sequence according to the logical order of the subtasks, ensuring that the output of each subtask is used as the input of the next subtask, thereby ensuring the coherence and accuracy of each subtask, and finally generating a complete reasoning task response, thereby improving the flexibility and adaptability of the system.
[0079] In combination with the above embodiments, the present application also takes into account that existing tools are usually designed for a single language or specific functions, lack multi-language and cross-domain support capabilities, and the expansion capabilities of the tools are insufficient for dynamically changing needs.
[0080] Based on this, an embodiment of the present application further provides another task processing method based on a large model, in which the metadata also includes a programming language environment, and the script executor includes multiple executors for executing different programming languages; the "executing the first script by the script executor to obtain a first execution result" in step S13 specifically includes step S13-2-1 and step S13-2-2: Step S13-2-1, judging whether the plurality of sub-scripts in the first script are scripts written in different programming languages according to the programming language environment.
[0081] In this embodiment, the first script of a reasoning task request containing multiple subtasks may be composed of multiple sub-scripts written in different programming languages. For example, a complex reasoning request task may require a Python script for data processing and another JavaScript script for front-end visualization. In order to cope with this multi-language script situation, the script executor in the system includes multiple executors for executing different programming languages, and each executor is called and encapsulated for a specific programming language. The script executor supports cross-script result delivery to ensure multi-language and multi-script collaboration. Moreover, when it is necessary to add executors for other programming languages, it can be implemented through the extension interface without the need for large-scale changes to the entire system, which greatly improves the system's adaptability and subsequent expansion potential.
[0082] Specifically, after the system receives the first script generated by the large language model, it is necessary to check the programming language environment contained in the metadata carried by the first script to determine whether multiple sub-scripts contained in the first script are written in different programming languages, so as to call the executor corresponding to the programming language from the multiple executors for executing different programming languages contained in the script executor.
[0083] Step S13-2-2, in the case where the multiple sub-scripts are scripts written in different programming languages, the multiple sub-scripts are executed in sequence through the executors of the corresponding programming languages among the multiple executors for executing different programming languages in the execution order of the multiple sub-tasks, until the multiple sub-tasks are completed, thereby obtaining the first execution result.
[0084] Among them, in the process of executing the multiple sub-scripts, when there are sub-scripts written in different programming languages, the execution result of the current sub-script is converted into the programming language format required by the next sub-script to be executed through the data sharing interface, and used as input data of the next sub-script to be executed.
[0085] In this embodiment, when it is confirmed that multiple sub-scripts are written in different programming languages, the system will select the corresponding executor for execution according to the programming language of each sub-script. For example, for a Python sub-script, the system will select the Python executor; for a JavaScript sub-script, the system will select the JavaScript executor.
[0086] The script executor will run these sub-scripts in sequence through the corresponding executors in the order of sub-task execution, ensuring that the output of each sub-task serves as the input of the next sub-task. During the execution process, if there are sub-scripts across programming languages, the system will convert the execution result of the current sub-script into the programming language format required by the next sub-script through the data sharing interface. For example, if the output of a Python sub-script needs to be used as the input of a JavaScript sub-script, the system will perform data format conversion to ensure that the data can be seamlessly transferred between scripts in different languages. Finally, after all sub-tasks are executed, the system obtains the first execution result.
[0087] For example, the user's reasoning task request is: perform multi-dimensional analysis on a product's sales data and generate a prediction chart. The first script generated by the large language model includes the following sub-scripts: 1. Process the raw data in Python and clean it using the `pandas` library.
[0088] 2. Generate dynamic interactive charts with JavaScript, based on the `D3.js` library.
[0089] The system calls Python and JavaScript script executors to complete data processing and chart generation tasks, and transmits intermediate results between different languages through a data sharing interface. The final result is integrated into a report containing predictive analysis and visualization through a large language model and returned to the user as a response to the reasoning task.
[0090] Through the technical solutions of the above embodiments, it is possible to effectively handle reasoning request tasks involving multiple programming languages. The system can not only recognize the multilingual characteristics of the script, but also select the appropriate executor for execution according to the programming language of each sub-script. During the execution process, the system performs necessary data format conversion through the data sharing interface to ensure that scripts in different languages can work seamlessly together. This multilingual support and cross-language collaboration capability not only improves the flexibility and adaptability of the system, but also optimizes resource utilization, enabling the system to efficiently handle complex multilingual tasks, significantly improving overall performance and better meeting the diverse needs of users.
[0091] In combination with the above embodiments, an embodiment of the present application further provides another task processing method based on a large model. In the method, the step S15 of "using the large language model to perform reasoning based on the second prompt text to obtain a reasoning task response to the reasoning task request" specifically includes steps S15-1 to S15-5: Step S15-1: determining, by the large language model, whether it is necessary to generate a second script based on the second prompt text.
[0092] In this embodiment, after obtaining the second prompt text, the large language model determines whether a new script needs to be generated to further process the task. The second prompt text is used to provide more specific guidance to the large language model so that it can perform the next step of reasoning. In the process of the large language model judging whether a new script needs to be generated, it evaluates the match between the first execution result and the reasoning task request. When the first execution result is accurate enough and meets user needs, there is no need to generate a new script; when the first execution result is insufficient or needs further optimization, a second script is generated according to the second prompt text.
[0093] For example, if the first execution result is a data analysis report, but it does not cover all the data dimensions requested by the user, the large language model will generate a new script based on the second prompt text to supplement the missing analysis content.
[0094] Step S15-2: When the second script needs to be generated, the second script is executed by the script executor to obtain a second execution result.
[0095] In this embodiment, when the large language model determines that a second script needs to be generated, a new script, i.e., the second script, will be generated according to the second prompt text. The second script will optimize or supplement the problems or unmet needs in the first execution result. The script executor then runs the second script to obtain a second execution result. For example, if the first execution result is an incomplete data analysis report, the second script will supplement the missing data dimensions or perform a more in-depth statistical analysis, and finally obtain a more comprehensive second execution result.
[0096] Step S15-3: Generate a third prompt text according to the second execution result and the reasoning task request.
[0097] refer to Figure 3 In this embodiment, after obtaining the second execution result, the system will combine the reasoning task request, evaluate the completeness and accuracy of the result, and generate a third prompt text. To provide more specific guidance to the large language model so that it can perform the next step of reasoning. If the second execution result is still insufficient, the third prompt text will contain instructions for further optimization; if the result already meets the requirements, the third prompt text may require the large language model to generate the final reasoning task response. For example, if the second execution result supplements the missing data dimension but is not visualized, the third prompt text will instruct the generation of visualization content.
[0098] Step S15-4: performing reasoning based on the third prompt text through the large language model to obtain a reasoning task response to the reasoning task request.
[0099] In this embodiment, the large language model performs reasoning based on the third prompt text to generate a final reasoning task response. During this process, the large language model will integrate all previous execution results and reasoning task requests to generate a complete reasoning result response that meets the user's needs. For example, if the third prompt text requires the generation of a complete report containing data analysis and visualization, the large language model will integrate all relevant information and generate a final report as a reasoning task response and return it to the user end.
[0100] Step S15-5, without generating the second script, obtain the reasoning task response of the reasoning task request by combining the large language model with the context in the reasoning task request.
[0101] In this embodiment, when the large language model determines that the second script does not need to be generated, there are two situations at this time. One is that the large language model determines that the first execution result is sufficiently accurate and meets the user's needs, and the other is that the first execution result still needs to be optimized, but the amount of calculation is small and can be directly inferred by the large language model. Therefore, when the second script does not need to be generated, the large language model will directly combine the context and other information in the inference task request to generate the final inference task response returned to the user end.
[0102] Through the above embodiments, the system can not only dynamically determine whether further script generation is needed based on the complexity of the task and the integrity of the execution results, but also gradually optimize the task processing results through multiple rounds of reasoning. For example, in the embodiment, the system supplements the missing analysis content by generating a second script, and generates a complete report containing visualization content through multiple rounds of reasoning, which not only improves the flexibility and adaptability of the system, but also ensures the accuracy and completeness of the final response content. In addition, without the need for further script generation, the system can directly use the reasoning ability of the large language model to generate the final response, which improves the flexibility and efficiency of task processing.
[0103] For example, the code of Python script is as follows: import java.util.List; public class demo { String skillChat(String request){ / / Integrate the user-side reasoning task request and preset prompt template to guide the large language model to generate scripts; String prompt = integrationPrompt(request); / / Call the large language model to generate the first script; String answer = ca large language model odel(prompt); / / Extract the first script, and encapsulate multiple sub-scripts with a collection; List <script>scripts = parseScript(answer); / / 依次执行多个子脚本;String scriptResult = ""; / / 循环执行,直到大模型推理不再需要执行新的脚本,得到最终的推理请求响应;while (CollectionUtils.isNotEmpty(scripts)) {for(Script script : scripts){ / / 管理依赖:提取依赖项,并安装依赖项manageDependency(script); / / 将上一个子脚本的执行结果放在下一个子脚本中执行;scriptResult = executeScript(script, scriptResult);} / / 将脚本的执行结果整合上下文继续调用大语言模型;String reqeust = integrationContext(request, scriptResult); / / 调用大语言模型;answer = ca大语言模型odel(prompt); / / 提取第二提示文本scripts = parseScript(answer);} / / 响应大模型最终的推理请求响应;return answer;}}示例的,解析和提取依赖项的代码为:def parse_dependencies(script_content):"""解析脚本中的依赖,支持 import 和 from ... import ... 语法"""tree = ast.parse(script_content)dependencies = set()# 使用集合避免重复;for node in ast.walk(tree):if isinstance(node, ast.Import):for alias in node.names:dependencies.add(alias.name.split('.')[0])# 只取顶层模块名;elif isinstance(node, ast.ImportFrom):if node.module:# 避免处理类似 'from . import ...' 的相对导入;dependencies.add(node.module.split('.')[0])return list(dependencies)# 返回列表形式;示例的,通过Python的pip包管理工具安装指定的依赖项的过程为:def install_dependencies(dependencies):"""通过 pip 安装依赖"""if not dependencies:# 检查依赖项列表是否为空;print("未检测到需要安装的依赖")#如果为空,输出"未检测到需要安装的依赖";return# 函数直接返回,不执行后续操作;print(f"检测到以下依赖需要安装: {dependencies}")# 输出需要安装的依赖项列表for dep in dependencies:# 遍历依赖项列表;try:print(f"正在安装依赖: {dep} ...")# 输出正在安装的依赖项;subprocess.check_call([sys.executable, "-m", "pip", "install", dep])#使用pip安装依赖项;print(f"已成功安装依赖:{dep}")# 安装成功后输出提示信息;except subprocess.CalledProcessError as e:# 捕获安装过程中可能出现的异常;print(f"安装 {dep} 失败: {e}")# 输出安装失败的错误信息;sys.exit(1)# 终止程序,确保依赖安装成功后再执行脚本。
[0104] 综上,本申请的技术方案通过以下几个方面带来了有益效果:具体而言,本技术方案通过以下几个方面带来了有益效果:1.提高了计算准确性与可靠性:通过将复杂的计算任务卸载到动态生成的脚本中执行,避免了传统语言模型直接进行计算时可能出现的上下文不清晰或推理不准确的情况。特别是对于需要高精度计算或依赖第三方库(如数据分析、机器学习模型等)的任务,利用脚本执行器确保了计算结果的高可靠性和准确性。此外,通过脚本执行器与大语言模型之间的反馈机制,能够进行结果的迭代优化,从而提高了最终推理结果的准确度。
[0105] 2.增强了系统的灵活性与可扩展性:通过采用多语言脚本执行框架,支持多种编程语言(如Python、JavaScript等),使得系统能够根据实际需求选择合适的语言和工具进行计算。用户可以根据具体的业务需求选择更适合的执行环境,避免了语言或工具的限制,提高了系统的灵活性与可扩展性。此外,新增语言或工具的支持可以通过简单的扩展接口实现,极大地提高了系统的适应能力和后续扩展潜力。
[0106] 3.自动化依赖管理与环境配置提升了执行效率:通过依赖管理模块能够自动解析脚本所需的第三方库或依赖,并动态下载和配置这些依赖,确保脚本执行环境的完整性。这一自动化的依赖管理机制,消除了手动安装和配置环境的繁琐操作,节省了大量的时间和人力资源,同时也减少了因依赖问题导致的运行错误,提升了执行效率和系统的可靠性。
[0107] 4.提高了计算任务的处理效率与响应速度:通过将计算任务外包给脚本执行器,而不是直接依赖大语言模型进行推理,本技术方案显著降低了系统在处理复杂计算任务时的计算负载。尤其在面对需要大量计算的任务(如数据清洗、机器学习推理等)时,利用专门的脚本执行器进行并行处理和高效计算,大大提高了系统的响应速度和计算效率。这不仅提升了用户体验,还使得系统能够在高并发请求下稳定运行。
[0108] 5.降低了系统复杂性与运维成本:由于自动化依赖管理和多语言支持,本技术方案显著简化了系统的架构与维护工作。用户无需为每种计算需求手动配置运行环境或处理不同编程语言的兼容性问题,而是依靠系统自动完成这些任务,从而减少了开发和运维的复杂度。同时,通过模块化的设计,后续对新功能的添加和系统的升级也更加简便,进一步降低了运维成本。
[0109] 6.提高了跨语言协同与兼容性:能够实现多种编程语言的无缝协同工作,确保不同编程语言之间的数据交互和执行流程的兼容性。无论是Python脚本进行数据处理和机器学习,还是JavaScript用于前端交互式可视化,系统都能通过标准化的接口进行集成,使得不同模块能够高效协同工作。这种跨语言协同的能力使得系统能够针对不同任务选择最合适的语言和工具,最大化地提升了系统的兼容性和灵活性。
[0110] 基于同一发明构思,本申请另一实施例还提供了一种基于大模型的任务处理系统,所述系统包括:请求处理模块、大语言模型、依赖管理模块、脚本执行器和结果整合模块,其中:所述请求处理模块用于根据来自于用户端的推理任务请求,生成第一提示文本;所述大语言模型用于基于所述请求处理模块生成的第一提示文本,生成第一脚本;所述依赖管理模块用于判断所述第一脚本携带的元数据中的依赖项列表中是否包含依赖项,所述依赖项为所述第一脚本在执行时所需的外部资源;当所述依赖项列表中包含依赖项时,判断所述依赖项是否已经安装;当未安装所述依赖项时,下载并安装所述依赖项;所述脚本执行器用于执行所述大语言模型生成的第一脚本,得到第一执行结果;所述结果整合模块还用于根据所述大语言模型得到的第一执行结果和所述推理任务请求,生成第二提示文本;所述大语言模型,还用于基于所述第二提示文本进行推理,得到所述推理任务请求的推理任务响应。
[0111] 可选地,所述脚本执行器,还用于基于所述标准输出和错误信息,验证所述计算结果是否正确;在所述计算结果错误的情况下,确定错误类型;在所述错误类型为语法错误的情况下,向大语言模型反馈,以使大语言模型对所述计算结果对应的脚本进行重新生成,并执行重新生成的脚本;在所述错误类型为逻辑错误的情况下,向大语言模型反馈,以使大语言模型按照所述推理任务请求,对所述第一提示的内容进行增强,并重新执行所述第一脚本。
[0112] 所述结果整合模块,还用于在所述计算结果正确的情况下,根据所述第一执行结果和所述推理任务请求,生成第二提示文本。
[0113] 可选地,所述脚本执行器,还用于判断所述推理任务请求中是否包含多子任务;在所述推理任务请求中包含顺序执行的多个子任务的情况下,按照所述多个子任务的执行顺序,依次通过所述脚本执行器执行所述多个子脚本,直到所述多个子任务均完成,得到第一执行结果。
[0114] 可选地,所述脚本执行器,还用于根据所述编程语言环境,判断所述第一脚本中的多个子脚本是否为多种基于不同编程语言编写的脚本;在所述多个子脚本为多种基于不同编程语言编写的脚本的情况下,按照所述多个子任务的执行顺序,依次将多个子脚本通过所述多个用于执行不同编程语言的执行器中的对应的编程语言的执行器执行,直到所述多个子任务均完成,得到所述第一执行结果。
[0115] 可选地,所述大语言模型,还用于判断是否需要基于所述第二提示文本生成第二脚本;在需要生成所述第二脚本的情况下,通过所述脚本执行器执行所述第二脚本,得到第二执行结果;根据所述第二执行结果和所述推理任务请求,生成第三提示文本;基于所述第三提示文本进行推理,得到所述推理任务请求的推理任务响应;在不需要生成所述第二脚本的情况下,结合所述推理任务请求中的上下文,得到所述推理任务请求的推理任务响应。
[0116] 基于同一发明构思,本申请另一实施例还提供了一种基于大模型的任务处理装置,图4是本申请一实施例提供的一种基于大模型的任务处理装置的框架示意图,参考图4,所述装置包括:第一提示文本生成模块11,用于根据来自于用户端的推理任务请求,生成第一提示文本;第一脚本生成模块12,用于通过大语言模型,基于所述第一提示文本,生成第一脚本;第一执行结果获取模块13,用于通过脚本执行器执行所述第一脚本,得到第一执行结果;第二提示文本生成模块14,用于根据所述第一执行结果和所述推理任务请求,生成第二提示文本;推理任务响应获取模块15,用于通过所述大语言模型,基于所述第二提示文本进行推理,得到所述推理任务请求的推理任务响应。
[0117] 可选地,所述第一脚本携带元数据,所述元数据中包括依赖项列表;所述装置还包括:依赖项判断模块,用于在通过脚本执行器执行所述第一脚本之前,判断所述依赖项列表中是否包含依赖项,所述依赖项为所述第一脚本在执行时所需的外部资源;安装判断模块,用于在所述依赖项列表中包含依赖项的情况下,判断所述依赖项是否已经安装;安装模块,用于在未安装所述依赖项的情况下,下载并安装所述依赖项。
[0118] 可选地,所述第一执行结果包括标准输出、错误信息和计算结果;所述装置还包括:验证模块,用于基于所述标准输出和错误信息,验证所述计算结果是否正确;错误类型确定模块,用于在所述计算结果错误的情况下,确定错误类型;第一执行模块,用于在所述错误类型为语法错误的情况下,对所述计算结果对应的脚本进行重新生成,并执行重新生成的脚本;第二执行模块,用于在所述错误类型为逻辑错误的情况下,按照所述推理任务请求,对所述第一提示的内容进行增强,并重新执行所述第一脚本;第二提示文本生成模块14,包括:第二提示文本生成单元,用于在所述计算结果正确的情况下,根据所述第一执行结果和所述推理任务请求,生成第二提示文本。
[0119] 可选地,所述装置还包括:子任务判断模块,用于判断所述推理任务请求中是否包含多子任务;在所述推理任务请求中包含顺序执行的多个子任务的情况下,所述第一脚本中包括顺序执行的多个子脚本;所述第一执行结果获取模块13,包括:第一执行结果获取第一单元,用于按照所述多个子任务的执行顺序,依次通过所述脚本执行器执行所述多个子脚本,直到所述多个子任务均完成,得到第一执行结果;其中,每个子任务对应一个子脚本,每个子脚本的执行结果作为下一个需要执行的子脚本的输入数据。
[0120] 可选地,所述元数据中还包括编程语言环境,所述脚本执行器为包含多个用于执行不同编程语言的执行器;所述第一执行结果获取模块13,包括:编程语言判断单元,用于根据所述编程语言环境,判断所述第一脚本中的多个子脚本是否为多种基于不同编程语言编写的脚本;第一执行结果获取第二单元,用于在所述多个子脚本为多种基于不同编程语言编写的脚本的情况下,按照所述多个子任务的执行顺序,依次将多个子脚本通过所述多个用于执行不同编程语言的执行器中的对应的编程语言的执行器执行,直到所述多个子任务均完成,得到所述第一执行结果;其中,在执行所述多个子脚本的过程中,当存在跨编程语言编写的子脚本时,通过数据共享接口将当前的子脚本的执行结果按照下一个需要执行的子脚本所需的编程语言格式进行数据转换,并作为下一个需要执行的子脚本的输入数据。
[0121] 可选地,所述推理任务响应获取模块15,包括:第二脚本判断单元,用于通过所述大语言模型判断是否需要基于所述第二提示文本生成第二脚本;第二脚本执行单元,用于在需要生成所述第二脚本的情况下,通过所述脚本执行器执行所述第二脚本,得到第二执行结果;第三提示文本生成单元,用于根据所述第二执行结果和所述推理任务请求,生成第三提示文本;推理任务响应获取第一单元,用于通过所述大语言模型,基于所述第三提示文本进行推理,得到所述推理任务请求的推理任务响应;推理任务响应获取第二单元,用于在不需要生成所述第二脚本的情况下,通过所述大语言模型结合所述推理任务请求中的上下文,得到所述推理任务请求的推理任务响应。
[0122] 基于同一发明构思,本申请另一实施例还提供了一种电子设备,包括存储器、处理器以及存储在存储器上的计算机程序,其中,所述处理器执行所述计算机程序以实现如上述任一实施例所述的基于大模型的任务处理方法。
[0123] 其中,电子设备参照图5,图5是本申请一实施例提供的电子设备的示意图。如图5所示,电子设备500包括:存储器510和处理器520,存储器510与处理器520之间通过总线通信连接,存储器510中存储有计算机程序,该计算机程序可在处理器520上执行,进而实现本申请上述实施例公开的基于大模型的任务处理方法中的步骤。
[0124] 基于同一发明构思,本申请另一实施例还提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行如上述任一实施例所述的基于大模型的任务处理方法。
[0125] 基于同一发明构思,本申请另一实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,其中,所述程序被处理器执行时实现如上述任一实施例所述的基于大模型的任务处理方法。
[0126] 对于装置或系统而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
[0127] 本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。
[0128] 本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
[0129] 本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和 / 或方框图来描述的。应理解可由计算机程序指令实现流程图和 / 或方框图中的每一流程和 / 或方框、以及流程图和 / 或方框图中的流程和 / 或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能的装置。
[0130] 这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能。
[0131] 这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能的步骤。尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。
[0132] 最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语"包括”、"包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句"包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者终端设备中还存在另外的相同要素。以上对本申请所提供的一种基于大模型的任务处理方法、系统、装置、设备及介质,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。< / script>
Claims
1. A task processing method based on a large model, characterized in that: The method comprises: Generate a first prompt text according to the reasoning task request from the user end; Generate a first script based on the first prompt text using a large language model; Execute the first script through a script executor to obtain a first execution result; generating a second prompt text according to the first execution result and the reasoning task request; Inference is performed based on the second prompt text using the large language model to obtain an inference task response to the inference task request.
2. The task processing method based on a large model according to claim 1, characterized in that: The first script carries metadata, wherein the metadata includes a dependency list; Before executing the first script through the script executor, the method further includes: Determine whether the dependency list contains a dependency, where the dependency is an external resource required when the first script is executed; In the case where the dependency list includes a dependency, determining whether the dependency has been installed; If the dependency is not installed, download and install the dependency.
3. The task processing method based on a large model according to claim 1, characterized in that: The first execution result includes standard output, error information and calculation results; The method further comprises: Based on the standard output and error information, verify whether the calculation result is correct; In the event that the calculation result is erroneous, determining the type of error; In the case where the error type is a syntax error, regenerating a script corresponding to the calculation result, and executing the regenerated script; In the case where the error type is a logic error, enhancing the content of the first prompt according to the reasoning task request, and re-executing the first script; Generating a second prompt text according to the first execution result and the reasoning task request, including: When the calculation result is correct, a second prompt text is generated according to the first execution result and the reasoning task request.
4. The task processing method based on a large model according to claim 2 is characterized in that: The method further comprises: Determining whether the reasoning task request contains multiple subtasks; In a case where the reasoning task request includes a plurality of subtasks executed sequentially, the first script includes a plurality of subscripts executed sequentially; The executing the first script by the script executor to obtain the first execution result includes: executing the multiple sub-scripts by the script executor in sequence according to the execution order of the multiple sub-tasks until the multiple sub-tasks are all completed to obtain the first execution result; Each subtask corresponds to a subscript, and the execution result of each subscript serves as input data for the next subscript to be executed.
5. The task processing method based on a large model according to claim 4 is characterized in that: The metadata also includes a programming language environment, and the script executor includes multiple executors for executing different programming languages; The step of executing the first script by a script executor to obtain a first execution result includes: According to the programming language environment, determining whether the plurality of sub-scripts in the first script are scripts written in a plurality of different programming languages; In the case where the multiple sub-scripts are scripts written in multiple different programming languages, the multiple sub-scripts are sequentially executed by executors of corresponding programming languages among the multiple executors for executing different programming languages in the execution order of the multiple sub-tasks until the multiple sub-tasks are all completed, thereby obtaining the first execution result; Among them, in the process of executing the multiple sub-scripts, when there are sub-scripts written in different programming languages, the execution result of the current sub-script is converted into the programming language format required by the next sub-script to be executed through the data sharing interface, and used as input data of the next sub-script to be executed.
6. The large model-based task processing method according to any one of claims 1 to 5, characterized in that: The performing reasoning based on the second prompt text by using the large language model to obtain a reasoning task response to the reasoning task request includes: Determining, by the large language model, whether it is necessary to generate a second script based on the second prompt text; When it is necessary to generate the second script, executing the second script through the script executor to obtain a second execution result; generating a third prompt text according to the second execution result and the reasoning task request; Performing reasoning based on the third prompt text through the large language model to obtain a reasoning task response to the reasoning task request; In the case where the second script does not need to be generated, the reasoning task response of the reasoning task request is obtained by combining the large language model with the context in the reasoning task request.
7. A task processing system based on a large model, characterized in that: The system includes: a request processing module, a large language model, a dependency management module, a script executor and a result integration module, wherein: The request processing module is used to generate a first prompt text according to the reasoning task request from the user end; The large language model is used to generate a first script based on the first prompt text generated by the request processing module; The dependency management module is used to determine whether a dependency list in the metadata carried by the first script contains a dependency, where the dependency is an external resource required by the first script when it is executed; when the dependency list contains a dependency, determine whether the dependency has been installed; when the dependency is not installed, download and install the dependency; The script executor is used to execute the first script generated by the large language model to obtain a first execution result; The result integration module is further used to generate a second prompt text according to the first execution result obtained by the large language model and the reasoning task request; The large language model is further used to perform reasoning based on the second prompt text to obtain a reasoning task response to the reasoning task request.
8. A task processing device based on a large model, characterized in that: The device comprises: A first prompt text generating module, used for generating a first prompt text according to an inference task request from a user terminal; A first script generating module, configured to generate a first script based on the first prompt text by using a large language model; A first execution result acquisition module, used to execute the first script through a script executor to obtain a first execution result; A second prompt text generating module, used for generating a second prompt text according to the first execution result and the reasoning task request; The reasoning task response acquisition module is used to perform reasoning based on the second prompt text through the large language model to obtain a reasoning task response to the reasoning task request.
9. An electronic device, characterized in that: The system comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the large model-based task processing method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the large model-based task processing method as described in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Calculation engine task execution method and device and readable storage medium
CN112988131A
Task processing method and device, computer readable storage medium and electronic equipment
CN115729679A
Intelligent agent scheduling method, system and equipment based on large language model and medium
CN118132227A
Table data interactive processing method based on large language model
CN118394909A
Task execution method and device based on large model
CN118519680A
Cited By
Humanoid robot industrial task scene generation method and system based on large language model
CN120735021A
A method and system for generating an industrial task scenario of a humanoid robot based on a large language model
CN120735021B