Task processing method, system, device, equipment and medium based on large model

By generating prompt text and scripts, using the script executor to perform complex tasks and feed them back to the large language model, the shortcomings of the large language model in complex calculations are solved and efficient and accurate task processing is achieved.

CN120012948BActive Publication Date: 2025-08-15CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510502429.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-08-15
Estimated Expiration
2045-04-22

AI Technical Summary

Technical Problem

When traditional large language model systems deal with complex calculations, cross-domain knowledge or need to perform tasks accurately, there are problems such as inaccurate calculation results, lack of mathematical reasoning logic and high-precision computing capabilities, and the lack of result feedback mechanisms lead to the inference path being unable to be optimized.

Method used

By generating the first prompt text, the first script is generated and executed by the script executor, the second prompt text is generated in combination with the first execution result, and a large language model is used for inference to form a closed-loop feedback mechanism to optimize the inference process.

Benefits of technology

It improves the computing efficiency, accuracy and reliability of complex computing tasks, meets the practical application requirements of scientific computing and financial analysis, such as high accuracy requirements, and enhances the flexibility and adaptability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120012948B_ABST
    Figure CN120012948B_ABST
Patent Text Reader

Abstract

The present application provides a large-model-based task processing method, system, apparatus, device, and medium, relating to the technical field of large language models. The method includes: generating a first prompt text based on an inference task request from a user terminal; generating a first script based on the first prompt text using a large language model; executing the first script using a script executor to obtain a first execution result; generating a second prompt text based on the first execution result and the inference task request; and performing inference based on the second prompt text using the large language model to obtain an inference task response to the inference task request. The method can outsource the computational tasks of the large language model to the script executor to reduce the amount of computation, and adopt a two-way feedback mechanism between the large language model and the script executor to iteratively optimize the inference process of the system, thereby improving the computational efficiency, accuracy, and reliability of the task.
Need to check novelty before this filing date? Find Prior Art

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 (AI), natural language processing (NLP) applications based on large language models (LLMs) are becoming increasingly widespread. Large models have demonstrated powerful reasoning capabilities in areas such as text generation, question answering, code completion, and data analysis. However, traditional LLM systems typically rely directly on the model itself for reasoning. While this approach is effective for simple problems, it exhibits significant limitations in scenarios involving complex computations, cross-domain knowledge, or tasks requiring 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 handling tasks such as scientific computing and financial analysis, the results obtained by direct reasoning using large language models may be biased and difficult to meet practical application requirements. Furthermore, the tool's call results are disconnected from the model's reasoning process, making it impossible to perform closed-loop optimization between intermediate execution results and the large language model's reasoning. This makes it difficult for large language models to dynamically adjust their reasoning paths, thus affecting the accuracy of the final results and decision-making capabilities. 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:

[0006] Generate a first prompt text according to the reasoning task request from the user terminal;

[0007] Generate a first script based on the first prompt text using a large language model;

[0008] Executing the first script through a script executor to obtain a first execution result;

[0009] generating a second prompt text according to the first execution result and the reasoning task request;

[0010] 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.

[0011] 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:

[0012] Determining whether the dependency list contains a dependency, where the dependency is an external resource required for the first script to be executed;

[0013] In a case where the dependency list includes a dependency, determining whether the dependency has been installed;

[0014] If the dependencies are not installed, download and install them.

[0015] Optionally, the first execution result includes standard output, error information and calculation results;

[0016] The method further comprises:

[0017] Verify whether the calculation result is correct based on the standard output and error information;

[0018] If the calculation result is erroneous, determining the type of error;

[0019] If the error type is a syntax error, regenerate the script corresponding to the calculation result and execute the regenerated script;

[0020] If 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;

[0021] Generating a second prompt text according to the first execution result and the reasoning task request, including:

[0022] When the calculation result is correct, a second prompt text is generated according to the first execution result and the reasoning task request.

[0023] Optionally, the method further includes:

[0024] Determining whether the inference task request contains multiple subtasks;

[0025] In a case where the inference task request includes a plurality of subtasks executed sequentially, the first script includes a plurality of subscripts executed sequentially;

[0026] 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;

[0027] Each subtask corresponds to a sub-script, and the execution result of each sub-script serves as the input data for the next sub-script to be executed.

[0028] Optionally, the metadata further includes a programming language environment, and the script executor includes multiple executors for executing different programming languages; and executing the first script through the script executor to obtain a first execution result includes:

[0029] 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;

[0030] In a 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 all the multiple sub-tasks are completed, thereby obtaining the first execution result;

[0031] 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 for the next sub-script to be executed.

[0032] Optionally, performing reasoning based on the second prompt text using the large language model to obtain a reasoning task response to the reasoning task request includes:

[0033] Determining, by the large language model, whether it is necessary to generate a second script based on the second prompt text;

[0034] When it is necessary to generate the second script, executing the second script by the script executor to obtain a second execution result;

[0035] generating a third prompt text according to the second execution result and the reasoning task request;

[0036] Performing reasoning based on the third prompt text using the large language model to obtain a reasoning task response to the reasoning task request;

[0037] 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.

[0038] A second aspect of an embodiment of the present application provides a task processing system based on a large model, the system comprising:

[0039] Request processing module, large language model, dependency management module, script executor and result integration module, including:

[0040] The request processing module is used to generate a first prompt text according to the reasoning task request from the user terminal;

