Task execution method based on large language model and API gateway system

By applying task execution methods and ReAct mode based on large language model in the API gateway system, the problem of high technical thresholds and insufficient complex logic processing capabilities of traditional API interfaces is solved, seamless user natural language requirements processing and API interface calls are realized, and user experience and system reliability are improved.

CN119597504APending Publication Date: 2025-03-11WUHAN HONGXIN TECH SERVICE CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411651883.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

Traditional API interfaces require developers to have technical knowledge and manual code integration, resulting in high technical thresholds and limited user breadth. The existing systems based on ReAct mode have not yet been applied to API gateway systems, and cannot effectively handle complex logic and multi-step operations.

Method used

The task execution method based on the large language model is adopted to parse the user's natural language task requirements into executable steps, and the appropriate API interface is automatically called through the API gateway system, combining the ReAct mode to process complex logic and multi-step operations.

Benefits of technology

It realizes that operations can be completed through natural language descriptions without technical knowledge, improves the user experience of API services and the accuracy and reliability of the system, and effectively integrates the distributed API interface into a unified and extensible platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597504A_ABST
    Figure CN119597504A_ABST
Patent Text Reader

Abstract

The invention provides a task execution method based on a large language model and an API gateway system, and belongs to the technical field of artificial intelligence, the ReAct mode and the large language model are combined, the system is endowed with the ability of understanding the complex intention described by a natural language of a user, and complex logic in user requirements can be processed; meanwhile, according to a result returned by the API, result analysis can be carried out, and the result is converted into natural language description which can be understood by a user, so that seamless connection between the user and the API is realized. According to the method, scattered APIs can be effectively and organically integrated to form a unified and extensible API service platform, more intelligent and personalized service experience is provided for a user, the user does not need to have technical knowledge, operation can be completed only by using a natural language to describe requirements, misunderstanding is effectively avoided, and the user experience is improved. And the accuracy and reliability of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a task execution method based on a large language model and an API gateway system. Background Art

[0002] With the rapid development of Internet technology, various application providers provide developers with their own unique functions and services through API interfaces. However, traditional API interfaces usually require developers to have certain technical knowledge and manually integrate codes before they can be used. Users need to understand the name, parameter type, return value type and other information of the API interface in order to correctly call the API interface and obtain the required data. This technical threshold limits the user breadth of the API interface and hinders the diversified application of API services in different fields; at the same time, developers manually integrate the API interface into their own business code, which lacks flexibility in use, may not fully meet user needs, and cannot provide a convenient and efficient user experience.

[0003] In recent years, many applications have integrated LLM into their applications and support users to describe their needs in natural language and convert them into corresponding commands. However, such systems still have some shortcomings. For example, some systems can only call some functions provided by the application, but cannot provide external functions, which is lacking in functionality; some systems can only understand simple natural language instructions, but cannot handle complex logic and multi-step operations; some systems lack interaction mechanisms with users, and cannot solve user problems or provide additional information in a timely manner; some systems lack security and reliability guarantees, and cannot effectively avoid misunderstandings and errors.

[0004] As an emerging natural language processing technology, ReAct mode has shown great potential in solving complex tasks. ReAct mode combines language models with action planners, which can generate a series of executable steps based on the user's natural language instructions and execute these steps to achieve the user's goals. This mode can effectively handle complex logic and multi-step operations, and can be adjusted and optimized based on the execution results.

[0005] However, most of the existing ReAct-based systems focus on domain-specific tasks, such as text generation, code generation, etc., and have not yet been applied to API gateway systems. Summary of the invention

[0006] The present invention provides a task execution method and API gateway system based on a large language model, which can effectively and organically integrate scattered API interfaces to form a unified and scalable API service platform, providing users with a more intelligent and personalized service experience.

[0007] In a first aspect, the present invention provides a task execution method based on a large language model, comprising: receiving task requirements described in natural language input by a user, parsing the task requirements using a preset large language model, and generating an action plan for the next step; wherein the preset large language model is a large language model based on a ReAct mode; executing the action plan, obtaining the action result, and determining whether the action result meets the task requirement; if it is determined that the action result does not meet the task requirement, re-determining a new action plan using the large language model, and executing the new action plan until the new action result meets the task requirement; if it is determined that the action result meets the task requirement, feeding back the action result to the user.

[0008] According to the task execution method based on the large language model provided by the present invention, when the task requirements include calling an API interface, the preset large language model is used to parse the task requirements and generate a next action plan, including: using the preset large language model to parse the task requirements, combining with a pre-given API interface, converting the task requirements into different execution steps, and generating corresponding API call instructions; based on the API call instructions corresponding to the different execution steps of the task requirements, determining the next action plan.

