LLM-oriented information enhancement tool registration method

Through LLM automatic generation of tool description files and Prompt, the automatic registration and classification of LLM information enhancement tools is realized, solving the problems of complex and labor cost of tool calls in the existing technology, and improving the success rate of tool calls and the accuracy of intent recognition. simplifies the service integration process.

CN119129565APending Publication Date: 2024-12-13HOHAI UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411255489.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing LLM information enhancement tool registration methods have problems such as complex tool call, high labor costs, inconvenient tool registration management, and poor tool intent identification accuracy, especially when facing a changing production environment and diversified tools.

Method used

Automatically generate tool description files and related Prompts through LLM, realize automatic classification and registration of tools, reduce the cost of manually building Prompts, and simplify the tool calling process by filling the template with parameters.

Benefits of technology

It realizes rapid deployment of external tools, reduces the labor cost of registration tools, improves the success rate of tool calls and the accuracy of intent recognition, and simplifies the service integration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129565A_ABST
    Figure CN119129565A_ABST
Patent Text Reader

Abstract

The invention discloses an LLM-oriented information enhancement tool registration method. The LLM is used for automatically generating description information of a tool; splicing to generate a tool description file, performing availability check on the tool description file, and modifying the tool description file if the check fails; if the checking is successful, classifying the tools by using LLM, and selectively registering to an existing tool set or constructing a new tool set according to the functions of the tools; then registering the tools into the corresponding tool sets; the dynamic splicing tool calls a related Prompt; and storing the constructed Prompt as additional information together with the corresponding tool set and the tool to complete registration of the tool and updating of the tool set. According to the method, the labor cost for introducing an existing information enhancement tool for the LLM is effectively reduced, the tool quality and expandability of the LLM question-answering system are improved, the calling accuracy of an intention-driven tool is enhanced, and the tool integration efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, specifically to large language models, artificial intelligence, intelligent question answering and other fields, and in particular to a registration method for an information enhancement tool for LLM. Background Art

[0002] With the rapid development of deep learning technology, large language models have become a hot topic in the field of artificial intelligence. Large language models (LLMs) refer to large neural network models with billions or even tens of billions of parameters, which can learn complex patterns and regularities through training with massive data. These models usually have a multi-layer structure and can achieve advanced tasks in the fields of natural language processing, human-computer question answering, and recommendation systems. In recent years, the emergence of LLMs such as the GPT series, GLM series, and LLaMA series has greatly promoted the development of natural language processing and other fields. These LLMs have achieved amazing results in various tasks, demonstrated strong learning and reasoning capabilities, and can guide LLMs to perform specific tasks through prompt engineering. The rise of LLMs has not only promoted the advancement of artificial intelligence technology, but also provided more powerful tools and support for intelligent agents and other applications.

[0003] Information enhancement tools refer to tools built on the basis of API services for obtaining real-time information and professional information, which are mainly used to expand the information acquisition capabilities of LLM. At present, LLM itself does not have the ability to call tools, and needs to call tools by writing code or using intelligent agents. In the process of tool calling, LLM's dialogue ability is used to identify user intent, extract parameters, and call tools according to specific tasks to achieve more intelligent functions. At present, the tool calling methods provided by platforms such as OpenAI, such as Function_call, are mainly limited to calling simple functions. The characteristics of these simple functions are that they contain only a few input parameters, and these input parameters are usually in natural language form. In order to ensure that LLM can correctly understand and process the output results, the output of these functions must contain sufficient semantic information so that LLM can understand the meaning of the output content based on this information. However, it is time-consuming and laborious to reconstruct such simple functions for each tool, and this method cannot adapt well to the changing situations in actual production. In addition, the tool information provided when registering tools for LLM is often insufficient, and there is a lack of specific response strategies for different types of tools. At the same time, due to the accuracy of LLM intent recognition, the number of tools that can be activated at the same time is usually limited to two or three. Finally, there is currently a lack of a tool registration management system and a clear tool registration process.

