An agent tool invocation decision method based on problem scenarios

By optimizing tool invocation decisions through scene feature modeling and a large model self-evaluation mechanism, the ambiguity and resource waste in tool invocation by large model agents are resolved, thereby achieving improved accuracy and adaptive optimization.

CN121542307BActive Publication Date: 2026-04-10QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-19
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In existing technologies, large model agents suffer from unclear tool invocation triggering conditions, lack of constraints on tool selection and combination, and difficulty in adaptive optimization according to problem scenarios, resulting in redundant invocation, response delays, and resource waste.

Method used

By modeling the scenario characteristics of user problems, we can build a tool call experience base, prioritize judging whether to call tools and which tools to call based on historical experience, and introduce a large model self-evaluation mechanism to make a fallback decision when experience is insufficient.

Benefits of technology

It effectively reduces redundant tool calls, improves tool call accuracy, reduces response latency and saves system resources, and can adaptively optimize tool call strategies when the amount of interaction increases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542307B_ABST
    Figure CN121542307B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of agent tool invocation decision method based on problem scenario, belong to artificial intelligence field, including: obtaining user problem, forms problem scene feature;External tool is registered and standardized description;Tool invocation experience base is constructed, and corresponding scene cluster is formed by clustering;In each scene cluster, the number of attempts and the number of successes of different tool invocation strategies are counted, and success rate is calculated;For current problem, retrieve similar scene cluster from tool invocation experience base, obtain candidate strategy set;According to success rate comparison, it is decided whether to answer directly or to call tool subset;Trigger big model self-evaluation mechanism;Execute tool invocation to generate answer and write back experience.The present application models the scene features of user problems, builds a tool invocation experience base, and determines whether to call tools and which tools to call based on historical experience first. When the experience is insufficient or the experience conclusion is not clear, a big model self-evaluation mechanism is introduced for fallback decision.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to an agent tool invocation decision method based on a problem scenario and belongs to the technical field of artificial intelligence. BACKGROUND

[0002] With the rapid development of artificial intelligence technology and natural language processing technology, large-scale language models have been widely used in question and answer dialogues, code generation, document writing and other scenarios. The mode of relying only on internal parameters of the model for reasoning can achieve good performance in general knowledge question and answer, common sense reasoning and other tasks. However, for tasks involving real-time information acquisition, structured data query, complex calculation, business system operation and the like, it is often difficult to meet the requirements of accuracy, timeliness and controllability by simply relying on the knowledge of the large model itself.

[0003] In view of the above problems, the industry has proposed various "tool-enhanced" large model agent solutions, which pre-configure a group of external tools, such as calculators, database query interfaces, search engines, business backend APIs, etc., and decide whether to call the relevant tools during reasoning to obtain supplementary information or perform specific operations. In the prior art, the mainstream approach includes: routing specific types of problems to specified tools through rules; injecting tool descriptions into prompt words, so that the large model can "spontaneously" select tools in the dialogue; or fine-tuning the model with a small number of samples to enable it to learn to insert tool invocation instructions during the answering process.

[0004] Although the above solutions improve the ability of large models to handle complex tasks to some extent, in actual applications, the system usually implicitly puts the tool invocation logic in the prompt words or the chain reasoning process. In many cases, even if the large model can give an accurate enough answer based on its own knowledge, it will still trigger additional tool invocation, causing redundant invocation, increased response delay and unnecessary consumption of system resources. The requirements for timeliness, accuracy, and interactive fluency vary greatly in different industries and business scenarios, but the existing tool invocation strategies are often static and lack the ability to adaptively adjust strategies based on problem scenarios and historical effects. For example, in some scenarios, the system should encourage the large model to rely on its own knowledge first and reduce unnecessary tool invocation, while in other scenarios, it should be more proactive in combining specific tools to ensure the reliability of the results. The existing technology is difficult to automatically adjust "when to call tools and which tools to call" according to the differences in scenarios and historical experience. SUMMARY