[0009] According to the task execution method based on the large language model provided by the present invention, when the task requirements include information display, the preset large language model is used to parse the task requirements and generate the next action plan, which also includes: generating user interaction instructions according to the task requirements; determining the next action plan according to the user interaction instructions; the operations corresponding to the user interaction instructions include: displaying specific information on the user interaction interface.

[0010] According to the task execution method based on the large language model provided by the present invention, an action plan is executed and an action result is obtained, including: calling an API interface through an API call instruction; based on the called API interface, executing corresponding operations according to different decomposed execution steps; recording the results returned by the API interface, parsing the results and converting them into natural language descriptions, and feeding back to the user.

[0011] According to the task execution method based on the large language model provided by the present invention, an action plan is executed and an action result is obtained, including: executing user interaction instructions and displaying specific information on the user interaction interface; the specific information includes: a map, a QR code and user prompt information.

[0012] In a second aspect, the present invention further provides an API gateway system, including: a large language model based on the ReAct mode, an intelligent assistant module, an API calling module, and a user interaction module;

[0013] The large language model is used to parse the input natural language and convert it into different execution steps to form the next action plan;

[0014] The intelligent assistant module is used to receive the action plan generated by the large language model and coordinate the API call module or the user interaction module to execute the action plan;

[0015] API calling module, used to call API interface according to action plan;

[0016] The user interaction module is used to provide a user interaction interface and support interactive collaboration between users and large language models.

[0017] The API gateway system provided according to the present invention further includes: a result parsing module; the result parsing module is used to parse the result returned by the API interface into a natural language description and feed it back to the user interaction module.

[0018] According to the API gateway system provided by the present invention, the user interaction module is a client.

[0019] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the task execution method based on a large language model as described above are implemented.

[0020] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above-described task execution methods based on a large language model.

[0021] The task execution method and API gateway system based on a large language model provided by the present invention can understand the complex needs expressed by users in natural language, decompose them into a series of executable steps, automatically select the appropriate API interface for calling according to the steps, and finally complete the user's task. By combining the ReAct mode with a large language model, the system is endowed with the ability to understand the complex intentions described by the user in natural language, and can handle the complex logic in the user's needs, such as multi-step operations, conditional judgments, etc. At the same time, the system can parse the results according to the results returned by the API interface, and convert them into natural language descriptions that can be understood by the user, thereby achieving seamless connection between the user and the API interface. In order to improve the integration and reliability of the system, the system also supports user interaction, such as displaying maps, QR codes, prompt messages, etc., and effectively avoids misunderstandings through secondary confirmation of user intentions and other behaviors. The system can effectively integrate scattered API interfaces to form a unified and scalable API service platform, providing users with a more intelligent and personalized service experience, without the need for users to have technical knowledge, and only need to describe the needs in natural language to complete the operation, and effectively avoid misunderstandings, and improve the accuracy and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 It is an architecture diagram of the AI ​​API gateway system based on the ReAct mode provided by the present invention;

[0024] Figure 2 It is a flowchart of a task execution method based on a large language model provided by the present invention;

[0025] Figure 3 It is a schematic diagram of a universal prompt template provided by the present invention;

[0026] Figure 4 It is a flow chart of the user interaction steps of the AI ​​API gateway system based on the ReAct mode provided by the present invention;

[0027] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] It should be noted that, in the description of the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.

[0030] The flowchart of the task execution method based on the large language model provided by the present invention includes but is not limited to the following steps:

[0031] Step 101: receiving a task requirement described in natural language input by a user, parsing the task requirement using a preset large language model, and generating a next action plan; wherein the preset large language model is a large language model based on the ReAct mode.

[0032] The present invention receives the user's natural language instructions through some means (such as text box, voice recognition, etc.), and uses a pre-trained large language model based on the ReAct mode to understand the user's needs. In this step, the model must not only recognize the user's intention, but also be able to convert it into a specific action plan.

[0033] Optionally, when the task requirement includes calling an API interface, the preset large language model is used to parse the task requirement and generate the next action plan, including:

[0034] (a) Use the preset large language model to parse the task requirements, combine with the pre-given API interface, convert the task requirements into different execution steps, and generate corresponding API call instructions;