[0004] In the actual production process, the tool functions that need to be built may be to call professional model calculations, query object information, call map services, etc. Since they come from different business providers, their tools have many characteristics. These characteristics are specifically reflected in: the quality of the tools is inconsistent, and it cannot be guaranteed that the expected effect can be obtained after the tool request; the input and output parameters of the tool are not necessarily words with specific meanings, and LLM cannot directly understand the meaning of the parameters and call them; the numerous parameters designed for the tool lead to a decrease in the accuracy of LLM parameter extraction; the excessive number of tools leads to a decrease in the accuracy of LLM in selecting appropriate tools according to user intentions. To this end, the present invention proposes an information enhancement tool registration method for LLM, which automatically constructs a series of tool description files and tool sets by using LLM, and constructs a series of prompts to guide LLM to call tools based on registration information, thereby realizing the plug-and-play of information enhancement tools for LLM question-and-answer systems. Summary of the invention

[0005] Purpose of the invention: The present invention provides an LLM-oriented information enhancement tool registration method, which realizes the rapid deployment of external tools and reduces the labor cost of registering tools.

[0006] Invention content: The information enhancement tool registration method for LLM described in the present invention comprises the following steps:

[0007] (1) Based on the interface document submitted by the tool supplier, LLM is used to automatically generate tool description information;

[0008] (2) Generate a tool description file based on the tool description information, including the splicing of parameter filling templates and the construction of tool description files;

[0009] (3) Check the availability of the tool description file. If the check fails, modify the tool description file. If the check succeeds, proceed to step (4).

[0010] (4) Use LLM to classify tools and select them to be registered into existing toolsets or to build new toolsets based on their functions; then register the tools into the corresponding toolsets;

[0011] (5) Dynamic splicing tool call related prompts, including parameter extraction prompt PPrompt, result summary prompt RPrompt, intention recognition prompt IPrompt and tool selection prompt TPrompt;

[0012] (6) The completed prompt is stored as additional information together with the corresponding tool set and tool, completing the registration of the tool and the update of the tool set.

[0013] Furthermore, the implementation process of step (1) is as follows:

[0014] The tool supplier submits the interface document of the tool, which includes the name of the interface, the input and output parameters of the interface, interface call information, parameter extraction examples and interface call instances;

[0015] LLM generates a functional description of the tool, domain background information, input and output parameter descriptions, and result display types based on the interface name and input and output instances.

[0016] Furthermore, the implementation process of step (2) is as follows:

[0017] According to the interface document, the parameter filling template is spliced ​​and the required parameters are marked with placeholders. The parameter filling template is used to provide a template for key parameters so that when the tool needs to be called, the parameters can be directly filled into the template for calling. The parameter filling template determines some irrelevant parameters in advance, allowing the large language model to focus on extracting key parameters.

[0018] Combined with the interface document and the description information generated by LLM, a tool description file is constructed containing the following contents: tool name, domain background information, tool function description, tool call information, parameter extraction example, interface call instance, tool input parameters, parameter filling template, tool output parameters and result display type.

[0019] Furthermore, the implementation process of step (3) is as follows:

[0020] (31) Performing syntax check on the description file, i.e., performing syntax check on the metadata items of the description file according to the JSON Schema of the tool registration template to ensure consistency of the metadata; if not, proceeding to (34) to correct the description file;

[0021] (32) Perform a reachability check on the tool, that is, send a request according to the parameter example of the description file to ensure that the tool can successfully request and obtain the result; if the request fails, enter (34) to modify the description file;

[0022] (33) Performing functional verification on the tool, that is, LLM determines whether the return result of the tool call can meet the function implementation based on the tool's functional description and return value description; if LLM determines that the return result of the tool is inconsistent with the effect in the functional description after comparison, then enter (34) to modify the description file;

[0023] (34) Modify the items in the description file that failed verification and return to (31) after modification.

[0024] Furthermore, the implementation process of step (4) is as follows:

[0025] (41) LLM determines whether the current tool can be classified into a certain toolset based on the existing toolset list and the functional description of the current tool; if so, it proceeds to (43) to register the tool into the existing toolset; if not, it proceeds to (42) to build a new toolset;

[0026] (42) LLM summarizes the functions of tools that cannot be classified at a more abstract level and generates a toolset name, toolset description, and solvable intent; builds a new toolset and then returns to (41);

[0027] (43) The tool description file is automatically registered into the target toolset located after LLM classification, and the toolset description and solvable intent of the relevant toolset are updated.

[0028] Furthermore, the parameter extraction prompt PPrompt in step (5) is used to guide LLM to extract the parameters required by the tool from the user input, which is obtained by dynamically splicing the domain background information, the request parameter description and the parameter extraction example in the description file; the specific content of PPrompt includes:

[0029] Based on the domain background information in the tool description file, provide LLM with the background information for parameter extraction; based on the tool's request parameter description, list the names and meanings of the parameters required by the tool; add the parameter extraction examples in the tool description file to guide LLM to output the parameter extraction results in a specific format.

[0030] Furthermore, the result summary prompt RPrompt in step (5) is used to guide LLM to summarize and display the tool call results; it is obtained by dynamically concatenating the return parameter description, actual return value and result display type in the description file; the specific content of RPrompt includes:

[0031] Describe the user's problem and explain the returned results obtained by calling the current tool; based on the description of the tool return parameters, list the name and meaning of each parameter that needs to be interpreted; provide the actual return value of the tool call and the result display type, prompting LLM to select the appropriate result display type for result summary.

[0032] Furthermore, the intention recognition prompt IPrompt in step (5) is used to guide LLM to select a potential toolset that meets the user's goal based on the user input, which is obtained by dynamically concatenating the names of existing toolsets and resolvable intentions; the specific content of IPrompt is:

[0033] Provide the user's problem and list the names of existing toolsets and the user intent that the corresponding toolsets can solve; prompt LLM to select the toolset that best meets the user's intent from these toolsets.

[0034] Furthermore, the tool selection prompt TPrompt in step (5) is used to guide LLM to locate the tool that can accurately solve the user's problem from the potential tool set; it is obtained by dynamically splicing the names and functional descriptions of the tools in the tool set; the specific content of TPrompt is:

[0035] Provide the user's problem and list the names and functional descriptions of the tools included in the current toolset, prompting LLM to select the tool that can solve the user's problem from these tools.

[0036] Furthermore, the implementation process of step (6) is as follows:

[0037] IPrompt is globally unique, so only one copy needs to be stored and rebuilt when the toolset is updated, and called each time intent is recognized;

[0038] PPrompt and RPrompt are specific to each tool, and each tool stores a copy, which are called when the corresponding tool's parameter extraction and result summary are involved;

[0039] TPrompt is specific to each toolset, one copy is stored for each toolset, and is rebuilt when the tools in the toolset are updated, and called when the tool is selected.

[0040] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects: the present invention uses LLM to automatically generate tool description files, realizes the rapid deployment of external tools, and reduces the labor cost of registering tools; uses LLM to automatically check the availability of the generated description files, identifies incomplete description files, and ensures that the registered tools can be effectively called; uses LLM to automatically classify tools into different tool sets, and can generate new tool sets based on the tools, narrowing the scope of tool selection and improving the reliability of intent recognition; the prompt automatically generated based on the description file further simplifies the service integration process and reduces the cost of manually constructing the prompt; in addition, the method of designing a parameter filling template shields non-essential parameters in the tool, reduces the requirement for LLM's ability to extract parameters, and improves the success rate of tool calls. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a flow chart of the present invention;

[0042] Figure 2 A schematic diagram of the method for generating tool description files based on LLM;

[0043] Figure 3 It is a schematic diagram of the tool description file availability check method based on LLM;

[0044] Figure 4Schematic diagram of LLM-based tool classification and tool set generation method. DETAILED DESCRIPTION