[0041] The large language model is used to generate a first script based on the first prompt text generated by the request processing module;

[0042] The dependency management module is configured 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 executing; if the dependency list contains a dependency, determine whether the dependency has been installed; if the dependency is not installed, download and install the dependency;

[0043] The script executor is used to execute the first script generated by the large language model to obtain a first execution result;

[0044] The result integration module is further configured to generate a second prompt text according to the first execution result obtained by the large language model and the reasoning task request;

[0045] 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.

[0046] A third aspect of the embodiments of the present application provides a task processing device based on a large model, the device comprising:

[0047] A first prompt text generating module, configured to generate a first prompt text according to an inference task request from a user terminal;

[0048] A first script generating module, configured to generate a first script based on the first prompt text using a large language model;

[0049] A first execution result acquisition module, configured to execute the first script through a script executor to obtain a first execution result;

[0050] A second prompt text generating module, configured to generate a second prompt text according to the first execution result and the reasoning task request;

[0051] The reasoning task response acquisition module is used to perform reasoning based on the second prompt text using the large language model to obtain a reasoning task response to the reasoning task request.

[0052] 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.

[0053] 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.

[0054] Beneficial effects of this application:

[0055] An embodiment of the present application provides a large-model-based task processing method, system, apparatus, device, and medium, including: generating a first prompt text based on an inference task request from a user terminal; 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 based on 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.

[0056] 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. Then, the subsequent reasoning process is dynamically adjusted according to the first execution result of the first script, effectively solving the problem of the shortcomings of the large language model in processing complex computing tasks.

[0057] First, in response to the problem of insufficient computing task processing capabilities when large language models directly reason about complex computing problems, this application separates complex computing tasks from the direct reasoning of large language models 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 large language models 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 practical application needs of scientific computing, financial analysis, and other high-precision requirements.

[0058] Secondly, to address the shortcomings of the related art in the lack of a result feedback mechanism, this application feeds back the first execution result of the first script to the large language model, and based on this, generates a new second prompt text for the large language model to use as the judgment basis for the next step of reasoning. This closed-loop mechanism enables the large language model to dynamically adjust the reasoning path based on the intermediate execution results, optimize the reasoning results, and obtain the reasoning task response that is ultimately returned to the user end, thereby improving the computational efficiency, accuracy, and reliability of task execution. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The drawings that constitute a part of this application are used to provide further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute improper limitations on this application.

[0060] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for the description of the present application. 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 any creative work.

[0061] Figure 1 This is a flowchart of a task processing method based on a large model provided by this application;

[0062] Figure 2 This is a flowchart of another large model-based task processing method provided by an embodiment of the present application;

[0063] Figure 3 This is a flowchart of another large model-based task processing method provided by an embodiment of the present application;

[0064] Figure 4 This 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;

[0065] Figure 5 Schematic diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0066] It should be noted that, unless there is any conflict, the embodiments and features in the embodiments of this application can be combined with each other.

[0067] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0068] 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:

[0069] Step S11: Generate a first prompt text according to the reasoning task request from the user terminal.

[0070] 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.

[0071] Among them, the task processing system based on the large model includes: request processing module, large language model, dependency management module, script executor and result integration module.

[0072] An inference request task is a user's instruction to the system, indicating the specific task the user wants the system to complete. A preset prompt template is a predefined template used by the system to convert a 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 a list of dependencies.

[0073] For example, a user's reasoning task request is "Calculate the heat change of a chemical reaction." The preset prompt template requires a script written in Python and includes instructions for input and output formats. The first prompt is: "Please generate a Python script and use the pandas library for data processing. This script accepts the enthalpy values of reactants and products as input and calculates the heat of reaction. The input format is JSON, and the output is a numerical value of the heat of reaction."

[0074] Step S12: Generate a first script based on the first prompt text using a large language model.

[0075] In this embodiment, the large language model generates a script capable of completing the inference task request, namely the first script, based on the first prompt text generated by the request processing module in the system. During this process, the large language model parses the content of the first prompt text to understand the inference task request requirements, input and output formats, and programming language requirements. It then generates the first script, which is written in one or more specified programming languages (such as Python, JavaScript, Ruby, etc.).

[0076] For example, if the first prompt text requires generating 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.

[0077] Step S13: Execute the first script through a script executor to obtain a first execution result.

[0078] 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.

[0079] This approach significantly reduces the computational load on large language models when handling complex tasks by outsourcing the computational tasks corresponding to the first script to a script executor, rather than relying directly on the large language model for inference. Especially for computationally intensive tasks (such as data cleaning and machine learning inference), utilizing a dedicated script executor for parallel processing and efficient computation can significantly improve the response speed and computational efficiency of the large language model, thereby enhancing the user experience and enabling the large language model to operate stably under high concurrency requests.

[0080] Step S14: Generate a second prompt text according to the first execution result and the reasoning task request.

[0081] In this embodiment, a two-way feedback mechanism exists 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.

[0082] Specifically, after obtaining the first execution result, the system's result integration module will combine the first execution result with the original reasoning task request to obtain a second prompt text and send it to the large language model so that the large language model can determine the next operation based on the second prompt text.

[0083] Step S15 : performing reasoning based on the second prompt text using the large language model to obtain a reasoning task response to the reasoning task request.

