Search

CN-121997063-A - Tool determining method and related device based on large language model

CN121997063ACN 121997063 ACN121997063 ACN 121997063ACN-121997063-A

Abstract

The application discloses a tool determining method based on a large language model and a related device, and relates to the field of artificial intelligence, wherein the method comprises the steps of obtaining a natural sentence which is input by a user and used for describing a task to be executed, and analyzing and operating the natural sentence by adopting the large language model to obtain task demand description; the method comprises the steps of converting task demand description into task demand vectors to obtain a vector similarity value table containing vector similarity values of all tools, extracting keywords in the task demand description to obtain a semantic similarity value table containing semantic similarity values of all tools, carrying out weighted calculation by using the vector similarity value table and the semantic similarity value table to obtain respective weighted scores of all tools, and determining tools for solving tasks input by users from the k tools according to the function matching degree, parameter compatibility and output result matching degree of the k tools with the highest weighted scores. The application realizes the purpose of improving the efficiency and accuracy of tool determination based on a large language model.

Inventors

  • LIU PENG
  • CUI XIUYUAN
  • YAO BIN

Assignees

  • 青岛巨商汇网络科技有限公司

Dates

Publication Date
20260508
Application Date
20251231

Claims (10)

  1. 1. A method for determining tools based on a large language model, comprising: acquiring natural sentences which are input by a user and are used for describing tasks to be executed, and analyzing the natural sentences by adopting a large language model to obtain task demand description; Converting the task demand description into a task demand vector, and calculating a vector similarity value between a function description vector of a tool in a preset tool library and the task demand vector to obtain a vector similarity value table containing the vector similarity value of each tool; extracting keywords in the task demand description, and calculating semantic similarity values of function labels of tools in a preset tool library and the keywords to obtain a semantic similarity value table containing the semantic similarity values of each tool; respectively carrying out weighted calculation on the vector similarity value and the semantic similarity value of each tool by using the vector similarity value table and the semantic similarity value table to obtain respective weighted scores of the tools; and determining the tool for solving the task input by the user from the k tools according to the function matching degree, parameter compatibility and output result matching degree of the k tools with the highest weighted scores.
  2. 2. The method for determining tools based on large language model according to claim 1, wherein the converting the task requirement description into a task requirement vector, and calculating a vector similarity value between a function description vector of a tool in a preset tool library and the task requirement vector, to obtain a vector similarity value table containing a vector similarity value of each tool, includes: invoking a semantic embedding model to carry out vectorization operation on the task demand description, and generating a task demand vector; Storing function description vectors with similarity higher than a threshold value in function description vectors of tools in a preset tool library into the same set by adopting a local sensitive hash function to obtain a plurality of sets containing the function description vectors of the tools, and determining the set closest to the task demand vector; and calculating the similarity value of the function description vector and the task demand vector in the set closest to the task demand vector, and generating a vector similarity value table.
  3. 3. The method for determining tools based on large language model according to claim 1, wherein the extracting the keywords in the task demand description and calculating the semantic similarity value between the function labels of the tools in the preset tool library and the keywords to obtain the semantic similarity value table containing the semantic similarity value of each tool comprises: Extracting keywords related to task targets and required capabilities from the task demand description; Obtaining functional labels corresponding to tools in a preset tool library, calculating semantic similarity between the keywords and each functional label based on a semantic similarity model, and generating a semantic similarity value table.
  4. 4. The large language model based tool determination method of claim 1, further comprising: if the determined tool for solving the task input by the user is a single tool, directly calling the single tool; and if the determined tools for solving the task input by the user are a plurality of tools, calling a large language model to combine the plurality of tools based on the task demand description to obtain a tool chain.
  5. 5. The large language model based tool determination method of claim 1, further comprising: invoking a task finder to analyze a newly released tool to obtain an analysis file of the newly released tool; invoking the large language model to perform function understanding operation on the analysis file to obtain a function description vector and a function label; And storing the newly released tool and the function description vector and the function label of the newly released tool together into a preset tool library.
  6. 6. The large language model based tool determining method according to claim 5, wherein storing the newly released tool and the function description vector and the function tag of the newly released tool together in a preset tool library comprises: Assigning a unique tool identifier to the newly released tool; And associating the tool identifier of the newly released tool with the corresponding function description vector and function label, and storing the tool identifier and the corresponding function description vector and function label into a preset tool library.
  7. 7. A large language model based tool determination apparatus, comprising: The data acquisition module is used for acquiring natural sentences which are input by a user and used for describing tasks to be executed, and analyzing and operating the natural sentences by adopting a large language model to acquire task demand description; The vector conversion module is used for converting the task demand description into a task demand vector, and calculating a vector similarity value of a function description vector of a tool in a preset tool library and the task demand vector to obtain a vector similarity value table containing the vector similarity value of each tool; The keyword extraction module is used for extracting keywords in the task demand description, calculating semantic similarity values of function labels of tools in a preset tool library and the keywords, and obtaining a semantic similarity value table containing the semantic similarity values of each tool; The weighting module is used for respectively carrying out weighting calculation on the vector similarity value and the semantic similarity value of each tool by utilizing the vector similarity value table and the semantic similarity value table to obtain respective weighting scores of the tools; And the tool determining module is used for determining tools for solving the task input by the user from the k tools according to the function matching degree, the parameter compatibility and the output result matching degree of the k tools with the highest weighted scores.
  8. 8. A computer program product comprising computer readable instructions which, when run on an electronic device, cause the electronic device to implement the large language model based tool determination method of any one of claims 1 to 6.
  9. 9. An electronic device comprising at least one processor and a memory coupled to the processor, wherein: the memory is used for storing a computer program; The processor is configured to execute the computer program to enable the electronic device to implement the large language model based tool determination method as claimed in any one of claims 1 to 6.
  10. 10. A computer storage medium carrying one or more computer programs which, when executed by an electronic device, enable the electronic device to implement the large language model based tool determination method of any one of claims 1 to 6.