[0005] In view of the problems of the prior art that the trigger condition of tool calling of a large model agent is not clear, the tool selection and combination lack constraints, and the tool calling strategy is difficult to adaptively optimize according to a problem scene, the present application provides an agent tool calling decision method based on a problem scene, which models the scene features of a user problem, constructs a tool calling experience library, and determines whether a tool needs to be called and which tool needs to be called based on historical experience; when the experience is insufficient or the experience conclusion is not clear, a lightweight large model self-evaluation mechanism is introduced to make a bottom decision.

[0006] The present application adopts the following technical solutions:

[0007] An agent tool calling decision method based on a problem scene, comprising:

[0008] S1, obtaining a user problem, extracting a problem category, a semantic vector and a context, and forming a problem scene feature;

[0009] S2, in a deployment stage or a preset stage in a running process, uniformly registering and standardizing describing external tools called by a large model agent;

[0010] S3, based on the interaction records of a large model agent and a user in historical tasks, constructing a tool calling experience library, and performing cluster management to form corresponding scene clusters and generate a scene cluster metadata table;

[0011] S4, in each scene cluster, counting the number of attempts and the number of successes of different tool calling strategies in the scene cluster, and calculating the success rates of different tool calling strategies;

[0012] S5, for a current problem, retrieving similar scene clusters from the tool calling experience library to obtain a candidate strategy set;

[0013] S6, preferentially comparing according to the success rates of the experience library to determine whether to directly answer, call which tool subset, or determine that the experience is insufficient or the conclusion is not clear;

[0014] S7, when it is determined in step S6 that the experience is insufficient or the conclusion is not clear, triggering a large model self-evaluation mechanism to determine whether a tool needs to be called as a bottom;

[0015] S8, executing tool calling, generating an answer and writing back experience.

[0016] Preferably, in step S1, the system receives a user input problem q, including a natural language problem and associated conversation context information, performs semantic analysis and vector encoding on the problem q to obtain a semantic vector , which is used to represent fine-grained semantic information of the problem;

[0017] Dividing the question into at least one question category by pre-designed classification rules The question category includes general knowledge question answering, mathematical and logical calculation, real-time information query, structured data query, operation execution and other business related categories.

[0018] Extracting context features from the current session history, system configuration and user explicit instructions to represent the dialogue environment and constraints in which the question is located.

[0019] Combining the question category, semantic vector and context features to form the current question scenario features :

[0020] .

[0021] Preferably, in step S2, for each external tool, the system assigns a unique tool identification tool_id, and records the function description of the external tool and the adaptive question category information to represent the typical question types that the tool is suitable for solving; The system also records the input and output parameter forms of each external tool and the return result structure type, so that the calling parameters can be correctly constructed and the return result can be parsed when the tool is called subsequently.

[0022] Preferably, in step S3, whenever a task is completed, a piece of experience record is formed based on the task, which includes the question scenario features , the tool calling strategy adopted and the task effect index result_metrics obtained;

[0023] The tool calling strategy includes not calling any tool, calling a tool subset composed of one or more external tools and the calling order tool_set.

[0024] The task effect index result_metrics includes whether the task is successful task_success, the result correctness score correctness_score, and whether multiple rounds of revision or follow-up questions are needed need_revision.

[0025] Clustering according to the semantic vector and the context features , specifically:

[0026] For two records , , calculate the semantic similarity and the context feature similarity :

[0027]

[0028]

[0029] wherein, represents the semantic vector of the record ; represents the semantic vector of the record ; represents the context feature of the record ; represents the context feature of the record ; represents the cosine similarity function;

[0030] calculates the comprehensive similarity index :

[0031]

[0032] wherein, is a semantic similarity weight coefficient, is a context feature similarity weight coefficient, > 0 , + = 1;

[0033] When > threshold τ, it is classified into the same scene cluster and is updated in real time.

[0034] Preferably, in step S4, the number of attempts and the number of successes of each type of strategy in the scene cluster are counted respectively, the strategy not calling any tool and the strategy calling one or more external tools to form a tool subset, and the success rate is the ratio of the number of successes to the total number of attempts.