[0084] 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 based on 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, the 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 by the large language model based on the second prompt text.

[0085] 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.

[0086] 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 computational complexity of the large language model, but also avoids situations where incorrect or unsatisfactory execution results are caused by inaccurate execution results, thereby enhancing the flexibility and adaptability of the system.

[0087] In conjunction with the above embodiments, this application considers that in scenarios where dynamic script generation occurs, script execution may rely on third-party libraries or specific execution environments. However, related technologies have limited support for parsing and managing dependencies, often requiring manual configuration or pre-installation of all possible dependencies, which is inefficient and difficult to meet diverse execution requirements.

[0088] Based on this, an embodiment of the present application also provides another task processing method based on a large model. Figure 2 This is a flowchart of another task processing method based on a large model provided by an embodiment of the present application. Figure 2 In this method, the first script carries metadata including a dependency list; before "executing the first script by the script executor" in step S13, the method further includes steps S21 to S23:

[0089] Step S21 , determining whether the dependency list contains a dependency, where the dependency is an external resource required when the first script is executed.

[0090] In this embodiment, before executing a first script through a script executor, the system's dependency management module prioritizes whether the dependency list in the metadata carried by the first script lists the dependencies required to execute the first script. Dependencies are external resources required to execute the first script. External resources are typically third-party libraries or other necessary components that provide additional functionality to the script, enabling it to complete complex tasks. For example, a dependency list may be in a file called requirements.txt (Python) or package.json (JavaScript). requirements.txt lists information about dependencies required by Python scripts, such as third-party libraries and their version numbers. package.json defines the dependencies required by JavaScript scripts.

[0091] 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. This step allows you to identify the dependencies required for script execution in advance, preparing for subsequent dependency management and script execution.

[0092] Step S22: If the dependency list includes a dependency, determine whether the dependency has been installed.

[0093] 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.

[0094] For example, if the first script is a Python script, the system checks whether the numpy library is installed in the Python environment. If the dependencies are installed, the first script can be executed directly. If not, the next step is required to ensure that the first script does not fail during execution due to missing necessary dependencies, thereby improving system reliability and stability.

[0095] Step S23: If the dependency is not installed, download and install the dependency.

[0096] In this embodiment, when it is found that the dependencies required by the first script have not been installed, the system's dependency management module 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).

[0097] 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, ensuring that all necessary external resources are available when the script is executed, avoiding execution failures due to missing dependencies.

[0098] For example, in an automated testing scenario, a client requests 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 runtime environment. While the script executor is running, it performs performance testing, monitors resource usage, and logs it, ultimately generating a detailed test report for the user's reference.

[0099] For example, a user requests to calculate the heat change of a chemical reaction. After the system interprets the user's request, it generates the following prompt and passes it to the large language model:

[0100] "Please generate a Python script that takes as input the enthalpy values of the reactants and products and calculates the heat of reaction."*

[0101] The first script generated by the large language model includes the computational logic and carries dependencies, such as the numpy library. After resolving this dependency, the dependency management module checks whether numpy is installed in the target environment. If not, it automatically downloads and configures it. The script then runs in the Python executor and outputs the computational results (for example, a heat of reaction value of -256.7 kJ / mol). After verification, the results are returned to the large language model, which then generates a complete chemical reaction analysis report based on them.

[0102] 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.

[0103] 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;

[0104] The method further comprises:

[0105] Step S31: Verify whether the calculation result is correct based on the standard output and error information.

[0106] To further ensure the accuracy and reliability of the system, this embodiment introduces a calculation result verification mechanism and error handling strategy. Before the first script is passed to the corresponding script executor for execution, the script captures the first execution result in real time. The first execution result specifically includes standard output, error messages, and calculation results. By analyzing the standard output and error messages returned by the script executor, the calculation results in the first execution result are verified to meet the expected format and correctness requirements. Standard output is the standard form of the results produced when the first script is running normally, while error messages indicate problems encountered during the execution of the first script.

[0107] For example, if the first script is a Python script that calculates the heat of a chemical reaction, the standard output will be the calculated heat value, while the error message may be "numpy library not found" or "Syntax error: unexpected syntax structure." Therefore, based on the standard output and error message, we can preliminarily determine whether the first script executed successfully and whether the calculation result is accurate.

[0108] Step S32: If the calculation result is wrong, determine the error type.

[0109] 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.

[0110] Specifically, error types are categorized as syntax errors and logic errors. Syntax errors occur when the script code itself doesn't conform to the programming language's grammatical rules, such as spelling errors or missing parentheses. Logic errors occur when the script code is syntactically correct but contains logical problems, leading to inaccurate calculation results and preventing users from achieving the desired reasoning task response.

[0111] For example, if the calculated calorific value of a chemical reaction in the first script significantly deviates from the expected value, it is a logic error; if the first script fails to run due to a spelling error, it is a syntax error. By accurately identifying the error type, we can provide a basis for subsequent processing.

[0112] Step S33: When the error type is a syntax error, regenerate the script corresponding to the calculation result and execute the regenerated script.

[0113] In this embodiment, when the error type is determined to be a syntax error, the system will regenerate a script corresponding to the calculation result and execute it again.

[0114] For example, if a first script contains spelling errors or grammatical problems, the large language module regenerates a grammatically correct first script based on the original first prompt text. The script executor then runs the newly generated first script again to verify the correctness of the calculation results. This process automatically corrects grammatical errors, improving the reliability and efficiency of task processing.