[0035] The large language model refers to a series of pre-given API interface information, which usually includes API functions, parameter requirements, return values, etc. Based on the understanding of user needs and the information of available APIs, the large language model breaks down the task into a series of specific execution steps. Each step corresponds to one or more API calls. For each determined execution step, the model generates the corresponding API call instructions, including the necessary parameter settings.

[0036] (b) Determine the next course of action based on the API call instructions corresponding to the different execution steps of the task requirements.

[0037] Based on the API call instructions generated in the previous step, the model determines an overall action plan. This plan should be an ordered list of steps, each of which is intended to complete a part of the user's needs. If the results of some API calls are prerequisites for other calls, the model needs to ensure that these calls are executed in the correct order.

[0038] Optionally, when the task requirement includes information display, the preset large language model is used to parse the task requirement and generate the next action plan, which also includes:

[0039] (a) Generate user interaction instructions based on task requirements;

[0040] Users describe their needs through natural language, such as "show me my WeChat payment code".

[0041] Large language model analysis: Use a preset large language model (such as a model based on the ReAct mode) to understand and analyze the user's intention. This step may involve identifying keywords, understanding semantics, and inferring the user's real needs.

[0042] The model generates one or more user interaction instructions that will instruct the smart assistant on how to communicate with the user interface in order to display information correctly. For example, the generated instruction might be: "Show the user's WeChat payment code on the user interface."

[0043] (b) determining the next action plan according to the user interaction instruction; the operation corresponding to the user interaction instruction includes: displaying specific information on the user interaction interface.

[0044] Step 102: Execute the action plan, obtain the action result, and determine whether the action result meets the task requirements.

[0045] Optionally, executing the action plan and obtaining the action result includes: calling the API interface through API call instructions; performing corresponding operations according to the different execution steps formed by decomposition based on the called API interface; recording the results returned by the API interface, parsing the results and converting them into natural language descriptions, and feeding back to the user.

[0046] Optionally, executing the action plan and obtaining the action results also includes: executing the action plan and obtaining the action results, including: executing user interaction instructions and displaying specific information on the user interaction interface; the specific information includes: maps, QR codes and user prompt information.

[0047] The present invention can use the following methods to judge whether the action results meet the task requirements:

[0048] (a) Evaluation results: The large language model will evaluate all the collected information to determine whether the information fully answers the user's questions or meets the user's needs.

[0049] (b) Check completeness: Confirm that all steps have been completed and no critical information has been missed.

[0050] (c) User feedback: If possible, confirm whether the user is satisfied with the results by simply asking, for example, “Did you find the information you needed?”

[0051] Step 103: When it is determined that the action result does not meet the task requirements, a new action plan is re-determined using the large language model, and the new action plan is executed until the new action result meets the task requirements.

[0052] If the initial attempt fails to fully meet the user's needs, the system should be able to analyze the reasons for the failure and adjust the strategy accordingly, or the user can use the language model to re-formulate a new technical solution based on the feedback until the task requirements are met.

[0053] Step 104: When it is determined that the action result meets the task requirements, the action result is fed back to the user.

[0054] When the system's actions do achieve the effects expected by the user, the present invention can present the results to the user in a clear and understandable manner, ensuring that the user knows that his request has been correctly understood and processed.

[0055] In order to explain the above technical solution more clearly, the implementation method of the above technical solution is specifically explained below by taking a specific time period embodiment as an example.

[0056] Figure 1 This is the architecture diagram of the AI ​​API gateway system based on the ReAct mode provided by the present invention. Figure 2 is a flowchart of a task execution method based on a large language model provided by the present invention, and the following reference is made to Figure 1 and Figure 2 The task execution method based on a large language model and the API gateway system provided by the present invention are described.

[0057] 1. Large Language Model (LLM)

[0058] This module uses the ReAct mode to understand the user's natural language input, and decomposes it into a series of executable steps based on the pre-given API interface and system operation instructions, and generates corresponding call instructions to the intelligent assistant module. LLM can recognize complex logic in user input, such as multi-step operations, conditional judgments, etc., and decompose these logics into executable steps. The ReAct mode can generate a series of action plans based on user needs and API interface information, including the called API interface, passed parameters, etc.

[0059] (II) Intelligent Assistant Module

[0060] This module is responsible for communicating with LLM, using the interaction module and API call module to actually execute the instructions generated by LLM, respond to the instruction execution results and finally respond to the user.

[0061] (III) API call module

[0062] This module is used to call the pre-defined external API interface according to the call instructions generated by the ReAct mode, and properly handle issues such as parameter verification, file transfer, permission verification, and error handling.