Description

Tool determining method and related device based on large language model Technical Field The application relates to the technical field of artificial intelligence, in particular to a tool determining method based on a large language model and a related device. Background With the development of large language models and intelligent agent technologies, more and more application systems accomplish complex tasks, such as data query, file processing, information analysis, automation operation, etc., by calling external tools. In the prior art, the selection of tools usually depends on manual configuration rules, keyword matching or fixed tool mapping relations, and when a user describes task requirements through natural language, it is often difficult to accurately understand task intent and select the most suitable tool from a large number of tools. Thus, there is a need for a method that improves the efficiency and accuracy of tool determination. Disclosure of Invention In view of the above problems, the present application provides a tool determining method based on a large language model and a related device, so as to achieve the purpose of improving the efficiency and accuracy of tool determination. The specific scheme is as follows: The first aspect of the application provides a tool determination method based on a large language model, comprising the steps of obtaining natural sentences which are input by a user and are used for describing tasks to be executed, and analyzing and operating the natural sentences by adopting the large language model to obtain task demand description; Converting task demand description into task demand vectors, and calculating vector similarity values of function description vectors of tools in a preset tool library and the task demand vectors to obtain a vector similarity value table containing the vector similarity values of each tool; extracting keywords in task demand description, and calculating semantic similarity values of function labels of tools in a preset tool library and the keywords to obtain a semantic similarity value table containing the semantic similarity values of each tool; respectively carrying out weighted calculation on the vector similarity value and the semantic similarity value of each tool by using a vector similarity value table and a semantic similarity value table to obtain respective weighted scores of the tools; And determining the tool for solving the task input by the user from the k tools according to the function matching degree, parameter compatibility and output result matching degree of the k tools with the highest weighted scores. Optionally, converting the task demand description into a task demand vector, and calculating a vector similarity value between a function description vector of a tool in a preset tool library and the task demand vector to obtain a vector similarity value table containing the vector similarity value of each tool, including: invoking a semantic embedding model to carry out vectorization operation on task demand description, and generating a task demand vector; storing function description vectors with similarity higher than a threshold value in function description vectors of tools in a preset tool library into the same set by adopting a local sensitive hash function to obtain a plurality of sets containing the function description vectors of the tools, and determining the set closest to the task demand vector; and calculating similarity values of the function description vectors and the task demand vectors in the set closest to the task demand vectors, and generating a vector similarity value table. Optionally, extracting a keyword in the task demand description, and calculating a semantic similarity value between a function tag of a tool in a preset tool library and the keyword to obtain a semantic similarity value table containing the semantic similarity value of each tool, where the method includes: Extracting keywords related to task targets and required capabilities from task demand descriptions; Obtaining function labels corresponding to tools in a preset tool library, calculating semantic similarity between keywords and each function label based on a semantic similarity model, and generating a semantic similarity value table. Optionally, the method further comprises directly calling a single tool if the determined tool for solving the task input by the user is the single tool; and if the determined tools for solving the task input by the user are a plurality of tools, calling a large language model to combine the plurality of tools based on the task demand description, and obtaining a tool chain. Optionally, the method further comprises the steps of calling a task finder to analyze the newly released tool to obtain an analysis file of the newly released tool; Calling a large language model to perform function understanding operation on the analysis file to obtain a function description vector and a fun