[0045] The technical solution of the invention is described in detail below with reference to the accompanying drawings.

[0046] like Figure 1 As shown, the present invention proposes a registration method for an information enhancement tool oriented to LLM, taking a query tool integrating the latest water level monitoring value of a measuring station as an example, comprising the following steps:

[0047] Step 1: Use LLM to automatically generate tool description information.

[0048] Step 1-1: The tool supplier submits the interface document of the tool. The interface document should include the name of the interface, the input and output parameters of the interface, interface call information, parameter extraction examples and interface call instances. Among them:

[0049] The interface name is a descriptive name that can express the meaning of the interface function, usually not more than 20 characters, such as "Real-time water level query of measuring station".

[0050] The interface input and output parameters should include the parameter variable name, data type, whether it is required, and the sample value; for example, the variable name of the input parameter station name is "stName", the data type is "String", whether it is required is "True", and the sample value is "X Station".

[0051] The interface call information should include the interface request type (GET / POST) and the request URL; for example, the interface request type for real-time water level query at the measuring station is "GET" and the request URL is "http: / / 127.0.0.1:8080 / api / getStWaterLevel".

[0052] The parameter extraction example refers to an example of extracting the parameters required by the interface from the user question, which includes a user question and the parameter results extracted from the question; for example, "{question: "Help me query the real-time water level information of X station", answer: {"station name": "X station"}}".

[0053] The interface call instance is the input parameters and output parameters when actually requesting the interface, which should be in JSON format; for example, the input parameter is "{"stName":"X station"}", and the output parameter is "{"waterLevel":"20m","time":"2024-01-01 / 12:00:00"}".

[0054] Step 1-2: Provide the interface name and interface input and output instances in the interface document to LLM to guide the LLM reasoning tool to generate the function description, domain background information, input and output parameter description, and result display type.

[0055] The functional description of a tool consists of the conditions for calling the tool and possible calling results; for example, "query the real-time water level information of a station according to the station name".

[0056] Domain background information refers to the name label of the domain involved in the tool. Each tool should have more than two background labels; for example, "water conservancy object" and "real-time water level".

[0057] The input and output parameter descriptions contain descriptions of the meanings of the parameters, which are provided to LLM so that it can understand the meanings of the parameters to be extracted; for example, the description of the input parameter "stName" should be "station name", and the description of the output parameter "waterLevel" should be "real-time monitoring of water level".

[0058] The result display type refers to the display method that should be used for the returned results. It is an enumeration item, including data display methods such as text, statistical graphs, and tables. For example, the result display type of the real-time water level interface of the measuring station is "text".

[0059] Step 2, such as Figure 2 As shown, a tool description file is constructed according to the interface document information and the tool description information generated in step 1.

[0060] Step 2-1, according to the interface call method, request URL and required parameter information in the interface document, the parameter filling template is spliced, where the sample values ​​of non-required parameters are directly filled into the template, and the required parameters are filled with placeholders. In subsequent calls, the parameters extracted by LLM from the user's question are filled into the placeholders to call the tool. For example, the station real-time water level query tool is the GET method, and the parameter filling template should be a template with a request path:

[0061] “http: / / 127.0.0.1:8080 / api / getStWaterLevel?stName={$stName}¶m1=param¶m2=param”. {$stName} is a placeholder used to replace the actual station name parameter. The other parameters do not need to be modified by the user and can be directly filled in the template.

[0062] Step 2-2, automatically build the tool description file by combining the interface document and the tool description information generated by LLM. The tool description file contains the following contents:

[0063] Tool name, filled directly by the interface name in the interface document; domain background information, filled by the background label generated by LLM; tool function description, filled by the tool function description generated by LLM; tool call information, filled by the interface call information in the interface document; parameter extraction example, filled by the interface call information in the interface document. Interface call instance, filled by the interface call instance in the interface document; tool input parameters, composed of the input parameter information contained in the interface document and the description of the parameters generated by LLM; parameter filling template, filled by the parameter filling template constructed in step 2-1; tool output parameters, composed of the output parameter information contained in the interface document and the description of the parameters generated by LLM; result display type, filled by the result display type generated by LLM.