[0063] (IV) User Interaction Module

[0064] This module provides a user interface and corresponding system operation instructions to the big model. It serves as a bridge between user operations and the big model, and supports interactive collaboration between users and the big model, including but not limited to displaying maps, displaying prompt messages, calling up payment software, and re-confirming user intentions. The interactive module is client-specific, and the behaviors of the interactive modules on the mobile, desktop, and web terminals may be inconsistent and need to be implemented separately.

[0065] Optionally, the API gateway system of the present invention further includes: a result parsing module; the result parsing module is used to parse the result returned by the API interface into a natural language description and feed it back to the user interaction module.

[0066] The use of the system includes the following steps:

[0067] (I) System initialization

[0068] (1) Gateway system deployment and API interface definition. Developers deploy the gateway system to the server and configure the corresponding environment and resources, as well as the callable API interface information, including interface path, parameter type, return value type, permission verification, etc.

[0069] (2) Write user interaction commands: Developers need to provide user interaction instructions for their clients and provide the functions required for user interaction, including displaying maps, QR codes, images, calling up payment software, popping up prompt boxes, etc.

[0070] (3) The system automatically generates and saves corresponding prompt words based on the API interface and user interaction instructions. These prompt words will serve as a reference for LLM to understand user needs, helping LLM to better understand user intentions and generate call instructions.

[0071] 2. User Interaction

[0072] (4) The user inputs the needs described in natural language through voice or text through the user interface of the client (user interaction module).

[0073] (5) The intelligent assistant module relays the user's needs to the LLM. The LLM breaks them down into a series of executable steps based on the pre-given API interface information, system operation instructions, and generated prompt words, and infers and generates corresponding call instructions.

[0074] (6) The intelligent assistant module receives the call instruction generated by the LLM and performs corresponding operations according to the instruction content:

[0075] i: If the calling instruction includes an operation of calling an API interface, the intelligent assistant module will call the API calling module to perform the corresponding operation.

[0076] ii: If the calling instruction includes an operation to display specific information or require user interaction, the intelligent assistant module will call the interaction module to display the corresponding information or conduct user interaction, such as displaying a map, displaying a QR code, and re-confirming the user's intention.

[0077] (7) The intelligent assistant responds to the LLM with the call result.

[0078] (8) LLM further infers based on the call result. If the user's needs are currently met, the final result is fed back to the intelligent assistant and the work is completed. Otherwise, the inference generates the next call instruction and returns to step 2.3)

[0079] (9) The intelligent assistant module feeds back the final results to the user.

[0080] As an optional embodiment, the system of the present invention uses a front-end and back-end separation architecture, in which the large language model uses a model provided by a third party, the back-end provides an intelligent assistant module and an API call module, which are deployed on the server, and the front-end includes a web terminal, a desktop terminal and a mobile terminal, in which a user interaction module is integrated. See the system architecture diagram Figure 1 .

[0081] In one embodiment of the present invention, regarding the large language model module, Google's Gemini-1.5-flash large model is used, and the corresponding prompt is constructed according to the API interface and interaction instructions given in the system. Regarding the intelligent assistant module, the intelligent assistant module is implemented in Python language, using Gemini SDK to interact with Google's large model, where the response body format is specified as json. The definition of prompt includes the following parts:

[0082] (1) Clarify the identities of the interlocutor and AI, emphasize that the interlocutor is an intelligent assistant program and AI is a ReAct agent, emphasize that the purpose of the dialogue is to use and only use available tools to solve user needs, and indicate that user needs may not be trustworthy

[0083] (2) Define all available API interfaces and interactive commands as its tools; define the tool in the form of Python function definition to avoid the prompt being too complicated. The specific execution of the API and interactive commands and the response to the results are completed by the intelligent assistant.

[0084] (3) The dialogue format between the intelligent assistant and the AI ​​agent is clearly defined as json that conforms to the corresponding type. Considering that the dialogue format is json, the format is described using the Typescript language. The purpose is to use Typescript's affinity for the json type and its efficient support for type calculus, mainly algebraic data types, to correctly standardize the AI's response format.

[0085] Specifically, messages from the Assistant include:

[0086] 1) Inquiry, new questions raised by users

[0087] 2) Action results, the response to the action requested by the agent

[0088] 3) Errors: unexpected exceptions occur, including but not limited to network errors, AI sending messages in the wrong format, API and command execution failures, etc.

[0089] Specifically, the agent's message types include:

[0090] 1) Action, which indicates the action to be performed by the agent, including thinking, tools, and tool parameter information