[0115] 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.

[0116] In this embodiment, if 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. Logical errors generally indicate problems with the script's logic or algorithm, requiring supplementation or adjustments to the original prompt text so that the large language model can generate a more accurate script.

[0117] For example, if the first script calculates an inaccurate caloric value for a chemical reaction, the system might add more detailed calculation instructions or a more precise input data format to the first prompt text. The large language model then regenerates a new first script based on the enhanced first prompt text and passes it to the script executor for re-execution, thereby improving the accuracy of the calculation results.

[0118] The step S14 of “generating a second prompt text according to the first execution result and the reasoning task request” includes:

[0119] 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.

[0120] In this embodiment, if 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 integrating the execution result and the reasoning task request results and completing the subsequent reasoning loop. By feeding back the correct calculation result in the first execution result to the large language model, a second prompt text is generated, allowing the large language model to conduct deeper reasoning or generate a more complete response content. For example, if the calorific value of a chemical reaction calculated by the first script is correct, the large language model can perform further reasoning based on the generated second prompt text.

[0121] Through the technical solutions of the above embodiments, by introducing a verification mechanism and error handling strategy for calculation results, it is possible to automatically identify and resolve problems that arise during script execution, ensuring 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 execution of the script. When an error is found, the system can accurately distinguish between grammatical errors and logical errors and take appropriate 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 reasoning loop, ensuring the integrity and accuracy of the content of the final reasoning task response.

[0122] 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 This is a flowchart of another task processing method based on a large model provided by an embodiment of the present application. Figure 3 In this method, the method further includes step S41, and the step S13 specifically includes step S13-1-1:

[0123] Step S41 , determining whether the reasoning task request includes multiple subtasks; wherein, if the reasoning task request includes multiple subtasks executed sequentially, the first script includes multiple subscripts executed sequentially.

[0124] In this embodiment, a single inference task request from a user may contain multiple subtasks that need to be executed sequentially. Therefore, when the system receives an inference task request, it first analyzes whether the request contains multiple subtasks. Subtasks are independently executable parts of a complex task and are completed sequentially in a specific order.

[0125] For example, a data analysis task may include 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.

[0126] The "executing the first script through the script executor to obtain the first execution result" in 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 the 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.

[0127] In this embodiment, when an inference task request includes multiple subtasks, the first script generated by the large language model actually contains multiple sub-scripts that are executed sequentially, with each sub-script corresponding to a subtask. The script executor will execute these sub-scripts in the order in which the subtasks are executed.

[0128] For example, if an inference task request is to perform data analysis on a dataset, including three subtasks: data cleaning, data analysis, and visualization of the analysis results, the first script corresponding to this inference task request will contain three sub-scripts: 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 the analysis results. The execution results of each sub-script (except the last sub-script) will serve as input data for the next sub-script. This ensures that the dependencies between sub-tasks are correctly handled, ultimately resulting in a complete first execution result.

[0129] After each sub-script runs, the execution result of the first script (first execution result) is obtained, and then the first execution result is integrated with the inference 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 operation based on the second prompt text.

[0130] By adopting this multi-round integration approach, the system can continuously correct and adjust through an iterative optimization process, providing more accurate and stable execution results in complex computing tasks, further improving the reliability of calculations and the accuracy of responses.

[0131] 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 serves 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.

[0132] 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 function, lack multi-language and cross-domain support capabilities, and the expansion capabilities of the tools are insufficient to meet dynamically changing needs.

[0133] Based on this, an embodiment of the present application further provides another task processing method based on a large model. In this method, 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 steps S13-2-1 and S13-2-2:

[0134] 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.

[0135] In this embodiment, the first script of an inference task request containing multiple subtasks may be composed of multiple sub-scripts written in different programming languages. For example, a complex inference 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 that multiple languages and multiple scripts work together. 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.

[0136] 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 the 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.

[0137] Step S13-2-2, in the case where the multiple sub-scripts are scripts written in multiple 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.

[0138] 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 for the next sub-script to be executed.

[0139] In this embodiment, when multiple sub-scripts are determined to be written in different programming languages, the system will select the corresponding executor for each sub-script based on the programming language. 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.

[0140] The script executor will run these sub-scripts sequentially through the corresponding executors in the order in which the sub-tasks are executed, ensuring that the output of each sub-task serves as the input for the next sub-task. During the execution process, if there are sub-scripts that span multiple programming languages, the system will convert the execution results 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 serve as the input for 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.

[0141] For example, a user's reasoning task request is to 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:

[0142] 1. Use Python to process raw data and clean it using the `pandas` library.

[0143] 2. Generate dynamic interactive charts with JavaScript, based on the `D3.js` library.

[0144] The system calls Python and JavaScript script executors to complete data processing and chart generation tasks, respectively, and transfers intermediate results between different languages through a data sharing interface. The final results are integrated into a report containing predictive analysis and visualization using a large language model and returned to the user as the inference task response.

[0145] 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 together seamlessly. 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.

[0146] In combination with the above embodiment, an embodiment of the present application further provides another task processing method based on a large model. In this method, the step S15 of "using the large language model to perform reasoning based on the second prompt text to obtain an inference task response to the inference task request" specifically includes steps S15-1 to S15-5:

[0147] Step S15-1: Determine whether it is necessary to generate a second script based on the second prompt text using the large language model.

[0148] 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.

[0149] For example, if the first execution result is a data analysis report but 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.

[0150] 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.

[0151] 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, is generated based on the second prompt text. The second script optimizes or supplements 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 more in-depth statistical analysis, ultimately obtaining a more comprehensive second execution result.

[0152] Step S15-3: Generate a third prompt text according to the second execution result and the reasoning task request.

[0153] refer to Figure 3 In this embodiment, after obtaining the second execution result, the system will evaluate the completeness and accuracy of the result in combination with the reasoning task request, and generate a third prompt text. This provides 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 has met 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.

[0154] Step S15 - 4 , performing reasoning based on the third prompt text using the large language model to obtain a reasoning task response to the reasoning task request.

[0155] In this embodiment, the large language model performs inference based on the third prompt text to generate the final inference task response. During this process, the large language model integrates all previous execution results and the inference task request to generate a complete inference result response that meets the user's needs. For example, if the third prompt text requires the generation of a complete report including data analysis and visualization, the large language model will integrate all relevant information and generate the final report as the inference task response and return it to the user.

[0156] Step S15-5: When there is no need to generate the second script, 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.

[0157] In this embodiment, when the large language model determines that a second script does not need to be generated, there are two possible scenarios: one is that the large language model determines that the first execution result is sufficiently accurate and meets the user's needs; the other is that the first execution result still needs to be optimized, but the computational complexity is relatively small and can be directly inferred by the large language model. Therefore, if 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 and return it to the user.

[0158] Through the above-mentioned embodiments, the system can not only dynamically determine whether further script generation is needed based on the complexity of the task and the completeness of the execution results, but can 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 visual 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, when no further script generation is required, 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.

[0159] For example, the code of Python script is as follows:

[0160] import java.util.List;

[0161] public class demo {

[0162] String skillChat(String request){

[0163] / / Integrate the user-side reasoning task request and preset prompt template to guide the large language model to generate scripts;

[0164] String prompt = integrationPrompt(request);

[0165] / / Call the large language model to generate the first script;

[0166] String answer = ca large language model odel(prompt);

[0167] / / Extract the first script and encapsulate multiple sub-scripts with a collection;

[0168] List <script>scripts = parseScript(answer);

[0169] / / 依次执行多个子脚本;

[0170] String scriptResult = "";

[0171] / / 循环执行,直到大模型推理不再需要执行新的脚本,得到最终的推理请求响应;

[0172] while (CollectionUtils.isNotEmpty(scripts)) {

[0173] for(Script script : scripts){

[0174] / / 管理依赖:提取依赖项,并安装依赖项

[0175] manageDependency(script);

[0176] / / 将上一个子脚本的执行结果放在下一个子脚本中执行;

[0177] scriptResult = executeScript(script, scriptResult);

[0178] }

[0179] / / 将脚本的执行结果整合上下文继续调用大语言模型;

[0180] String reqeust = integrationContext(request, scriptResult);

[0181] / / 调用大语言模型;

[0182] answer = ca大语言模型odel(prompt);

[0183] / / 提取第二提示文本

[0184] scripts = parseScript(answer);

[0185] }

[0186] / / 响应大模型最终的推理请求响应;

[0187] return answer;

[0188] }

[0189] }

[0190] 示例的,解析和提取依赖项的代码为:

[0191] def parse_dependencies(script_content):

[0192] """

[0193] 解析脚本中的依赖,支持 import 和 from ... import ... 语法

[0194] """

[0195] tree = ast.parse(script_content)

[0196] dependencies = set()# 使用集合避免重复;

[0197] for node in ast.walk(tree):

[0198] if isinstance(node, ast.Import):

[0199] for alias in node.names:

[0200] dependencies.add(alias.name.split('.')[0])# 只取顶层模块名;

[0201] elif isinstance(node, ast.ImportFrom):

[0202] if node.module:# 避免处理类似 'from . import ...' 的相对导入;

[0203] dependencies.add(node.module.split('.')[0])

[0204] return list(dependencies)# 返回列表形式;

[0205] 示例的,通过Python的pip包管理工具安装指定的依赖项的过程为:

[0206] def install_dependencies(dependencies):

[0207] """

[0208] 通过 pip 安装依赖

[0209] """

[0210] if not dependencies:# 检查依赖项列表是否为空;

[0211] print("未检测到需要安装的依赖")#如果为空,输出"未检测到需要安装的依赖";

[0212] return# 函数直接返回,不执行后续操作;

[0213] print(f"检测到以下依赖需要安装: {dependencies}")# 输出需要安装的依赖项列表

[0214] for dep in dependencies:# 遍历依赖项列表;

[0215] try:

[0216] print(f"正在安装依赖: {dep} ...")# 输出正在安装的依赖项;

[0217] subprocess.check_call([sys.executable, "-m", "pip", "install", dep])#使用pip安装依赖项;

[0218] print(f"已成功安装依赖:{dep}")# 安装成功后输出提示信息;

[0219] except subprocess.CalledProcessError as e:# 捕获安装过程中可能出现的异常;

[0220] print(f"安装 {dep} 失败: {e}")# 输出安装失败的错误信息;

[0221] sys.exit(1)# 终止程序,确保依赖安装成功后再执行脚本。