[0064] Step 3, such as Figure 3 As shown, the tool description file is checked for availability, including syntax checking, reachability checking, and function checking.

[0065] Step 3-1: Check the syntax of the tool description file. Specifically, use the JSON Schema of the description file standard template to check the description file generated in step 2 to ensure that the metadata items are consistent. If the syntax check fails, proceed to step 3-4.

[0066] Step 3-2: Perform a reachability check on the tool description file. Specifically, use the request parameters in the interface call instance to send a request to ensure that the tool can successfully request and obtain the result, and that the return value is consistent with the structure description in the description file. If the reachability check fails, proceed to step 3-4.

[0067] Step 3-3, perform a functional check on the tool description file. Specifically, use LLM reasoning to generate the meaning information contained in the return value obtained in step 3-2, and compare it with the functional description of the tool in the description file to determine whether the return value can meet the function implementation. If the functional check fails, proceed to step 3-4.

[0068] The prompts for specific instructions on LLM to perform functional verification can be found as follows (the content in [ ] is the content that needs to be spliced, the same below):

[0069] "You are now a tool usability check expert. You need to judge whether the return value of the tool meets the tool's functional description based on the given tool return value, tool return parameter description and tool functional description. If it meets, return "True", if it does not meet, return "False". Please note that you should not reply with other content.

[0070] * Tool return value:

[0071]

```{data:{"waterLevel":"20m","time":"2024-01-01 / 12:00:00"}}```

[0072] * Tool output parameter description:

[0073]

【-"waterLevel"->"Real-time water level value";

[0074] -"time"->"Monitoring time";】

[0075] *Tool function description: [Query the real-time water level information of the measuring station according to the measuring station name]

[0076] ”

[0077] Step 3-4, check whether the availability check fails:

[0078] If it exists, modify the items in the description file that failed the verification, and return to step 3-1 after the modification; if it does not exist, the verification is successful and go to step 4.

[0079] Step 4, such as Figure 4 As shown in the figure, tool classification and toolset generation based on LLM.

[0080] Step 4-1, instruct LLM to determine whether the current tool can be classified into a tool set based on the existing tool set list and the functional description of the current tool. The specific prompt is as follows:

[0081] "Please select the toolset that best matches the functional description for the current tool based on the following toolset description and the functional description of the current tool. If the corresponding toolset is found, the corresponding toolset name will be returned directly; if the corresponding toolset is not found, "Classification failed" will be returned. Please do not force classification:

[0082] *Toolset List:

[0083] [-Knowledge base query: search for documents and ask questions in the professional knowledge base]

[0084] *Current tool function description:

[0085] [Query the real-time water level information of the measuring station according to the measuring station name]"

[0086] If yes, proceed to step 4-3 to register the tool into the existing toolset; if no, proceed to step 4-2 to build a new toolset.

[0087] In step 4-2, LLM summarizes the functions of the tools that cannot be classified at a more abstract level and generates the tool set name, tool set description, and solvable intent. Specifically, the tool name, function description, and domain background information are provided as input information to LLM, and LLM is used to generate the above three information. The generation requirements for LLM prompts are:

[0088] The toolset name refers to a descriptive name for the common functions of the tools, usually no more than 20 characters. It is more abstract and general than the tool name. For example, the toolset name that can be generated for the real-time water level query tool of the measuring station is "Water Level Query for Water Conservancy Objects".

[0089] The toolset description refers to the description of the tools in the toolset, including the number of tools and a summary of the tool functions. For example, the description of the tool status is “Real-time water level query of the measuring station: query the real-time water level information of the measuring station according to the measuring station name”, the number of tools is “1”, and the summary of the tool function is “Includes an interface that can query the real-time water level information of water conservancy objects”.