[0091] 2) Final answer, indicating that the agent has obtained the final answer.

[0092] (4) Emphasize AI’s ReAct process, emphasize that AI must think before acting, and emphasize that AI must use and only use given tools in the correct format.

[0093] (5) Provide manually written dialogue examples for the agent to refer to.

[0094] A general prompt definition template is shown in Figure 3 , Figure 3 It is a schematic diagram of a universal prompt template provided by the present invention.

[0095] In one embodiment of the present invention, regarding the API call module, a web page is used to provide a user with a visual GUI to add, edit, and delete API interface definitions. When adding and editing an API interface, in order to adapt to the wide variety of API interface definitions and parameter transmission methods in the real world, it is necessary to specify the API interface endpoint, path variable definition, query parameter definition, variable definition, request body type, authentication type, response body type, request pre- and post-processing, retry times, request examples, etc. By default, the system will automatically generate the API interface definition involved in prompt construction, but if the corresponding API interface is relatively complex and cannot be defined through the interface, the user is also allowed to directly define the API interface through code and map it on the interface.

[0096] Regarding variable definition, query parameter definition, request body definition, and response body definition, the system supports custom variables and placing them in query parameters and request body. The request body supports x-urlencoded, form-data, and json formats. The system supports structured json and xml response bodies, and automatically converts them into python TypedDict definitions based on the structure definition. Custom variables and response body types will participate in the construction of prompts.

[0097] Among them, regarding the authentication type, the API system supports a variety of different authentication types, including Cookie, JWT, account password, secretKey, etc. If the authentication is time-limited, you can combine the request pre-processing to obtain the corresponding token.

[0098] Among them, regarding request pre-processing, the system is allowed to perform additional operations before actually sending the API request, including but not limited to verifying parameters, calling the authentication interface to obtain tokens, encrypting the request body, adding signature fields, etc.; the system will preset commonly used pre-processing types, and users can customize new pre-processing types to suit their own needs.

[0099] Regarding request post-processing, before sending an API request and responding to the AI ​​agent with the request result, the system is allowed to perform additional operations, including but not limited to error handling, response body decryption, response body modification, adding comments, etc. The system will preset commonly used post-processing types, and users can customize new post-processing to suit their own needs.

[0100] Among them, regarding the request example, the system will generate the tool definition seen by AI based on the API configuration. Developers can write call examples and response examples based on the tool definition, and specify comments and precautions for the interface; the corresponding content will be spliced ​​into the prompt word for AI reference.

[0101] In one embodiment of the present invention, regarding the user interaction module, the client is an Android device, and the user interaction module is integrated in a specific Android APP. The user interaction module provides an interactive interface similar to ChatGPT, including a conversation history, an input box, and a send button. The user interaction module also provides the following system operation instructions and provides corresponding prompt words:

[0102] (1) Ask the user to enter a message or provide options for the user to select. This function is used to confirm the user's intention.

[0103] (2) Display a map to show location information or ask the user to select a location.

[0104] (3) Invoke WeChat or Alipay payment; allow invoking WeChat or Alipay payment based on existing orders.

[0105] (4) Obtain user device information, including location, mobile phone number, Bluetooth status, etc.

[0106] As an optional embodiment, regarding the user interaction step, the user interaction step mainly includes the user inputting requirements, and the large model performing reasoning, action, and observation cycles. The user interaction step process is shown in Figure 4 , Figure 4 This is a flowchart of the user interaction steps of the AI ​​API gateway system based on the ReAct mode provided by the present invention. Specifically, it includes the following sub-steps:

[0107] S01. The user inputs the demand in the user interaction module, and the demand text will be submitted to the intelligent assistant module. The intelligent assistant module provides the large language model module with API interface and user interaction instruction information, and provides the corresponding user demand to the large model.

[0108] S02. The large language model thinks based on the prompt words, the current task status and the existing knowledge base, and determines the action plan, that is, breaks it down into a series of executable steps and selects the most appropriate one or more actions.

[0109] S03. According to the result of thinking, select the instruction to be executed from the given API interface and user interaction instruction. If the corresponding instruction is an API interface instruction, the intelligent assistant is responsible for converting the instruction into an actual API call according to the API interface definition and responding to the large language model; if the corresponding instruction is a user interaction instruction, the intelligent assistant will call the user interaction module and forward the response result to the large language model after obtaining the response result.

[0110] S04: The large language model understands the current demand completion status based on the thinking results and the output results after tool processing. If the large language model believes that the user task has been completed, it outputs the final processing result, otherwise it returns to step S02.