[0222] 综上,本申请的技术方案通过以下几个方面带来了有益效果:

[0223] 具体而言,本技术方案通过以下几个方面带来了有益效果:

[0224] 1.提高了计算准确性与可靠性:通过将复杂的计算任务卸载到动态生成的脚本中执行,避免了传统语言模型直接进行计算时可能出现的上下文不清晰或推理不准确的情况。特别是对于需要高精度计算或依赖第三方库(如数据分析、机器学习模型等)的任务,利用脚本执行器确保了计算结果的高可靠性和准确性。此外,通过脚本执行器与大语言模型之间的反馈机制,能够进行结果的迭代优化,从而提高了最终推理结果的准确度。

[0225] 2.增强了系统的灵活性与可扩展性:通过采用多语言脚本执行框架,支持多种编程语言(如Python、JavaScript等),使得系统能够根据实际需求选择合适的语言和工具进行计算。用户可以根据具体的业务需求选择更适合的执行环境,避免了语言或工具的限制,提高了系统的灵活性与可扩展性。此外,新增语言或工具的支持可以通过简单的扩展接口实现,极大地提高了系统的适应能力和后续扩展潜力。

[0226] 3.自动化依赖管理与环境配置提升了执行效率:通过依赖管理模块能够自动解析脚本所需的第三方库或依赖,并动态下载和配置这些依赖,确保脚本执行环境的完整性。这一自动化的依赖管理机制,消除了手动安装和配置环境的繁琐操作,节省了大量的时间和人力资源,同时也减少了因依赖问题导致的运行错误,提升了执行效率和系统的可靠性。

[0227] 4.提高了计算任务的处理效率与响应速度:通过将计算任务外包给脚本执行器,而不是直接依赖大语言模型进行推理,本技术方案显著降低了系统在处理复杂计算任务时的计算负载。尤其在面对需要大量计算的任务(如数据清洗、机器学习推理等)时,利用专门的脚本执行器进行并行处理和高效计算,大大提高了系统的响应速度和计算效率。这不仅提升了用户体验,还使得系统能够在高并发请求下稳定运行。

[0228] 5.降低了系统复杂性与运维成本:由于自动化依赖管理和多语言支持,本技术方案显著简化了系统的架构与维护工作。用户无需为每种计算需求手动配置运行环境或处理不同编程语言的兼容性问题,而是依靠系统自动完成这些任务,从而减少了开发和运维的复杂度。同时,通过模块化的设计,后续对新功能的添加和系统的升级也更加简便,进一步降低了运维成本。

[0229] 6.提高了跨语言协同与兼容性:能够实现多种编程语言的无缝协同工作,确保不同编程语言之间的数据交互和执行流程的兼容性。无论是Python脚本进行数据处理和机器学习,还是JavaScript用于前端交互式可视化,系统都能通过标准化的接口进行集成,使得不同模块能够高效协同工作。这种跨语言协同的能力使得系统能够针对不同任务选择最合适的语言和工具,最大化地提升了系统的兼容性和灵活性。

[0230] 基于同一发明构思,本申请另一实施例还提供了一种基于大模型的任务处理系统,所述系统包括:请求处理模块、大语言模型、依赖管理模块、脚本执行器和结果整合模块,其中:

[0231] 所述请求处理模块用于根据来自于用户端的推理任务请求,生成第一提示文本;

[0232] 所述大语言模型用于基于所述请求处理模块生成的第一提示文本,生成第一脚本;

[0233] 所述依赖管理模块用于判断所述第一脚本携带的元数据中的依赖项列表中是否包含依赖项,所述依赖项为所述第一脚本在执行时所需的外部资源;当所述依赖项列表中包含依赖项时,判断所述依赖项是否已经安装;当未安装所述依赖项时,下载并安装所述依赖项;

[0234] 所述脚本执行器用于执行所述大语言模型生成的第一脚本,得到第一执行结果;

[0235] 所述结果整合模块还用于根据所述大语言模型得到的第一执行结果和所述推理任务请求,生成第二提示文本;

[0236] 所述大语言模型,还用于基于所述第二提示文本进行推理,得到所述推理任务请求的推理任务响应。

[0237] 可选地,所述脚本执行器,还用于基于所述标准输出和错误信息,验证所述计算结果是否正确;在所述计算结果错误的情况下,确定错误类型;在所述错误类型为语法错误的情况下,向大语言模型反馈,以使大语言模型对所述计算结果对应的脚本进行重新生成,并执行重新生成的脚本;

[0238] 在所述错误类型为逻辑错误的情况下,向大语言模型反馈,以使大语言模型按照所述推理任务请求,对所述第一提示的内容进行增强,并重新执行所述第一脚本。

[0239] 所述结果整合模块,还用于在所述计算结果正确的情况下,根据所述第一执行结果和所述推理任务请求,生成第二提示文本。

[0240] 可选地,所述脚本执行器,还用于判断所述推理任务请求中是否包含多子任务;在所述推理任务请求中包含顺序执行的多个子任务的情况下,按照所述多个子任务的执行顺序,依次通过所述脚本执行器执行所述多个子脚本,直到所述多个子任务均完成,得到第一执行结果。