[0035] Preferably, in step S5, when a new user question is received, after the question scene feature is constructed, firstly, the same or similar scene cluster set is filtered out according to the question category, and then the similarity between the question scene feature and the semantic center vector of each scene cluster is calculated based on the scene cluster metadata table, and several scene clusters with a similarity higher than a preset threshold are selected as a similar scene cluster set, wherein the semantic center vector is the mean of the semantic vectors of all questions in the scene cluster.

[0036] In the similar scene cluster set, all recorded tool calling strategies are collected, the expected success rate of each tool calling strategy on the current question is inferred, and thus a candidate strategy set for the current question is constructed.

[0037] ​Preferably, in step S6, firstly, it is checked whether there is a strategy of not calling any tool in the candidate strategy set, and it is judged whether the expected success rate of the strategy is related to the preset threshold b, if the expected success rate reaches or exceeds the preset threshold b, the system considers that the current problem can be solved directly by the large model internal knowledge in history, so as to decide not to call any tool, and the large model directly generates an answer;

[0038] If the expected success rate is lower than the preset threshold b, and the expected success rate of the strategy of calling external tools is obviously better than that of the strategy of not calling any tool, the tool subset corresponding to the strategy of calling external tools is selected as the tool calling scheme of the current problem;

[0039] When the sample size of the similar scenario cluster set is small, or the expected success rates of the candidate strategies in the candidate strategy set are not obviously different, it is determined that the experience is insufficient or the conclusion is not clear, and step S7 is entered.

[0040] Preferably, the large model self-evaluation mechanism in step S7 is:

[0041] The large model is required to judge whether it has enough information to generate a reliable answer without calling any external tool, and the large model selects one of the two options of directly answering or calling external tools according to the understanding of the problem;

[0042] If the large model self-evaluation is direct answer, the system determines that the current problem does not need to call external tools;

[0043] If the large model self-evaluation considers that external tools need to be called, a tool calling strategy is formulated and executed according to the actual problem, the final result is obtained, and the execution process is stored as new experience.

[0044] Preferably, after the tool calling task is completed in step S8, a new experience record is constructed according to whether the task is successful, user feedback and other information, and the experience record is written into the tool calling experience library, and the success rate of the strategy in the corresponding scenario cluster is updated, so as to realize continuous accumulation of tool calling experience and dynamic optimization of strategy, so that the system can make more accurate tool calling decisions in subsequent similar problem scenarios.

[0045] The details of the application not described herein can be referred to the prior art.

[0046] The application has the following beneficial effects:

[0047] 1、The application introduces an "experience priority" mechanism in the decision-making process. The system first retrieves the expected success rate of the "no tool calling" strategy in similar scenario clusters, and if the expected success rate reaches a preset threshold, it directly blocks the subsequent tool distribution logic, and the large model directly generates answers using internal knowledge. This design can effectively intercept the behavior of the large model that still frequently triggers external tools when there is accurate knowledge, reducing redundant API requests, reducing response delay and saving system resources.

[0048] 2、The application no longer relies on fuzzy semantic matching or user preference sorting, but uses "scenario clusters" as the smallest management unit to structure the mapping relationship of "scenario features + tool subset path + actual success rate". When a new problem matches a high similarity scenario cluster, the system can reuse the verified optimal tool combination and execution order under the cluster, which enables the agent to accurately lock the most effective tool chain when facing similar complex problems, greatly improving the accuracy of tool calling and avoiding "expansion" of the solution caused by invalid calling.

[0049] 3、The application designs a lightweight bottom mechanism of "large model self-evaluation". When there is insufficient experience sample or the difference between similar strategies is not obvious, the system will trigger a self-evaluation of the "own knowledge boundary". This enables the system not only to ensure the scientificity of decision-making in the "cold start" stage, but also to continuously enrich scenario cluster data as the interaction increases, realizing adaptive optimization and continuous improvement of tool calling strategies. BRIEF DESCRIPTION OF DRAWINGS

[0050] The drawings accompanying the specification of this application are used to provide a further understanding of the application, the illustrative embodiments of the application and their descriptions serve to explain the application, and do not constitute an improper limitation on the application.