[0090] Solvable intent refers to the user intent that a toolset can solve. It is generated based on the functions of the tools in the toolset and describes what types of user problems the toolset can solve. For example, the solvable intent of the "Water Level Query of Water Conservancy Objects" toolset is "Query the real-time water level of a water conservancy object based on the name of the water conservancy object."

[0091] After the new toolset is built, return to step 4-1.

[0092] Step 4-3, register the tool description file to the target toolset located after LLM classification, and use LLM to update the toolset description and solvable intent of the relevant toolset according to the newly added tools.

[0093] Step 5: The dynamic stitching tool calls the relevant prompt.

[0094] Step 5-1, construct parameter extraction PPrompt. PPrompt is unique to each tool and is constructed by dynamically concatenating domain background information, request parameter description, and parameter extraction examples in the description file. The specific contents include:

[0095] According to the domain background information in the tool description file, LLM is prompted to extract parameters based on the background tags; secondly, according to the tool's request parameter description, the names of the parameters required by the tool and their meanings are listed; finally, the parameter extraction examples in the tool description file are added to guide LLM to output the parameter extraction results in a specific format.

[0096] The actual prompt content can be found as follows:

[0097] "You are an expert in [water conservancy objects] and [real-time water levels]. You are good at using the [real-time water level query at a measuring station] tool to [query the real-time water level information at a measuring station based on the measuring station name] to help solve customer problems.

[0098] The input format of [Real-time water level query of measuring station] is JSON format, and the specific format is as follows:

[0099]

{"Tool name":"Real-time water level query of measuring station","Measurement station name":""}

[0100] The parameters in "" need to be obtained from the user's question.

[0101] You now need to use [Real-time water level query at the measuring station] to help solve the user's problem

[0102] Your response must contain only JSON".

[0103] Step 5-2, build the result summary RPrompt. RPrompt is unique to each tool and is constructed by dynamically concatenating the return parameter description, actual return value, and result display type in the description file. The specific contents include:

[0104] Describe the user's problem and explain the returned results obtained by calling the current tool; secondly, based on the description of the tool return parameters, list the name and meaning of each parameter that needs to be interpreted; finally, provide the actual return value of the tool call and the result display type, prompting LLM to select the appropriate result display type for result summary.

[0105] The actual prompt content can be found as follows:

[0106] "You are an expert in summarizing results. You are good at packaging raw data into smooth, coherent and logical sentences. The user raised a question related to [water conservancy object] [real-time water level]. After using [real-time water level query of measuring station], we got the final JSON return result. The JSON return result is as follows:

[0107] [```{data:{"waterLevel":"20m","time":"2024-01-01 / 12:00:00"}}```] There are many fields in the returned results. The meanings of some key fields are:

[0108]

【-"waterLevel"->"Real-time water level value";

[0109] -"time"->"Monitoring time";】

[0110] The above are the returned results and corresponding explanations. The user’s initial question is: [Help me query the real-time water level information of X station]

[0111] Please organize and package them so that they return directly to smooth, coherent, and logical sentences. Please do not mention anything I have not provided, nor any hints. "

[0112] Step 5-3, build the intent recognition IPrompt. IPrompt is globally unique and needs to be updated synchronously every time the toolset is updated. It is obtained by dynamically splicing the name of the existing toolset and the solvable intent. The specific content is:

[0113] Provide the user's problem and list the names of existing toolsets and the user intent that the corresponding toolsets can solve. Prompt LLM to select the toolset that best meets the user's intent from these toolsets.

[0114] The actual prompt content can be found as follows:

[0115] “You are now a question classifier. I need you to classify questions instead of answering them directly.

[0116] These questions are [Knowledge Base Q&A], [Water Level Query for Water Conservancy Objects]

[0117] When the question involves professional knowledge, common sense, rules and regulations, speeches, government documents, and news, it can be considered as a "knowledge base question and answer"

[0118] -When the question involves querying the real-time water level of a water conservancy object based on the name of the water conservancy object, it can be considered that the question belongs to "water conservancy object water level query"]