[0241] 可选地,所述脚本执行器,还用于根据所述编程语言环境,判断所述第一脚本中的多个子脚本是否为多种基于不同编程语言编写的脚本;在所述多个子脚本为多种基于不同编程语言编写的脚本的情况下,按照所述多个子任务的执行顺序,依次将多个子脚本通过所述多个用于执行不同编程语言的执行器中的对应的编程语言的执行器执行,直到所述多个子任务均完成,得到所述第一执行结果。

[0242] 可选地,所述大语言模型,还用于判断是否需要基于所述第二提示文本生成第二脚本;在需要生成所述第二脚本的情况下,通过所述脚本执行器执行所述第二脚本,得到第二执行结果;根据所述第二执行结果和所述推理任务请求,生成第三提示文本;基于所述第三提示文本进行推理,得到所述推理任务请求的推理任务响应;在不需要生成所述第二脚本的情况下,结合所述推理任务请求中的上下文,得到所述推理任务请求的推理任务响应。

[0243] 基于同一发明构思,本申请另一实施例还提供了一种基于大模型的任务处理装置,图4是本申请一实施例提供的一种基于大模型的任务处理装置的框架示意图,参考图4,所述装置包括:

[0244] 第一提示文本生成模块11,用于根据来自于用户端的推理任务请求,生成第一提示文本;

[0245] 第一脚本生成模块12,用于通过大语言模型,基于所述第一提示文本,生成第一脚本;

[0246] 第一执行结果获取模块13,用于通过脚本执行器执行所述第一脚本,得到第一执行结果;

[0247] 第二提示文本生成模块14,用于根据所述第一执行结果和所述推理任务请求,生成第二提示文本;

[0248] 推理任务响应获取模块15,用于通过所述大语言模型,基于所述第二提示文本进行推理,得到所述推理任务请求的推理任务响应。

[0249] 可选地,所述第一脚本携带元数据,所述元数据中包括依赖项列表;所述装置还包括:

[0250] 依赖项判断模块,用于在通过脚本执行器执行所述第一脚本之前,判断所述依赖项列表中是否包含依赖项,所述依赖项为所述第一脚本在执行时所需的外部资源;

[0251] 安装判断模块,用于在所述依赖项列表中包含依赖项的情况下,判断所述依赖项是否已经安装;

[0252] 安装模块,用于在未安装所述依赖项的情况下,下载并安装所述依赖项。

[0253] 可选地,所述第一执行结果包括标准输出、错误信息和计算结果;

[0254] 所述装置还包括:

[0255] 验证模块,用于基于所述标准输出和错误信息,验证所述计算结果是否正确;

[0256] 错误类型确定模块,用于在所述计算结果错误的情况下,确定错误类型;

[0257] 第一执行模块,用于在所述错误类型为语法错误的情况下,对所述计算结果对应的脚本进行重新生成,并执行重新生成的脚本;

[0258] 第二执行模块,用于在所述错误类型为逻辑错误的情况下,按照所述推理任务请求,对所述第一提示的内容进行增强,并重新执行所述第一脚本;

[0259] 第二提示文本生成模块14,包括:

[0260] 第二提示文本生成单元,用于在所述计算结果正确的情况下,根据所述第一执行结果和所述推理任务请求,生成第二提示文本。

[0261] 可选地,所述装置还包括:

[0262] 子任务判断模块,用于判断所述推理任务请求中是否包含多子任务;在所述推理任务请求中包含顺序执行的多个子任务的情况下,所述第一脚本中包括顺序执行的多个子脚本;

[0263] 所述第一执行结果获取模块13,包括:第一执行结果获取第一单元,用于按照所述多个子任务的执行顺序,依次通过所述脚本执行器执行所述多个子脚本,直到所述多个子任务均完成,得到第一执行结果;

[0264] 其中,每个子任务对应一个子脚本,每个子脚本的执行结果作为下一个需要执行的子脚本的输入数据。

[0265] 可选地,所述元数据中还包括编程语言环境,所述脚本执行器为包含多个用于执行不同编程语言的执行器;所述第一执行结果获取模块13,包括:

[0266] 编程语言判断单元,用于根据所述编程语言环境,判断所述第一脚本中的多个子脚本是否为多种基于不同编程语言编写的脚本;

[0267] 第一执行结果获取第二单元,用于在所述多个子脚本为多种基于不同编程语言编写的脚本的情况下,按照所述多个子任务的执行顺序,依次将多个子脚本通过所述多个用于执行不同编程语言的执行器中的对应的编程语言的执行器执行,直到所述多个子任务均完成,得到所述第一执行结果;

[0268] 其中,在执行所述多个子脚本的过程中,当存在跨编程语言编写的子脚本时,通过数据共享接口将当前的子脚本的执行结果按照下一个需要执行的子脚本所需的编程语言格式进行数据转换,并作为下一个需要执行的子脚本的输入数据。

[0269] 可选地,所述推理任务响应获取模块15,包括:

[0270] 第二脚本判断单元,用于通过所述大语言模型判断是否需要基于所述第二提示文本生成第二脚本;

[0271] 第二脚本执行单元,用于在需要生成所述第二脚本的情况下,通过所述脚本执行器执行所述第二脚本,得到第二执行结果;

[0272] 第三提示文本生成单元,用于根据所述第二执行结果和所述推理任务请求,生成第三提示文本;

[0273] 推理任务响应获取第一单元,用于通过所述大语言模型,基于所述第三提示文本进行推理,得到所述推理任务请求的推理任务响应;