[0051] Figure 1 A problem scenario-based agent tool calling decision method of the application. DETAILED DESCRIPTION

[0052] In order to enable those skilled in the art to better understand the technical solutions in the specification, the technical solutions in the embodiments of the specification will be described in detail below with reference to the drawings in the specification, but not limited to this, the application not described in detail, according to the conventional technology in the art.

[0053] Embodiment 1

[0054] A problem scenario-based agent tool calling decision method, as shown in Figure 1 , comprising:

[0055] S1, obtaining a user question, extracting question category, semantic vector and context, forming question scenario features;

[0056] S2, in the deployment phase or the preset phase during operation, the external tool called by the large model agent is uniformly registered and normatively described;

[0057] S3, based on the interaction record of the large model agent and the user in the historical task, a tool calling experience library is constructed, and cluster management is performed to form a corresponding scene cluster, and a scene cluster metadata table is generated;

[0058] S4, in each scene cluster, the number of attempts and the number of successes of different tool calling strategies in the scene cluster are counted, and the success rates of different tool calling strategies are calculated;

[0059] S5, for the current problem, similar scene clusters are retrieved from the tool calling experience library, and a candidate strategy set is obtained by summarizing;

[0060] S6, the success rate of the experience library is compared in priority to determine whether to directly answer, call which tool subset, or determine that the experience is insufficient or the conclusion is not clear;

[0061] S7, when step S6 determines that the experience is insufficient or the conclusion is not clear, a large model self-evaluation mechanism is triggered to determine whether to call a tool as a backup;

[0062] S8, execute tool calling, generate answer and write back experience.

[0063] Embodiment 2

[0064] A problem scene-based agent tool calling decision method is provided as in embodiment 1, except that in step S1, the system receives the user input question q, including natural language questions and associated conversation context information, performs semantic analysis and vector encoding on the question q to obtain a semantic vector The semantic vector can be generated by a special embedding model, such as Qwen3-Embedding, BGE-M3, etc., for representing fine-grained semantic information of the question.

[0065] The question is divided into at least one question category by a pre-designed classification rule, the question category including general knowledge question and answer category, mathematical and logical calculation category, real-time information query category, structured data query category, operation execution category and other business-related categories;

[0066] Context features are extracted from the current conversation history, system configuration and user explicit instructions to represent the dialogue environment and constraint conditions in which the question is located;

[0067] combining the question category, the semantic vector, and the context feature to form a current question scenario feature for subsequent retrieval of similar scenario clusters in the tool invocation experience library and tool invocation strategy decision-making:

[0068] .

[0069] Embodiment 3

[0070] A question scenario-based agent tool invocation decision-making method is provided, as described in Embodiment 2, except that in step S2, for each external tool, the system assigns a unique tool identifier tool_id and records the function description of the external tool and the adaptive question category information to represent the typical question types that the tool is suitable for solving; the system also records the input and output parameter forms of each external tool and the return result structure type, so that the calling parameters can be correctly constructed and the return results can be parsed when tool invocation occurs subsequently.

[0071] Embodiment 4

[0072] A question scenario-based agent tool invocation decision-making method is provided, as described in Embodiment 3, except that in step S3, whenever a task is completed, an experience record is formed based on the task, and the experience record includes the question scenario feature of the task, the tool invocation strategy adopted, and the task effect indicator result_metrics;

[0073] The tool invocation strategy includes not invoking any tool, invoking a tool subset composed of one or more external tools, and the invocation order tool_set.

[0074] The task effect indicator result_metrics includes whether the task is successful task_success, the result correctness score correctness_score, whether multiple rounds of revision or follow-up questions are needed need_revision, etc. After accumulating a certain number of experience records, the system can aggregate experience records with similar question semantics, the same category, and similar context into the same scenario cluster according to a preset time window or sample number.

[0075] According to the semantic vector and the context feature , clustering is performed, specifically:

[0076] For two records , , the semantic similarity and the context feature similarity are calculated:

[0077]

[0078]

[0079] wherein, denotes the semantic vector of the record ; denotes the semantic vector of the record ; denotes the context feature of the record ; denotes the context feature of the record ; denotes the cosine similarity function;

[0080] calculates the comprehensive similarity index :

[0081]

[0082] wherein, is a semantic similarity weight coefficient, is a context feature similarity weight coefficient, > 0 , + = 1;

[0083] When > threshold value τ, it is classified into the same scene cluster, and is updated in real time. In this embodiment, the threshold value τ is set to 0.8.

[0084] Subsequent maintenance of the strategy and its effect (success rate) statistical data at the scene cluster level is needed. In order to realize the matching mapping between the new problem and the scene cluster, the scene cluster metadata table is generated when the scene cluster is generated. Through continuous writing of new experience records and updating of the scene cluster, the tool calling experience library is incrementally constructed and dynamically maintained.

[0085] A certain experience record storage example is shown in Table 1.

[0086] Table 1 Experience record storage example

[0087]

[0088] Embodiment 5

[0089] A problem scene-based intelligent agent tool calling decision method is provided, as described in Embodiment 4, except that in step S4, after the scene cluster is constructed, the task effect of different strategies in each scene cluster is counted as shown in Table 2:

[0090] Table 2 Scene cluster storage example

[0091]

[0092] For each scenario cluster, the number of attempts and the number of successes of each strategy of not calling any tool and calling one or more external tools are counted respectively, and the success rate is the ratio of the number of successes to the total number of attempts. The statistics in this step only take the task effect as the optimization target, without introducing any weight or correction factor related to the tool calling cost, to provide data support for the subsequent experience-based tool calling decision.

[0093] Embodiment 6

[0094] An agent tool calling decision method based on problem scenarios, as described in Embodiment 5, except that in step S5, when a new user question is received, the problem scenario feature is completed

[0095] First, the scenario cluster set with the same or similar category is filtered according to the problem category, and then the problem scenario feature is calculated based on the scenario cluster metadata table, as shown in Table 3, and the similarity between the semantic center vector of each scenario cluster and the semantic center vector of the current problem is calculated, and several scenario clusters with a similarity higher than a preset threshold are selected as the similar scenario cluster set, wherein the semantic center vector is the average of the semantic vectors of all problems in the scenario cluster.

[0096] Suppose a scenario cluster C contains n experience records, and the corresponding semantic vectors are respectively: ;

[0097] The semantic center vector is defined as:

[0098]

[0099] Table 3 Scenario cluster metadata table

[0100]

[0101] All recorded tool calling strategies in the similar scenario cluster set are collected, including the strategy of not calling any tool and the strategy of calling different tool subsets, and the expected success rate of each tool calling strategy on the current problem is inferred (each scenario cluster has corresponding strategies used, and the success rate success_rate field can be compared to complete the inference), thereby constructing a candidate strategy set for the current problem, providing a candidate space for the next experience-based decision.

[0102] Embodiment 7 ​

[0103] An agent tool invocation decision method based on problem scenarios, as described in Embodiment 6, except that in step S6, the system prioritizes the use of historical experience to make tool invocation strategy decisions for the current problem based on the candidate strategy set obtained in step S5.

[0104] First, check if there is a strategy of "not invoking any tool" in the candidate strategy set, and determine the relationship between the expected success rate of the strategy and the preset threshold b. In this embodiment, b is set to 0.9; if the expected success rate reaches or exceeds the preset threshold b, the system considers that the current problem can be solved directly by the large model based on historical internal knowledge, and thus decides not to invoke any tool, and directly generates an answer by the large model;

[0105] If the expected success rate is lower than the preset threshold b, and the expected success rate of the strategy of invoking external tools is significantly better than that of "not invoking any tool", then the tool subset corresponding to the strategy of invoking external tools is selected as the tool invocation scheme for the current problem;

[0106] When the sample size of the similar scenario cluster set is small, or the expected success rates of the candidate strategies in the candidate strategy set are not significantly different, and there is no significant advantage, the system considers that the experience library is insufficient for the current problem or the experience conclusion is not clear enough, and enters step S7 for large model self-evaluation backup judgment.