[0119] You need to choose one of the above [2] types of questions.

[0120] The output format of your answer is JSON, the key is "question type", and the value is your classification result, for example {"question type":"water level query of water conservancy object"}

[0121] Your response must contain only a JSON string and nothing else. ".

[0122] Step 5-4, select TPrompt as the build tool. TPrompt is unique to each toolset and is obtained by dynamically concatenating the tool names and function descriptions in the toolset. The specific contents are:

[0123] Provide the user's problem and list the names and functional descriptions of existing tools, prompting LLM to select the tool that can solve the user's problem.

[0124] The actual prompt content can be found as follows:

[0125] "You now have [2] tools to help solve user problems, namely [Real-time water level query at a measuring station] and [Real-time water level query at a reservoir]. Usually, to solve user problems, you can select one or more of the following call behaviors based on the intent of the user's problem:

[0126] 【-Use "Real-time water level query of measuring station" to query the real-time water level information of the measuring station according to the measuring station name;

[0127] - Use "Reservoir Real-time Water Level Query" to query the reservoir real-time water level information according to the reservoir name;]

[0128] You do not need to answer user questions or call these [2] tools now. Instead, you need to split the user's questions according to the tools and list them in order. You need to generate a JSON to represent the tool call. For each tool, you need to describe the call expectations of using this tool, that is, what to use this tool for. Your answer must be in JSON format. The answer format is as follows. The part enclosed by <> is the content you need to fill in according to your own judgment:

[0129] {[{"Tool call":"<Tool name 1>","Call expectation":"<Call expectation generated based on user questions>"},{"Tool call":"<Tool name 2>","Call expectation":"<Call expectation generated based on user questions>"},...]}".

[0130] Step 6: Store the completed prompt as additional information together with the corresponding toolset and tool, completing the registration of the tool and the update of the toolset. Specifically:

[0131] IPrompt is globally unique and only needs to be stored separately. It is rebuilt when the toolset is updated and called every time intent is recognized.

[0132] PPrompt and RPrompt are specific to each tool, and one copy is stored for each tool, which are called when it comes to parameter extraction and result summary of the corresponding tool.

[0133] TPrompt is specific to each toolset, one copy is stored for each toolset, and is rebuilt when the tools in the toolset are updated, and called when the tool is selected.

[0134] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.

Claims

1. A registration method for an information enhancement tool for LLM, characterized in that: The following steps are involved: (1) Based on the interface document submitted by the tool supplier, LLM is used to automatically generate tool description information; (2) Generate a tool description file based on the tool description information, including the splicing of parameter filling templates and the construction of tool description files; (3) Check the availability of the tool description file. If the check fails, modify the tool description file. If the check succeeds, proceed to step (4). (4) Use LLM to classify tools and select them to be registered into existing toolsets or to build new toolsets based on their functions; then register the tools into the corresponding toolsets; (5) Dynamic splicing tool call related prompts, including parameter extraction prompt PPrompt, result summary prompt RPrompt, intention recognition prompt IPrompt and tool selection prompt TPrompt; (6) The completed prompt is stored as additional information together with the corresponding tool set and tool, completing the registration of the tool and the update of the tool set.

2. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The implementation process of step (1) is as follows: The tool supplier submits the interface document of the tool, which includes the name of the interface, the input and output parameters of the interface, interface call information, parameter extraction examples and interface call instances; LLM generates a functional description of the tool, domain background information, input and output parameter descriptions, and result display types based on the interface name and input and output instances.

3. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The implementation process of step (2) is as follows: According to the interface document, the parameter filling template is spliced ​​and the required parameters are marked with placeholders. The parameter filling template is used to provide a template for key parameters so that when the tool needs to be called, the parameters can be directly filled into the template for calling. The parameter filling template determines some irrelevant parameters in advance, allowing the large language model to focus on extracting key parameters. Combined with the interface document and the description information generated by LLM, a tool description file is constructed containing the following contents: tool name, domain background information, tool function description, tool call information, parameter extraction example, interface call instance, tool input parameters, parameter filling template, tool output parameters and result display type.

4. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The implementation process of step (3) is as follows: (31) Performing syntax check on the description file, i.e., performing syntax check on the metadata items of the description file according to the JSON Schema of the tool registration template to ensure consistency of the metadata; if not, proceeding to (34) to correct the description file; (32) Perform a reachability check on the tool, that is, send a request according to the parameter example of the description file to ensure that the tool can successfully request and obtain the result; if the request fails, enter (34) to modify the description file; (33) Performing functional verification on the tool, that is, LLM determines whether the return result of the tool call can meet the function implementation based on the tool's functional description and return value description; if LLM determines that the return result of the tool is inconsistent with the effect in the functional description after comparison, then enter (34) to modify the description file; (34) Modify the items in the description file that failed verification and return to (31) after modification.

5. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The implementation process of step (4) is as follows: (41) LLM determines whether the current tool can be classified into a certain toolset based on the existing toolset list and the functional description of the current tool; if so, it proceeds to (43) to register the tool into the existing toolset; if not, it proceeds to (42) to build a new toolset; (42) LLM summarizes the functions of tools that cannot be classified at a more abstract level and generates a toolset name, toolset description, and solvable intent; builds a new toolset and then returns to (41); (43) The tool description file is automatically registered into the target toolset located after LLM classification, and the toolset description and solvable intent of the relevant toolset are updated.

6. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The parameter extraction prompt PPrompt in step (5) is used to guide LLM to extract the parameters required by the tool from the user input, which is obtained by dynamically splicing the domain background information, the request parameter description and the parameter extraction example in the description file; The specific contents of PPrompt include: Based on the domain background information in the tool description file, provide LLM with the background information for parameter extraction; based on the tool's request parameter description, list the names and meanings of the parameters required by the tool; add the parameter extraction examples in the tool description file to guide LLM to output the parameter extraction results in a specific format.

7. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The result summary prompt RPrompt in step (5) is used to guide LLM to summarize and display the tool call results; It is obtained by dynamically concatenating the return parameter description, actual return value and result display type in the description file; The specific contents of RPrompt include: Describe the user's problem and explain the results obtained by calling the current tool; based on the description of the tool's return parameters, list the name and meaning of each parameter that needs to be interpreted; Provide the actual return value of the tool call and the result display type, prompting LLM to select the appropriate result display type for result summary.

8. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The intention recognition prompt IPrompt in step (5) is used to guide LLM to select a potential toolset that meets the user's goal based on the user input, and is obtained by dynamically concatenating the names of existing toolsets and resolvable intentions; the specific content of IPrompt is: Provide the user's problem and list the names of existing toolsets and the user intent that the corresponding toolsets can solve; prompt LLM to select the toolset that best meets the user's intent from these toolsets.

9. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The tool selection prompt TPrompt in step (5) is used to guide LLM to locate the tool that can accurately solve the user's problem from the potential tool set; it is obtained by dynamically splicing the names and functional descriptions of the tools in the tool set; the specific content of TPrompt is: Provide the user's problem and list the names and functional descriptions of the tools included in the current toolset, prompting LLM to select the tool that can solve the user's problem from these tools.

10. The LLM-oriented information enhancement tool registration method according to claim 1, characterized in that: The implementation process of step (6) is as follows: IPrompt is globally unique, so only one copy needs to be stored and rebuilt when the toolset is updated, and called each time intent is recognized; PPrompt and RPrompt are specific to each tool, and each tool stores a copy, which are called when the corresponding tool's parameter extraction and result summary are involved; TPrompt is specific to each toolset, one copy is stored for each toolset, and is rebuilt when the tools in the toolset are updated, and called when the tool is selected.

Citation Information

Cited By

  • Tool deployment method, system and equipment based on model context protocol

    CN121255215A

  • A model context protocol-based tool deployment method, system and device

    CN121255215B