[0274] 推理任务响应获取第二单元,用于在不需要生成所述第二脚本的情况下,通过所述大语言模型结合所述推理任务请求中的上下文,得到所述推理任务请求的推理任务响应。

[0275] 基于同一发明构思,本申请另一实施例还提供了一种电子设备,包括存储器、处理器以及存储在存储器上的计算机程序,其中,所述处理器执行所述计算机程序以实现如上述任一实施例所述的基于大模型的任务处理方法。

[0276] 其中,电子设备参照图5,图5是本申请一实施例提供的电子设备的示意图。如图5所示,电子设备500包括:存储器510和处理器520,存储器510与处理器520之间通过总线通信连接,存储器510中存储有计算机程序,该计算机程序可在处理器520上执行,进而实现本申请上述实施例公开的基于大模型的任务处理方法中的步骤。

[0277] 基于同一发明构思,本申请另一实施例还提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行如上述任一实施例所述的基于大模型的任务处理方法。

[0278] 基于同一发明构思,本申请另一实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,其中,所述程序被处理器执行时实现如上述任一实施例所述的基于大模型的任务处理方法。

[0279] 对于装置或系统而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。

[0280] 本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。

[0281] 本领域内的技术人员应明白,本申请实施例的实施例可提供为方法、装置、或计算机程序产品。因此,本申请实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。

[0282] 本申请实施例是参照根据本申请实施例的方法、终端设备(系统)、和计算机程序产品的流程图和 / 或方框图来描述的。应理解可由计算机程序指令实现流程图和 / 或方框图中的每一流程和 / 或方框、以及流程图和 / 或方框图中的流程和 / 或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理终端设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理终端设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能的装置。

[0283] 这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理终端设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能。

[0284] 这些计算机程序指令也可装载到计算机或其他可编程数据处理终端设备上,使得在计算机或其他可编程终端设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程终端设备上执行的指令提供用于实现在流程图一个流程或多个流程和 / 或方框图一个方框或多个方框中指定的功能的步骤。尽管已描述了本申请实施例的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本申请实施例范围的所有变更和修改。

[0285] 最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语"包括”、"包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句"包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者终端设备中还存在另外的相同要素。以上对本申请所提供的一种基于大模型的任务处理方法、系统、装置、设备及介质,进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。< / 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 terminal; Generate a first script based on the first prompt text using a large language model; Executing the first script through a script executor to obtain a first execution result, where, when the inference task request includes multiple subtasks to be executed sequentially, the first execution result is an execution result obtained after all the subtasks are completed; generating a second prompt text according to the first execution result and the reasoning task request; Performing reasoning based on the second prompt text through the large language model to obtain a reasoning task response to the reasoning task request, including: evaluating the matching degree between the first execution result and the reasoning task request through the large language model to determine whether it is necessary to generate a second script based on the second prompt text; and if it is not necessary to generate the second script, performing reasoning based on the second prompt text through the large language model to obtain a reasoning task response to the reasoning 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: Determining whether the dependency list contains a dependency, where the dependency is an external resource required for the first script to be executed; In a case where the dependency list includes a dependency, determining whether the dependency has been installed; If the dependencies are not installed, download and install them.

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: Verify whether the calculation result is correct based on the standard output and error information; If the calculation result is erroneous, determining the type of error; If the error type is a syntax error, regenerate the script corresponding to the calculation result and execute the regenerated script; If 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, characterized in that: The method further comprises: Determining whether the inference task request contains multiple subtasks; In a case where the inference 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 sub-script, and the execution result of each sub-script serves as the input data for the next sub-script to be executed.

5. The task processing method based on a large model according to claim 4, 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 a 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 all the multiple sub-tasks are 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 for 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 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 by 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 using 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 terminal; 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 configured 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 executing; if the dependency list contains a dependency, determine whether the dependency has been installed; if 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. When the inference task request includes multiple subtasks to be executed sequentially, the first execution result is the execution result obtained after all the multiple subtasks are completed; The result integration module is further configured 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 also used to perform reasoning based on the second prompt text to obtain an inference task response to the inference task request, including: evaluating the matching degree between the first execution result and the inference task request through the large language model, and determining whether it is necessary to generate a second script based on the second prompt text; if it is not necessary to generate the second script, performing reasoning based on the second prompt text through the large language model to obtain an inference task response to the inference task request.

8. A task processing device based on a large model, characterized in that: The device comprises: A first prompt text generating module, configured to generate 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 using a large language model; A first execution result acquisition module is configured to execute the first script through a script executor to obtain a first execution result. When the inference task request includes multiple subtasks to be executed sequentially, the first execution result is an execution result obtained after all the subtasks are completed; A second prompt text generating module, configured to generate a second prompt text according to the first execution result and the reasoning task request; An inference task response acquisition module is used to perform inference based on the second prompt text through the large language model to obtain an inference task response to the inference task request, including: evaluating the matching degree between the first execution result and the inference task request through the large language model, and determining whether it is necessary to generate a second script based on the second prompt text; if it is not necessary to generate the second script, performing inference based on the second prompt text through the large language model to obtain an inference task response to the inference 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 according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Calculation engine task execution method and device and readable storage medium

    CN112988131A

  • Intelligent agent scheduling method, system and equipment based on large language model and medium

    CN118132227A

  • Data analysis method and device, electronic equipment and storage medium

    CN119721255A