[0107] Embodiment 8

[0108] An agent tool invocation decision method based on problem scenarios, as described in Embodiment 7, except that in step S7, to deal with the situation of insufficient experience samples or unclear experience conclusions, the system introduces a large model self-evaluation mechanism to make backup judgments on whether external tools need to be invoked; the large model self-evaluation mechanism is:

[0109] Requires the large model to determine whether it has enough information to generate a reliable answer without invoking any external tools. The large model selects one of the two options of directly answering or needing to invoke external tools based on its understanding of the problem;

[0110] If the large model self-evaluation is a direct answer (confidence greater than or equal to 0.6), the system determines that the current problem does not need to invoke external tools; even if there is no obvious bias strategy in the experience library, the system can directly generate an answer from the large model based on the self-evaluation result;

[0111] If the large model self-evaluation considers that external tools need to be called (confidence less than 0.6), a tool calling strategy is formulated according to the actual problem and executed to obtain the final result and store the execution process as new experience. In this way, this step provides a lightweight fallback mechanism for tool calling decision in the experience insufficient scenario, and since only a brief self-evaluation is performed, a large amount of additional computational overhead is not introduced.

[0112] A self-evaluation mechanism example is shown in Table 4:

[0113] Table 4 Self-evaluation mechanism example table

[0114]

[0115] Embodiment 9

[0116] An agent tool calling decision method based on problem scenarios, as described in embodiment 8, except that the system performs actual processing on the current problem according to the results of step S6 or step S7. When the decision result is not to call any tool, the system directly inputs the problem and its related context into the large model, and generates the final answer by the large model and returns it to the user; when the decision result is to call a subset of tools, the system initiates a call to the external tools according to the tool set and calling order specified in the selected strategy, requests and receives the results returned by the tools, and then inputs the tool results and the original problem as context into the large model to generate the final answer with the assistance of the tool results.

[0117] After the tool calling task in step S8 is completed, a new experience record is constructed according to whether the task is successful, user feedback, etc., and the experience record is written into the tool calling experience library, and the success rate of the strategy in the corresponding scene cluster is updated, thereby realizing the continuous accumulation of tool calling experience and dynamic optimization of the strategy, so that the system can make more accurate tool calling decisions in subsequent similar problem scenarios.

[0118] The above describes the preferred embodiments of the present application. It should be noted that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should also be considered within the scope of protection of the present application.

Claims