[0111] S05. The large language model outputs the final processing result, and the intelligent assistant module responds to the user.

[0112] The task execution method and API gateway system based on a large language model provided by the present invention can understand the complex needs expressed by users in natural language, decompose them into a series of executable steps, automatically select the appropriate API interface for calling according to the steps, and finally complete the user's task. By combining the ReAct mode with a large language model, the system is endowed with the ability to understand the complex intentions described by the user in natural language, and can handle the complex logic in the user's needs, such as multi-step operations, conditional judgments, etc. At the same time, the system can parse the results according to the results returned by the API interface, and convert them into natural language descriptions that can be understood by the user, thereby achieving seamless connection between the user and the API interface. In order to improve the integration and reliability of the system, the system also supports user interaction, such as displaying maps, QR codes, prompt messages, etc., and effectively avoids misunderstandings through behaviors such as secondary confirmation of user intentions. The system can effectively integrate scattered API interfaces to form a unified and scalable API service platform, providing users with a more intelligent and personalized service experience, without the need for users to have technical knowledge, and only need to describe the needs in natural language to complete the operation, and effectively avoid misunderstandings, and improve the accuracy and reliability of the system.

[0113] Figure 5is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the task execution method based on the large language model.

[0114] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0115] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the task execution method based on the large language model provided in the above-mentioned embodiments.

[0116] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the task execution method based on the large language model provided in the above embodiments.

[0117] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A task execution method based on a large language model, characterized in that: include: Receive the task requirements described in natural language input by the user, parse the task requirements using a preset large language model, and generate the next action plan; wherein the preset large language model is a large language model based on the ReAct mode; Execute the action plan, obtain the action results, and determine whether the action results meet the task requirements; When it is determined that the action result does not meet the task requirements, a new action plan is re-determined using the large language model and the new action plan is executed until the new action result meets the task requirements; When it is determined that the action results meet the task requirements, the action results are fed back to the user.

2. The task execution method based on a large language model according to claim 1, characterized in that: When the task requirements include calling an API interface, the preset large language model is used to parse the task requirements and generate the next action plan, including: Use the preset large language model to parse the task requirements, combine with the pre-given API interface, convert the task requirements into different execution steps, and generate corresponding API call instructions; Based on the API call instructions corresponding to the different execution steps of the task requirements, determine the next action plan.

3. The task execution method based on a large language model according to claim 1, characterized in that: When the task requirements include information display, the preset large language model is used to parse the task requirements and generate the next action plan, which also includes: Generate user interaction instructions based on task requirements; Determine the next action plan according to the user interaction instruction; The operation corresponding to the user interaction instruction includes: displaying specific information on the user interaction interface.

4. The task execution method based on a large language model according to claim 2, characterized in that: Execute the action plan and obtain the results of the action, including: Call the API interface through API call instructions; Based on the called API interface, the corresponding operations are performed according to the different execution steps formed by decomposition; Record the results returned by the API interface, parse the results and convert them into natural language descriptions, and feed them back to the user.

5. The task execution method based on a large language model according to claim 3, characterized in that: Execute the action plan and obtain the results of the action, including: Execute user interaction instructions and display specific information on the user interaction interface; The specific information includes: a map, a QR code, and user prompt information.

6. An API gateway system, used to implement the task execution method based on a large language model as described in any one of claims 1 to 5, characterized in that: include: Large language model, intelligent assistant module, API call module and user interaction module based on ReAct mode; The large language model is used to parse the input natural language and convert it into different execution steps to form the next action plan; The intelligent assistant module is used to receive the action plan generated by the large language model and coordinate the API call module or the user interaction module to execute the action plan; API calling module, used to call API interface according to action plan; The user interaction module is used to provide a user interaction interface and support interactive collaboration between users and large language models.

7. The API gateway system according to claim 6, characterized in that: Also includes: Result parsing module; The result parsing module is used to parse the result returned by the API interface, convert it into a natural language description, and feed it back to the user interaction module.

8. The API gateway system according to claim 6, characterized in that: The user interaction module is a client.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the task execution method based on a large language model as described in any one of claims 1 to 5 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the task execution method based on a large language model as described in any one of claims 1 to 5 are implemented.

Citation Information

Cited By

  • Control instruction response method and device, robot and storage medium

    CN119993152A

  • Control command response method, device, robot and storage medium

    CN119993152B

  • Data linkage display method and system based on natural language interaction

    CN120950751A

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

    CN120994716A