1. An agent tool invocation decision method based on problem scenario, characterized in that, Comprise: S1, acquire user problems, extract problem categories, semantic vectors and contexts, and form problem scene features; S2, in the deployment stage or the preset stage in the running process, uniformly register and standardize the description of the external tool called by the large model agent; S3, based on the interaction record of the large model agent and the user in the historical task, a tool calling experience library is constructed, and cluster management is carried out, corresponding scene clusters are formed, and scene cluster metadata table is generated; S4, in each scene cluster, the number of attempts and the number of successes of different tool calling strategies in the scene cluster are counted, and the success rate of different tool calling strategies is calculated; S5, for the current problem, similar scene clusters are retrieved from the tool calling experience library, and a candidate strategy set is obtained; S6, the success rate of the experience library is compared preferentially, and it is determined whether to directly answer, call which tool subset, or judge as insufficient experience or unclear conclusion; S7, when step S6 determines that the experience is insufficient or the conclusion is unclear, the large model self-evaluation mechanism is triggered to determine whether to call the tool as a bottom line; S8, execute tool calling, generate answer and write back experience; In step S3, after each task is completed, an experience record is generated based on that task. The experience record includes the problem scenario characteristics of that task. The tool invocation strategy used and the resulting task performance metrics; The tool calling strategy includes not calling any tool, calling one or more external tools to form a tool subset and calling order tool_set; The task effect index result_metrics includes whether the task is successful task_success, the result correctness score correctness_score, and whether it needs to be revised or asked need_revision; According to the semantic vector and the context feature clustering is performed, in particular: For two records , , compute semantic similarity and contextual feature similarity : wherein, represents a semantic vector of a record ; represents a semantic vector of a record ; represents a context feature of a record ; represents a context feature of a record ; represents a cosine similarity function; Computing an integrated similarity measure : wherein, is a semantic similarity weight coefficient, is a contextual feature similarity weight coefficient, , + = 1;​ When The threshold τ is attributed to the same scene cluster, and is updated in real time. In step S4, the number of attempts and the number of successes of the strategy of not calling any tool and the strategy of calling one or more external tools to form a tool subset in the scene cluster are counted respectively, and the success rate is the ratio of the number of successes to the total number of attempts; In step S5, when receiving a new user question, completing the question scene feature After the construction, firstly, the same or similar category scene cluster sets are screened according to the question category, and then the question scene features are calculated based on the scene cluster metadata table The similarity between the semantic center vector of each scene cluster and the semantic center vector of the question, and several scene clusters with a similarity higher than a preset threshold are selected as the similar scene cluster set, wherein the semantic center vector of the scene cluster is the mean value of the semantic vectors of all questions in the scene cluster ​ In the similar scene cluster set, all recorded tool calling strategies are collected, the expected success rate of each tool calling strategy on the current problem is inferred, and a candidate strategy set for the current problem is constructed; In step S6, first check whether there is a "no tool calling" strategy in the candidate strategy set, and judge the relationship between the expected success rate of the strategy and the preset threshold b, if the expected success rate reaches or exceeds the preset threshold b, the system considers that the current problem can be solved directly by the large model internal knowledge in history, so as to decide not to call any tool, and the large model directly generates the answer; If the expected success rate is lower than the preset threshold b, and the expected success rate of the strategy of calling external tools is better than that of "not calling any tool", the tool subset corresponding to the strategy of calling external tools is selected as the tool calling scheme of the current problem; When the sample size of the similar scene cluster set is small, or the expected success rate difference between each candidate strategy in the candidate strategy set is not obvious, it is determined that the experience is insufficient or the conclusion is unclear, and step S7 is entered; The large model self-evaluation mechanism in step S7 is: The large model is required to determine whether it has sufficient information to generate a reliable answer without calling any external tool. The large model selects one of the two options based on its understanding of the question: a direct answer or the need to call an external tool. If the large model self-evaluates as a direct answer, the system determines that the current question does not require calling an external tool. If the large model self-evaluates as needing to call an external tool, the system develops a tool calling strategy based on the actual question and executes it, obtains the final result, and stores the execution process as new experience.

2. The method of claim 1, wherein, In step S1, the system receives a user input question q including a natural language question and its associated conversational context information, performs semantic parsing and vector encoding on the question q to obtain a semantic vector , for representing fine-grained semantic information of the question; classifying the question into at least one question category by a classification rule the question category includes a general knowledge Q&A category, a mathematical and logical calculation category, a real-time information query category, a structured data query category, an operation execution category, and other business related categories extracting context features from the current session history, system configuration, and user explicit instructions to represent the dialog environment and constraints in which the question is posed; combine the question category, the semantic vector, and the context feature to form a current question scene feature : 。 3. The method of claim 2, wherein, In step S2, for each external tool, the system assigns a unique tool identification tool_id, records the function description of the external tool and the problem category information, and records the input and output parameter forms of each external tool and the return result structure type.

4. The method of claim 3, wherein, After the completion of the tool calling task in step S8, a new experience record is constructed based on the success of the task and user feedback information, and the experience record is written into the tool calling experience library. The success rate of the strategy in the corresponding scene cluster is updated, thereby realizing the continuous accumulation of tool calling experience and the dynamic optimization of the strategy, so that the system can make more accurate tool calling decisions in subsequent similar problem scenarios.

Citation Information

Patent Citations

  • Intelligent tool calling method based on knowledge base matching

    CN121168636A

  • Intelligent agent tool calling knowledge optimization method based on empirical path graph evolution

    CN121351971A