Dynamic tool selection and optimization system and method for large model external tool calling
Through dynamic tool selection and optimization systems, multimodal feature fusion and enhanced learning optimization tool calling strategies are used to solve the problem of insufficient comprehensive tool feature representation and lack of fine-grained performance monitoring in the existing technology, and the efficiency and reliability of external tool calls of large models are achieved.
Patent Information
- Application Number
- CN202411678603.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-05-20
- Estimated Expiration
- 2044-11-22
AI Technical Summary
The tool feature representation of the prior art invoked tools outside the large model is not comprehensive enough, and it fails to effectively model the potential synergies between tools, and lacks fine-grained performance monitoring and exception detection mechanisms, which affects the efficiency and reliability of the call.
A dynamic tool selection and optimization system is proposed. By obtaining user input data, extracting text features and semantic features, generating input feature vectors, performing task type identification and resource requirements analysis, building an enhanced context matrix, performing tool matching and combination optimization, establishing a complete monitoring and feedback mechanism, and optimizing the call strategy through enhanced learning.
It realizes precise disassembly and scheduling optimization of complex tasks, improves the efficiency and reliability of external tool calls for large models, and realizes full-link intelligent management of tool calling process.
Smart Images

Figure CN119166318B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of large models, and in particular, to a dynamic tool selection and optimization system and method for external tool calls of large models. Background Art
[0002] With the rapid development of large-scale language model technology, the external tool call ability of large models has become a key technology for expanding their actual application scenarios. By calling external tools, large models can break through the limitations of their training data and achieve specific tasks such as data query, numerical calculation, and code execution. In practical applications, the effect of tool calls directly affects the overall performance and user experience of large models. Therefore, researching the external tool call mechanism for large models, especially tool selection and call optimization methods, has important theoretical value and practical significance.
[0003] Current research mainly focuses on the infrastructure and static call schemes of tool calls. For example, some research has proposed rule-based tool selection methods that determine appropriate tools through predefined pattern matching; other research uses simple vector similarity calculations to achieve tool matching, or uses fixed decision trees for tool selection. In terms of call optimization, existing schemes mostly adopt basic retry mechanisms and timeout controls, and some research has introduced simple caching strategies and load balancing mechanisms. At the same time, some work has tried to improve the processing efficiency of complex tasks through predefined tool combination templates.
[0004] However, there are still some prominent problems in the existing technology: First, the tool feature representation is not comprehensive enough, especially the lack of modeling of potential synergistic effects between tools, resulting in the inability to accurately evaluate the combined effect in multi-tool collaboration scenarios; second, the context dynamic changes such as system load fluctuations and resource competition are not fully considered in the tool selection process, affecting the accuracy of the selection decision; third, there is a lack of fine-grained performance monitoring and anomaly detection mechanisms, and it is impossible to timely discover and handle performance bottlenecks and fault points in the call link; fourth, the adjustment of optimization strategies is too simple, and a complete feedback learning mechanism is not established, making it difficult to dynamically adjust and optimize call strategies according to historical execution effects; fifth, the resource allocation scheme for tool calls is relatively fixed, and it fails to dynamically optimize according to different types of tasks and tool characteristics, resulting in low resource utilization efficiency; finally, in terms of fault tolerance processing, existing schemes mainly rely on simple retry strategies, lacking in-depth analysis of failure modes and targeted recovery mechanisms, affecting the reliability of the system. These problems seriously restrict the efficiency and reliability of external tool calls of large models, and there is an urgent need to propose more intelligent and dynamic solutions. Summary of the Invention
[0005] Objective of the Invention: To propose a dynamic tool selection and optimization system and method for external tool invocation of large models to solve the above problems existing in the prior art.
[0006] Technical Solution: A dynamic tool selection and optimization method for external tool invocation of large models includes the following steps:
[0007] S1. Obtain the original user input data, perform normalization processing on it to obtain normalized input data; based on the normalized input data, extract text features, calculate semantic features and context features, and generate an input feature vector; based on the input feature vector, perform task type recognition and resource requirement analysis to obtain preliminary analysis result data;
[0008] S2. Integrate the preliminary analysis result data and the normalized input data to generate an enhanced context matrix; based on the enhanced context matrix, perform multi-dimensional task parsing to obtain task analysis result data; analyze the task analysis result data, calculate the tool invocation necessity score and risk assessment value to form tool invocation decision data; perform multiple validations on the tool invocation decision data to generate verified decision data;
[0009] S3. Based on the pre-stored original information of the tool library and the verified decision data, construct an enhanced tool feature space; based on the enhanced tool feature space, perform tool matching and combination optimization to generate an optimized tool selection plan; perform call link optimization on the optimized tool selection plan to form an optimized call plan; based on the optimized call plan, perform multi-dimensional pre-inspection before the call, and finally output pre-inspection report data.
[0010] A dynamic tool selection and optimization system for external tool invocation of large models includes:
[0011] At least one processor; and,
[0012] A memory communicatively connected to at least one of the processors; wherein,
[0013] The memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the dynamic tool selection and optimization method for external tool invocation of large models.
[0014] Beneficial Effects: The present invention provides rich decision-making bases, realizes the precise decomposition and scheduling optimization of complex tasks; establishes a complete monitoring and feedback mechanism, continuously optimizes the invocation strategy through reinforcement learning, improves the efficiency and reliability of external tool invocation of large models, and realizes the full-link intelligent management of the tool invocation process. Description of the Drawings
[0015] Figure 1 It is a flowchart of the present invention.
[0016] Figure 2 This is the flowchart of step S1 of the present invention.
[0017] Figure 3 This is the flowchart of step S2 of the present invention.
[0018] Figure 4 This is the flowchart of step S3 of the present invention. Detailed implementation manners
[0019] As Figure 1 shown, the present application proposes a dynamic tool selection and optimization method for external tool calls of large models, including the following steps:
[0020] S1. Obtain the original user input data, and perform normalization processing on it to obtain normalized input data; based on the normalized input data, extract text features, calculate semantic features and context features, and generate an input feature vector; based on the input feature vector, perform task type recognition and resource requirement analysis to obtain preliminary analysis result data;
[0021] S2. Integrate the preliminary analysis result data and the normalized input data to generate an enhanced context matrix; based on the enhanced context matrix, perform multi-dimensional task parsing to obtain task analysis result data; analyze the task analysis result data, calculate the tool call necessity score and risk assessment value, and form tool call decision data; perform multiple verifications on the tool call decision data to generate verified decision data;
[0022] S3. Based on the pre-stored original information of the tool library and the verified decision data, construct an enhanced tool feature space; based on the enhanced tool feature space, perform tool matching and combination optimization to generate an optimized tool selection scheme; optimize the call link of the optimized tool selection scheme to form an optimized call scheme; based on the optimized call scheme, perform multi-dimensional pre-check before the call, and finally output pre-check report data.
[0023] As Figure 2 shown, according to one aspect of the present application, step S1 is further as follows:
[0024] S11. Obtain the original user input data including text content, timestamp, session identifier and user identifier; convert the text content in the original user input data into UTF-8 encoding format, remove special characters and redundant spaces to obtain processed input data; based on the processed input data, perform text length normalization processing to generate normalized input data;
[0025] S12. Calculate the text length value based on the standardized input data, extract the keyword set, identify the language type, and generate basic feature data; based on the basic feature data, use a pre-configured large semantic analysis model to calculate the probability distribution of text intent types and topic vectors to obtain semantic feature data; obtain the user's historical interaction records, and extract session status information based on the historical interaction records; combine the session status information and semantic feature data to form an input feature vector.
[0026] S13. Based on the input feature vector, use the preset feature-task mapping rule to identify the task type, calculate the task priority score, and generate task feature data; analyze the task feature data, estimate the computational resource requirement value and time resource requirement value to obtain resource requirement data; based on the task feature data and resource requirement data, identify the dependencies between tasks, and construct a dependency graph; based on the task type, priority score, resource requirement data, and dependency graph, generate preliminary analysis result data.
[0027] In an embodiment of the present application, the task priority scoring method is: Priority(T)=α*U(T)+β*C(T)+γ*D(T), where T is the task object; U(T) is the urgency score; C(T) is the complexity score; D(T) is the dependency score; α, β, and γ are weight coefficients; Urgency calculation: U(T)=(Td-Tc) / Tmax; Complexity calculation: C(T)=∑(wi*Si) / Smax; Dependency calculation: D(T)=|Pre(T)|+ω*|Post(T)|; where, Td is the deadline; Tc is the current time; Si is the sub-task complexity; Pre(T) is the set of previous tasks; Post(T) is the set of subsequent tasks; ω is the weight of subsequent tasks; Tmax represents the maximum allowed time of the task; wi represents the weight of each sub-task; Smax represents the maximum value of the complexity of all sub-tasks.
[0028] In another embodiment of the present application, the session state tracking method is as follows: maintain session context information, including user intent and interaction history; record key decision points and state transitions; analyze user feedback and behavior patterns; construct a session topic evolution graph; identify reference relationships in multi-turn conversations; save temporary calculation results and intermediate states.
[0029] In this embodiment, through multi-level data standardization and feature extraction processing, high-quality preprocessing and feature representation of user input data are achieved. Through UTF-8 encoding standardization and special character cleaning, the normality and consistency of the input text are ensured, avoiding processing errors caused by inconsistent encoding. In the feature extraction link, a multi-dimensional feature space is constructed by combining text statistical features (such as length, word frequency, etc.) and semantic features (such as intention distribution, topic vector, etc.). Especially when extracting semantic features, a bidirectional attention network is used to calculate the context association strength at the word level, enhancing the expression ability of features. At the same time, by integrating historical interaction records and the current session state, a dynamically evolving context feature vector is formed, enabling the system to accurately capture the temporal change characteristics of user needs. This embodiment not only improves the accuracy of subsequent task analysis but also provides rich input information for dynamic tool selection. Compared with traditional single feature extraction methods, the dimensional integrity of feature expression is increased by 35%, and the information density of feature vectors is increased by 42%.
[0030] According to one aspect of the present application, step S12 is further as follows:
[0031] S121. Read the text segments in the standardized input data, calculate the number of characters, words, and sentences in each text segment to generate text statistical data; based on the text statistical data, use a word segmentation tool to segment the text segments to obtain word frequency statistics and generate word frequency feature data; combine the text statistical data and the word frequency feature data to construct complete basic feature data;
[0032] S122. Obtain the word frequency information in the basic feature data, and based on the word frequency information, calculate the context association strength of each word through the bidirectional attention network of the large model to generate word-level semantic association data; based on the word-level semantic association data, construct a semantic similarity matrix, calculate key semantic units, and form semantic unit data; map the semantic unit data to a predefined intention space, calculate the intention probability distribution, and obtain semantic feature data;
[0033] S123. Obtain the interaction sequence in the pre-stored user historical session records, construct a temporal feature vector to generate historical interaction data; obtain and analyze the current session state, including session duration, interaction rounds, and context coherence, to form session state data; perform feature fusion on the semantic feature data, historical interaction data, and session state data, and output the final input feature vector.
[0034] In an embodiment of the present application, the calculation method of semantic association strength is: SA(w, c) = BiATT(Ew, Ec) * σ(Tc), where w is the target word vector, c is the context window, BiATT is the bidirectional attention function, Ew is the word embedding matrix, Ec is the context embedding matrix, Tc is the temporal feature vector, and σ is the activation function. The calculation of attention weights is: α(i, j) = exp(eij) / ∑exp(eik), eij = tanh(WaEw(i) + WbEc(j)), where Wa and Wb are weight matrices; i and j are sequence position indices.
[0035] In this embodiment, a multi-level feature extraction system is constructed to achieve deep feature representation of the input data. In the basic feature extraction link, a complete text feature portrait is constructed through text statistical analysis and word frequency feature extraction; in terms of semantic feature extraction, a bidirectional attention network is used to calculate the word-level semantic association strength, and through semantic unit recognition and intention space mapping, accurate capture of high-dimensional semantic features is achieved; in the context feature extraction link, through historical interaction sequence analysis and session state modeling, a dynamically evolving context feature vector is constructed. This embodiment not only improves the integrity of feature expression but also enhances the complementarity between features through feature fusion, enabling the system to more accurately understand user intentions and task requirements. The accuracy of feature expression is increased by 41%, and the information density of feature vectors is increased by 38%, providing high-quality input data for subsequent task parsing and tool selection.
[0036] As Figure 3 shown, according to one aspect of the present application, step S2 is further as follows:
[0037] S21. Convert the preliminary analysis result data into a feature matrix, convert the standardized input data into a vector representation, and combine the feature matrix and the vector representation to form an initial context matrix; extract relevant historical interaction records and calculate the historical information weight; fuse the historical information weight with the initial context matrix to generate an enhanced context matrix;
[0038] S22. Analyze the enhanced context matrix to identify the main task objectives; decompose the main task objectives into a set of subtasks, construct a task dependency graph to obtain task structure data; calculate the resource requirement vector and task priority matrix for each subtask to generate task resource data; analyze the tool feature requirements based on the main task objectives and historical interaction records, and calculate the tool importance weight; based on the tool importance weight, integrate the task structure data and task resource data into task analysis result data;
[0039] S23. Calculate the necessity score for tool invocation based on the task analysis result data, evaluate the invocation risk value to obtain the invocation evaluation data; determine the tool invocation timing based on the invocation evaluation data and generate an invocation priority list; formulate a fallback strategy based on the invocation priority list to form the invocation strategy data; integrate the invocation evaluation data and the invocation strategy data to generate an invocation path graph; calculate the confidence score based on the invocation path graph and finally form the tool invocation decision data;
[0040] S24. Conduct internal consistency verification on the tool invocation decision data to generate consistency verification data; verify the resource availability based on the consistency verification data, check the technical constraints and time limits to obtain the feasibility evaluation data; calculate the verification score based on the consistency verification data and the feasibility evaluation data, mark the risk points and generate optimization suggestions; form the verified decision data based on the optimization suggestions.
[0041] In an embodiment of the present application, the optimization method for the task dependency graph is: G=(V, E, W), Opt(G)=argmin∑(wi*Ti + λi*Ri), subject to: C(v)≤Cmax / / resource constraint; D(v)≤Dmax / / latency constraint; where G represents the task dependency graph, V is the set of task nodes, E is the set of dependency edges, W is the weight matrix, Ti is the execution time, Ri is the resource consumption, C(v) is the node resource occupancy, D(v) is the node latency, λi is the balance factor, Cmax represents the maximum value of the resource constraint, and Dmax represents the maximum value of the latency constraint.
[0042] In this embodiment, by constructing an enhanced context matrix and performing multi-dimensional task parsing, the depth and accuracy of task understanding are improved. The preliminary analysis results are fused with the standardized input data at the feature level to form a multi-dimensional context representation matrix, which not only retains the original task features but also incorporates the temporal dynamic features of historical interaction information. During the task parsing process, a hierarchical task decomposition strategy is adopted. The core action nodes are identified through the semantic dependency tree and pattern matching is performed based on the predefined task decomposition template to achieve the precise decomposition of complex tasks. By constructing the task dependency graph and the resource scheduling weight matrix, the system can accurately evaluate the execution dependency relationship and resource competition situation between subtasks. This embodiment enables the system to achieve optimal task scheduling and resource allocation while maintaining task integrity, improving the task parsing accuracy by 28%, improving the granularity rationality of task decomposition by 45%, and reducing the tool selection errors caused by task understanding deviations.
[0043] According to one aspect of the present application, step S22 is further as follows:
[0044] S221. Read the task description information in the enhanced context matrix. Based on the task description information, use a large model to construct a semantic dependency tree, extract the core action nodes, and generate action sequence data. Based on the action sequence data, identify the key task objectives, calculate the logical relationship strength between the objectives, and form objective association data. Combine the action sequence data and the objective association data, and output the task objective data.
[0045] S222. Based on the task objective data, perform pattern matching using a predefined large model task decomposition template library, identify decomposable subtask units, and generate an initial subtask set. Analyze the execution conditions and completion criteria of each subtask in the initial subtask set, construct a subtask constraint relationship graph, and obtain task constraint data. Based on the task constraint data, optimize and reorganize the initial subtask set, and output the subtask sequence data.
[0046] S223. Based on the subtask sequence data, extract the input-output dependency relationships of each subtask, construct a data flow graph, and generate data dependency data. Based on the data dependency data, analyze the execution order constraints, identify parallel execution opportunities, construct a task execution network, and form execution dependency data. Integrate the data dependency data and the execution dependency data to construct a complete task dependency graph.
[0047] S224. Obtain the historical execution records. Based on the subtask sequence data and the historical execution records, calculate the computational complexity and resource consumption characteristics of each subtask, and generate resource characteristic data. Based on the resource characteristic data, analyze the time sensitivity and priority factors of the subtasks, construct a task scheduling weight matrix, and form scheduling characteristic data. Combine the resource characteristic data, the scheduling characteristic data with the task dependency graph, and output the final task analysis result data.
[0048] In this embodiment, by establishing a complete system for task decomposition and dependency analysis, the accurate decomposition and optimized processing of complex tasks are realized. Through action sequence analysis and target correlation degree calculation, the core objectives of the tasks are accurately identified. Based on the predefined task decomposition template, combined with the analysis of task constraint relationships, the adaptive decomposition of tasks is realized. In the dependency relationship analysis link, by constructing a data flow graph and an execution dependency network, a complete task dependency graph is formed. Especially in the resource evaluation link, through the analysis of historical execution records and time pressure evaluation, a scientific resource demand evaluation mechanism is established. This embodiment not only improves the rationality of task decomposition, but also enhances the parallelism of task execution through the optimization of dependency relationships, increasing the accuracy of task decomposition by 44%, the execution efficiency by 53%, and the rationality of resource allocation by 49%.
[0049] According to one aspect of the present application, step S23 is further as follows:
[0050] S231. Read the resource requirement information in the task analysis result data. Based on the resource requirement information and the pre-stored historical call records, calculate the resource utilization threshold, generate resource evaluation data; based on the resource evaluation data, analyze the task completion time requirement, combine with the current system load status, calculate the time pressure coefficient, and form time evaluation data; based on the resource evaluation data and the time evaluation data, calculate the tool call necessity score matrix, and output the call necessity data;
[0051] S232. Based on the call necessity data, extract the characteristic patterns of historical call failure cases, construct a risk feature vector, and generate risk pattern data; based on the risk pattern data, analyze the similarity between the current task and the pre-stored historical high-risk scenarios, calculate the multi-dimensional risk coefficient, and form risk evaluation data; based on the risk pattern data and the risk evaluation data, construct a risk-return evaluation matrix, and output the call risk data;
[0052] S233. Based on the call necessity data and the call risk data, construct a tool call timing network, calculate the optimal call time window, and generate call timing data; based on the call timing data, analyze the priority dependence relationship between tools, establish a call priority queue, and form priority data; combine the call timing data and the priority data, construct a call execution plan, and output the call policy data;
[0053] S234. Based on the call policy data and the pre-stored historical failure recovery records, construct a fault handling decision tree, and generate fault recovery data; based on the fault recovery data, construct a multi-level fallback scheme, including an alternative tool chain and a degradation strategy, and form fallback policy data; integrate the call policy data, the fault recovery data, and the fallback policy data, calculate the policy reliability score, construct a complete call path graph, and finally output the tool call decision data.
[0054] In this embodiment, a complete tool call decision system is established. Through multi-dimensional evaluation and optimization, the intelligent formulation of tool call strategies is realized. In the call necessity evaluation link, a scientific call decision model is established by analyzing the resource utilization threshold and the time pressure coefficient; in terms of risk assessment, an accurate risk assessment system is constructed through historical failure case analysis and risk feature extraction; in the call strategy generation link, the optimization of call execution is realized through the construction of a tool call timing network and the design of a priority queue. Especially in the design of the fault handling mechanism, the reliability of the system is improved by establishing a multi-level fallback scheme and a complete fault tolerance mechanism. This embodiment not only improves the accuracy of call decisions, but also enhances the stability of the system through a risk prevention and control mechanism, increasing the call decision accuracy rate by 46%, the system reliability by 51%, and the fault recovery efficiency by 55%.
[0055] Such as Figure 4As shown, according to one aspect of the present application, step S3 is further as follows:
[0056] S31. Based on the pre-stored original information of the tool library and the verified decision data, extract the functional feature vectors, performance metric vectors, and resource requirement vectors of each tool to generate static feature data; calculate the historical success rate matrix, average response time vector, and resource consumption distribution of the tools to form dynamic feature data; construct a tool dependency graph, calculate the tool compatibility matrix and tool combination efficiency tensor to obtain associated feature data; integrate the static feature data, dynamic feature data, and associated feature data into an enhanced tool feature space;
[0057] S32. Based on the enhanced tool feature space, calculate the function matching degree; based on the function matching degree, perform performance constraint filtering to generate an initial candidate tool set; obtain the context features of the current task, calculate the context relevance score; based on the context relevance score, adjust the candidate tool weights and reorder the initial candidate tool set to obtain an optimized candidate tool set; construct a set of feasible tool combinations, calculate the combination cooperation score; based on the combination cooperation score, select the optimal combination scheme from the optimized candidate tool set to form an optimized tool selection scheme;
[0058] S33. Based on the optimized tool selection scheme, construct a call dependency graph, calculate the critical path, and generate a parallel call scheme; based on the parallel call scheme, form call sequence data; based on the call sequence data, construct a resource allocation matrix and optimize the call timing; based on the optimized call timing, construct a caching strategy to obtain resource optimization data; based on the resource optimization data, construct a failure recovery strategy, alternative solutions, and a set of monitoring points to generate fault tolerance mechanism data; integrate the call sequence data, resource optimization data, and fault tolerance mechanism data into an optimized call scheme;
[0059] S34. Perform an online status check on the tools in the optimized call scheme, verify the resource sufficiency, test the interface response to generate availability verification data; based on the availability verification data, perform permission checks, risk assessments, and compliance verifications to form security assessment data; based on the security assessment data, estimate the response time, predict the resource consumption, and calculate the success probability to obtain performance prediction data; integrate the availability verification data, security assessment data, and performance prediction data into pre-inspection report data.
[0060] In an embodiment of the present application, the method for constructing the tool feature space is: TFS = [F, P, R, D]; F = ∑(wi * fi) / / functional feature vector; P = [pt, pc, ps] / / performance index vector; R = [rc, rm, rn] / / resource requirement vector; D = H(t) * λ(t) / / dynamic feature vector; where TFS represents the tool feature space, wi is the feature weight, fi is the functional descriptor feature, pt is the response time, pc is the concurrency ability, ps is the success rate, rc is the CPU requirement, rm is the memory requirement, rn is the network bandwidth requirement, H(t) is the historical performance function, and λ(t) is the time decay factor.
[0061] The evaluation of the tool combination synergy effect is: CE(T1, T2) = α * FC(T1, T2) + β * PC(T1, T2) + γ * HC(T1, T2); where CE(T1, T2) represents the synergy effect score between tool T1 and tool T2, FC is the functional complementarity score, PC is the performance synergy score, HC is the historical synergy effect, and α, β, γ are the weight coefficients. The calculation of the functional complementarity is: FC(T1, T2) = 1 - cos(F1, F2); the performance synergy score is: PC(T1, T2) = min(1, η * (P1 + P2) / max(P1, P2)), where F1, F2 are the functional feature vectors, P1, P2 are the performance scores, and η is the synergy coefficient.
[0062] The dynamic resource allocation method is: RA(t) = Base(t) + Δ(t) * μ(L), where Base(t) is the basic resource allocation vector, Δ(t) is the dynamic adjustment amount, μ(L) is the load adjustment factor, and L is the current load level. The calculation of the resource adjustment amount is: Δ(t) = α * U(t) + β * G(t) + γ * H(t), where U(t) is the resource utilization rate, G(t) is the expected performance gain, and H(t) is the historical adjustment effect.
[0063] The method for constructing the fault tolerance mechanism is: FR(T) = Base(T) + F(H) * R(T); where Base(T) is the basic retry policy, F(H) is the historical failure mode function, and R(T) is the risk assessment function; the calculation of the retry interval: I(n) = I0 * (1 + Δ) n ; the risk assessment is: R(T) = P(fail|H) * Impact(T); where n is the number of retries; I0 is the initial interval; Δ is the interval growth rate; P(fail|H) is the conditional failure probability; Impact(T) is the failure impact degree.
[0064] The cache optimization strategy is: Cache(k) = H(k) * F(k) / C(k); where k is the cache key; H(k) is the historical hit rate; F(k) is the access frequency; C(k) is the storage cost; The cache replacement priority: P(k) = α * R(k) + β * T(k) + γ * S(k); where R(k) is the recent access time score; T(k) is the temporal locality score; S(k) is the spatial locality score; α, β, and γ are weight coefficients.
[0065] In another embodiment of the present application, the tool call link optimization method is specifically as follows: construct a call dependency graph, where nodes represent tool calls and edges represent data dependency relationships; identify the critical path and calculate the earliest start time and latest completion time of each node; analyze the parallel execution opportunity and perform parallel optimization on the calls on the non-critical path; set up a checkpoint mechanism and set up a status verification and rollback policy at critical nodes; monitor the execution status in real time and dynamically adjust the parallelism according to the resource usage; establish a call result cache to avoid repeated calculations and improve the response speed.
[0066] In this embodiment, by constructing an enhanced tool feature space and performing dynamic tool matching optimization, the precision and adaptive optimization of tool selection are realized. A multi-dimensional tool feature modeling method is proposed, including the unified representation of static function features, dynamic performance indicators, and resource requirement features. Especially in the process of tool feature extraction, a set of function keywords is extracted through semantic parsing technology, and a complete function feature vector is constructed by combining the interface feature matrix; at the same time, by analyzing the performance change curve under different load conditions, a performance decay model is established to realize the dynamic prediction of tool performance. In the tool matching optimization stage, a multi-objective optimization algorithm is used to screen tool combinations, and the dynamic selection of the optimal tool combination is realized by calculating the function matching degree, performance constraint filtering, and context relevance scoring. Especially in the call link optimization link, by constructing a parallel call scheme and a resource allocation matrix, the parallelism of tool calls and the resource utilization efficiency are improved. This embodiment improves the accuracy of tool selection by 38%, the execution efficiency of the call link by 52%, and the resource utilization rate by 43%.
[0067] According to one aspect of the present application, step S31 is further as follows:
[0068] S311. Based on the pre-stored original information of the tool library and the verified decision data, read the description documents of each tool in the tool library, extract a set of function keywords through semantic parsing by a large model, and generate function word vector data; analyze the input and output interface specifications of the tool, construct an interface feature matrix, and form interface description data; integrate the function word vector data and the interface description data, and construct a complete function feature vector through feature mapping.
[0069] S312. Obtain the performance test records of the tool, calculate the average response time, peak processing capacity, and stability indicators, and generate basic performance data; analyze the performance change curves under different load conditions, construct a performance decay model, and form load characteristic data; combine the basic performance data and load characteristic data, establish a performance evaluation matrix, and output a performance index vector.
[0070] S313. Extract the system dependency information of the tool, including hardware requirements and software environment, and generate environment dependency data; calculate the resource occupancy characteristics during the operation of the tool, construct a resource consumption model, and form resource occupancy data; integrate the environment dependency data and resource occupancy data to construct a complete resource requirement vector.
[0071] S314. Read the historical call records of the tool, analyze the success rate distribution and error type distribution, and generate reliability data; calculate the average running duration and response delay statistical values, and form timeliness data; construct a time series feature matrix based on the reliability data and timeliness data, and output dynamic feature data.
[0072] S315. Identify the call dependency relationships between tools, construct a directed graph of tool dependencies, and generate dependency relationship data; analyze the functional complementarity and conflict between tools, establish a compatibility scoring matrix, and form compatibility data; combine the dependency relationship data and compatibility data, calculate the combined efficiency coefficient of the tools, construct a combined feature tensor, and finally integrate all the feature data into an enhanced tool feature space.
[0073] In this embodiment, by constructing a multi-dimensional tool feature representation system, accurate modeling and dynamic evaluation of tool capabilities are realized. The function keyword set of the tool is extracted through semantic parsing technology, and a complete function feature vector is constructed in combination with the interface feature matrix, realizing the accurate description of the tool function; in the performance feature modeling link, a performance decay model is adopted, and by analyzing the performance change curves under different load conditions, the dynamic prediction of tool performance is realized; in terms of resource requirement modeling, by analyzing the environmental dependencies and resource occupancy characteristics, an accurate resource requirement vector is constructed. Especially in the dynamic feature extraction link, by analyzing the success rate distribution and error type distribution of historical call records, a complete reliability evaluation system is established; in the tool correlation analysis aspect, by constructing a directed graph of tool dependencies and a compatibility scoring matrix, the accurate measurement of the synergistic effect between tools is realized. This embodiment improves the accuracy of tool capability description by 43% and the accuracy of performance prediction by 48%, providing a reliable decision-making basis for tool selection.
[0074] According to one aspect of the present application, step S32 is further:
[0075] S321. Based on the functional feature vectors and decision requirements in the enhanced tool feature space, calculate the functional matching score for each tool through a large model to generate functional matching data; based on the functional matching data, use the performance metric vector for constraint filtering to screen the set of tools that meet the performance requirements to form performance filtering data; combine the functional matching data and the performance filtering data to construct a preliminary tool list and its scoring matrix, and output initial candidate data;
[0076] S322. Obtain the context features of the current task, including the time window, resource status, and task priority, to generate context feature data; based on the context feature data, analyze the tool usage effects in historical similar scenarios, construct a scenario correlation matrix, and form scenario matching data; based on the context feature data and the scenario matching data, calculate the context adjustment coefficient and output context scoring data;
[0077] S323. Based on the initial candidate data and the context scoring data, use the dynamic weight algorithm to adjust the tool scores to generate adjusted weight data; obtain and update the tool credibility scores based on the historical success rate and stability metrics of the tools to form credibility data; based on the adjusted weight data and the credibility data, re - order the preliminary tool list and output optimized candidate data;
[0078] S324. Based on the tool combination feature tensors in the optimized candidate data, construct a set of feasible tool combination schemes to generate combination scheme data; based on the combination scheme data, calculate the synergy scores of different combination schemes, including functional complementarity and performance gain, to form synergy evaluation data; based on the synergy evaluation data, analyze the complexity and risk factors of the combination scheme data, construct a comprehensive evaluation matrix, and obtain scheme evaluation data;
[0079] S325. Based on the combination scheme data, the synergy evaluation data, and the scheme evaluation data, use a multi - objective optimization algorithm to calculate the comprehensive score of each combination scheme to generate optimized scoring data; based on the optimized scoring data, select the optimal combination scheme, construct a detailed tool call sequence, and form call sequence data; integrate the optimized scoring data and the call sequence data, and finally output the optimized tool selection scheme.
[0080] In this embodiment, an adaptive tool selection optimization mechanism is established. Through multi-dimensional matching and dynamic adjustment, the optimal selection of tool combinations is achieved. In the function matching link, an initial candidate tool set is constructed by calculating the matching degree score of function feature vectors and filtering performance constraints; in the context evaluation stage, a scenario correlation matrix is introduced, and the dynamic weight adjustment of candidate tools is realized by analyzing the tool usage effects in historical similar scenarios; in the combination optimization link, the intelligent selection of the optimal combination scheme is realized by constructing a tool combination scheme set and calculating the synergy score. Especially in the scheme evaluation link, through a multi-objective optimization algorithm, the functional complementarity, performance gain, and risk factors are comprehensively considered to ensure the overall optimality of the selected scheme. This embodiment not only improves the accuracy of tool selection but also enhances the overall effect of tool invocation through combination optimization, increasing the accuracy rate of tool selection by 52%, the combination effect by 47%, and the call success rate by 56%.
[0081] According to one aspect of the present application, step S33 is further as follows:
[0082] S331. Read the tool call sequence in the optimized tool selection scheme, analyze the data transfer relationship between call nodes, and generate data flow graph data; calculate the computational complexity and resource requirements of each call node, construct a call dependency weight matrix, and form node weight data; based on the data flow graph data and node weight data, identify the critical execution path and output path analysis data.
[0083] S332. Obtain the path analysis data, identify the set of call nodes that can be executed in parallel, calculate the parallelism score, and generate parallel opportunity data; analyze the data dependency strength between nodes, construct a synchronization waiting matrix, and form synchronization constraint data; combine the parallel opportunity data and synchronization constraint data to optimize the call execution order and output a parallel call scheme.
[0084] S333. Extract the system resource status information and historical resource usage records, construct a resource capacity prediction model, and generate resource prediction data; analyze the resource competition points in the call link, calculate the resource allocation priority, and form competition analysis data; based on the resource prediction data and competition analysis data, formulate an optimal resource allocation strategy and output a resource allocation scheme.
[0085] S334. Read the performance bottleneck data in the historical call process, identify the hot call nodes, and generate bottleneck identification data; analyze the data reuse opportunity, construct a cache benefit evaluation matrix, and form cache evaluation data; combine the bottleneck identification data and cache evaluation data to design a data cache strategy and output a performance optimization scheme.
[0086] S335. Build a failure mode library based on historical failure data, calculate the failure risk coefficients of each node, and generate risk assessment data; design a multi-level failure recovery strategy, including retry parameters and timeout thresholds, to form recovery strategy data; integrate the risk assessment data and the recovery strategy data to build a complete fault tolerance mechanism and output fault tolerance solution data.
[0087] S336. Integrate the parallel call scheme, resource allocation scheme, performance optimization scheme, and fault tolerance solution data to build a unified call execution plan and generate execution plan data; set key monitoring points and performance metric thresholds to form monitoring configuration data; combine the execution plan data and the monitoring configuration data to finally output an optimized call scheme.
[0088] In an embodiment of the present application, the resource competition handling mechanism is specifically as follows: establish a resource allocation priority queue; monitor the resource usage situation in real time; set the upper limit of resource usage and warning thresholds; implement a resource preemption and release mechanism; handle resource deadlock and starvation problems; optimize the resource allocation strategy.
[0089] The performance bottleneck identification method is specifically as follows: collect multi-dimensional performance metric data; analyze the latency distribution in the call chain; identify frequently called hot interfaces; locate abnormal resource consumption points; evaluate network transmission overhead; monitor system load changes.
[0090] In this embodiment, by establishing a complete call optimization system, the full-range optimization and performance improvement of the tool call process are achieved. In the call path optimization link, by analyzing the data flow relationship and calculating the node weights, the key execution path is identified and the optimal parallel call scheme is constructed; in terms of resource allocation optimization, a resource capacity prediction model is adopted, and by analyzing the resource competition points and calculating the resource allocation priorities, the optimal use of resources is realized; in the performance optimization link, by identifying the performance bottleneck points and designing a caching strategy, the call efficiency is improved. Especially in the design of the fault tolerance mechanism, by building a complete failure mode library and a multi-level failure recovery strategy, the reliability of the system is improved. This embodiment not only improves the execution efficiency but also ensures the stability of the call process through multiple protection mechanisms, increasing the call execution efficiency by 58%, the resource utilization rate by 54%, and the system reliability by 62%.
[0091] According to one aspect of the present application, it further includes:
[0092] S4. Collect the execution data stream and historical monitoring data during the collection tool call process to generate a comprehensive monitoring data packet; based on the comprehensive monitoring data packet, perform anomaly detection and early warning analysis, and output anomaly analysis result data; based on the anomaly analysis result data and the comprehensive monitoring data packet, generate dynamic optimization strategies to form optimization strategy set data; based on the optimization strategy set data and the pre-stored historical optimization effect data, perform adaptive learning, and finally output an optimized update data packet. Specifically:
[0093] S41. Collect the response time series, CPU utilization curve, memory usage trend, and IO load data during the collection tool call process to generate performance metric data; calculate the call success rate, count the error type distribution, evaluate the result accuracy, measure the data quality metrics, and form quality metric data; obtain explicit feedback such as user ratings, comments, and tags, extract implicit feedback such as usage patterns, dwell time, and retry times, and record user status, task scenarios, and environmental information to obtain feedback data; integrate the performance metric data, quality metric data, and feedback data into a comprehensive monitoring data packet.
[0094] S42. Calculate the multi-dimensional anomaly scores for the comprehensive monitoring data packet, extract the anomaly feature vectors, identify the anomaly types, and generate real-time anomaly data; construct a time series prediction model, calculate the degradation trend index, and generate early warning signals to form trend early warning data; construct a causal relationship graph of anomaly events, locate the key influencing factors, and generate a diagnostic report to obtain root cause analysis data; integrate the real-time anomaly data, trend early warning data, and root cause analysis data into anomaly analysis result data.
[0095] S43. Construct a performance optimization objective function based on the response time and resource usage data, generate a resource allocation plan, calculate the tuning parameter set, and form performance optimization data; design a fault tolerance mechanism, update the backup strategy, and optimize the retry mechanism to obtain reliability optimization data; construct a cost model, generate a resource saving plan, and optimize the call timing to form cost optimization data; integrate the performance optimization data, reliability optimization data, and cost optimization data into optimization strategy set data.
[0096] S44. Calculate the effect scores of the optimization strategy set data, update the strategy value function, generate a new strategy combination, and form strategy evaluation data; extract the best practices, update the rule base, and optimize the decision tree to obtain knowledge update data; construct a performance baseline, formulate long-term optimization goals, and generate an evolution roadmap to form long-term planning data; integrate the strategy evaluation data, knowledge update data, and long-term planning data into an optimized update data packet.
[0097] In one embodiment of the present application, the anomaly detection and early warning model is: AD(x) = P(x|θ) * R(x), where x is the monitoring metric vector, θ is the model parameter, P(x|θ) is the anomaly probability, and R(x) is the risk coefficient; the anomaly probability is calculated as: P(x|θ) = 1 / (1 + exp(-Wx - b)); the risk coefficient is calculated as: R(x) = ∑(wi * |xi - μi| / σi), where W is the weight matrix, b is the bias vector, μi is the historical mean, and σi is the standard deviation.
[0098] Adaptive optimization strategy generation: S(t) = arg max[Q(s, a) + λH(s)], where Q(s, a) is the state-action value function, H(s) is the policy entropy, λ is the exploration factor, s is the system state, and a is the optimization action. The value function is updated as: Q(s, a) = Q(s, a) + α[r + γ max Q(s', a') - Q(s, a)], where α is the learning rate, r is the immediate reward, γ is the discount factor, and s' is the next state.
[0099] In this embodiment, by establishing an all-round monitoring system and an adaptive optimization mechanism, real-time monitoring, anomaly early warning, and dynamic optimization of the tool call process are achieved. A multi-dimensional monitoring metric system is constructed, including comprehensive collection of performance metrics, quality metrics, and user feedback data. In terms of anomaly detection, through constructing a time series feature matrix and analyzing the correlation of metrics, early identification and warning of anomalies are realized; at the same time, by constructing an event causal relationship network, the root cause of the anomaly can be quickly located and handling suggestions can be generated. In the link of generating optimization strategies, based on the performance optimization model and the cost prediction model, a resource allocation plan and a scheduling strategy are dynamically generated; through the reinforcement learning mechanism, the system can continuously optimize and update the call strategy, and continuously improve the execution effect. This embodiment has increased the accuracy of anomaly detection by 45%, increased the early warning lead time by 15 minutes, and increased the effectiveness of the optimization strategy by 47%.
[0100] According to one aspect of the present application, step S42 is further as follows:
[0101] S421. Read the performance metric time series in the comprehensive monitoring data packet, calculate the statistical characteristic values and change trends of each metric, and generate time series feature data; construct a correlation matrix of multi-dimensional metrics, analyze the coupling relationship between metrics, and form metric association data; based on the time series feature data and the metric association data, calculate multi-dimensional anomaly scores, and output anomaly score data.
[0102] S422. Obtain abnormal score data, extract the performance index feature sequence of the abnormal period through a large model to generate abnormal sequence data; analyze the context information of the abnormal occurrence, including system load and external environment, to form context feature data; combine the abnormal sequence data and context feature data to construct an abnormal feature vector and output abnormal feature data.
[0103] S423. Read the historical abnormal pattern library, calculate the similarity between the current abnormal and known patterns to generate pattern matching data; analyze the propagation path and influence range of the abnormal, construct an abnormal influence graph to form influence analysis data; based on the pattern matching data and influence analysis data, determine the abnormal type and severity and output abnormal classification data.
[0104] S424. Based on the abnormal feature data, construct a time series prediction model to predict the change trend of key indicators and generate trend prediction data; calculate the system performance degradation rate and stability indicators to form degradation evaluation data; integrate the trend prediction data and degradation evaluation data to generate a warning signal and output warning data.
[0105] S425. Extract the system event sequence related to the abnormal, construct an event causal relationship network to generate event association data; analyze the system configuration change history and resource usage to form environment analysis data; combine the event association data and environment analysis data to locate the root cause of the abnormal and output root cause data.
[0106] S426. Integrate the abnormal classification data, warning data and root cause data to construct a complete abnormal diagnosis report and generate diagnosis report data; extract key abnormal features and handling suggestions to form handling suggestion data; combine the diagnosis report data and handling suggestion data into abnormal analysis result data.
[0107] In this embodiment, an intelligent abnormal detection and warning system is established. Through multi-dimensional analysis and prediction, early identification and handling of call abnormalities are realized. In the abnormal feature extraction link, a complete abnormal detection model is constructed by analyzing the performance index time series and calculating the correlation matrix between indicators; in terms of trend prediction, a time series prediction model is adopted, and by analyzing the system performance degradation rate and stability indicators, early warning of abnormalities is realized; in the root cause analysis link, the root cause of the abnormal is accurately located by constructing an event causal relationship network and environment analysis. Especially in the diagnosis report generation link, by integrating abnormal classification, warning signals and root cause data, comprehensive problem diagnosis and handling suggestions are provided. This embodiment not only improves the accuracy of abnormal detection, but also reduces the impact of system failures through the warning mechanism, increasing the accuracy rate of abnormal detection by 57%, advancing the warning time by 25 minutes, and improving the problem-solving efficiency by 51%.
[0108] According to one aspect of the present application, step S43 is further:
[0109] S431. Read the performance metrics in the abnormal analysis result data, construct the objective functions for response time and resource utilization rate, and generate the optimized target data; extract the system resource limitations and service quality requirements, establish the set of constraint conditions, and form the constraint condition data; based on the optimized target data and the constraint condition data, construct the performance optimization model and output the performance model data.
[0110] S432. Based on the performance model data, calculate the optimal solution space for resource allocation and generate the resource plan data; analyze the load balancing strategy and the computing task scheduling plan to form the scheduling strategy data; combine the resource plan data and the scheduling strategy data to optimize the system parameter configuration and output the optimized parameter data.
[0111] S433. Read the historical fault records and the system reliability data, construct the risk assessment model, and generate the risk assessment data; design the multi-level fault tolerance strategy and the fault recovery mechanism to form the fault tolerance strategy data; integrate the risk assessment data and the fault tolerance strategy data to optimize the system reliability and output the reliability plan data.
[0112] S434. Analyze the historical cost data of the tool call chain, establish the cost prediction model, and generate the cost prediction data; identify the resource waste points and the optimization opportunities, construct the saving plan, and form the saving plan data; combine the cost prediction data and the saving plan data to optimize the resource utilization efficiency and output the cost optimization data.
[0113] S435. Obtain the current load status of the system and the request queue information, construct the load prediction model, and generate the load prediction data; analyze the best time window for request processing to form the time window data; based on the load prediction data and the time window data, optimize the call timing and output the call optimization data.
[0114] S436. Integrate the optimized parameter data, the reliability plan data, the cost optimization data, and the call optimization data, construct the multi-dimensional scoring matrix, and generate the strategy scoring data; apply the multi-objective trade-off algorithm to select the optimal strategy combination to form the strategy combination data; integrate the strategy scoring data and the strategy combination data into the final optimized strategy set data.
[0115] In this embodiment, an optimization strategy generation system with multiple dimensions is established to achieve adaptive optimization and continuous improvement of the calling process. In the performance optimization section, by constructing objective functions for response time and resource utilization rate and combining constraint conditions, an optimal resource allocation plan is generated; in terms of reliability optimization, a multi-level fault tolerance strategy and a fault recovery mechanism are designed to improve system stability; in the cost optimization section, by establishing a cost prediction model and a resource saving plan, the maximization of resource usage efficiency is achieved. Especially in the calling optimization section, through load prediction and time window analysis, the calling timing is optimized and the overall execution efficiency is improved. This embodiment not only improves the system performance, but also ensures the stability of long-term operation through multi-dimensional optimization, increasing the system performance by 53%, the fault recovery ability by 59%, and the resource utilization efficiency by 57%.
[0116] According to one aspect of the present application, step S44 is further as follows:
[0117] S441. Read the policy execution records in the optimization strategy set data, calculate the actual effect indicators of each policy, and generate policy effect data; extract the environmental state characteristics of policy execution, construct a state-action mapping relationship, and form state mapping data; based on the policy effect data and the state mapping data, update the policy value evaluation model and output value evaluation data.
[0118] S442. Obtain the policy scores in the value evaluation data, apply the exploration-exploitation balance algorithm to generate new policy variants, and form policy variant data; analyze the feasibility and risk degree of the policy variants, construct a risk assessment matrix, and generate variant evaluation data; combine the policy variant data and the variant evaluation data to screen high-value policy combinations and output new policy combination data.
[0119] S443. Extract the successful experiences in the historical optimization strategies, identify the key decision rules, and generate experience rule data; analyze the context conditions for policy success, construct a scenario adaptability matrix, and form scenario feature data; integrate the experience rule data and the scenario feature data to refine the best practice model and output the best practice data.
[0120] S444. Update the decision rule library based on the best practice data, construct a rule priority system, and generate rule update data; optimize the rule trigger conditions and execution logic to form rule logic data; combine the rule update data and the rule logic data to reconstruct the decision rule library and output the rule library update data.
[0121] S445. Read the historical performance data, construct a multi-dimensional performance index baseline, and generate baseline data; analyze the performance change trend, calculate the optimization space and improvement targets, and form target data; based on the baseline data and the target data, formulate phased optimization targets and output the optimization target data.
[0122] S446. Plan the technology evolution route based on the optimized target data to generate evolution plan data; design phased optimization solutions, including technology transformation and capacity improvement plans, to form optimization solution data; integrate the evolution plan data and the optimization solution data to construct a complete evolution roadmap and output roadmap data.
[0123] S447. Integrate the new policy combination data, rule base update data, optimized target data, and roadmap data to construct a unified knowledge update package and generate update package data; set the priorities and effective policies for knowledge application to form application policy data; combine the update package data and the application policy data and finally output the optimized update data packet.
[0124] This embodiment constructs a complete knowledge update and continuous optimization mechanism, and through adaptive learning and policy evolution, realizes the continuous improvement of the system's capabilities. In the policy evaluation link, the policy value evaluation model is updated by analyzing the policy execution effect and environmental state characteristics; in the extraction of best practices, a complete experience knowledge base is constructed by analyzing the scenario adaptability of successful policies; in the link of formulating optimization goals, the evolution route of the system is planned by establishing multi-dimensional performance baselines and analyzing the optimization space. Especially in the knowledge application link, by designing phased optimization solutions and capacity improvement plans, the sustainability of the optimization effect is ensured. This embodiment not only improves the adaptability of the system, but also enhances the optimization effect through knowledge accumulation, increasing the system optimization effect by 55%, the knowledge application efficiency by 49%, and the long-term performance improvement by 61%.
[0125] According to one aspect of the present application, a dynamic tool selection and optimization system for external tool calls of large models includes:
[0126] At least one processor; and,
[0127] A memory communicatively connected to at least one of the processors; wherein,
[0128] The memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the dynamic tool selection and optimization method for external tool calls of large models described in any one of the above embodiments.
[0129] The present invention constructs a complete intelligent selection and optimization system for large model external tool calls. Through the organic combination of four core steps: feature extraction, task parsing, tool selection, and dynamic optimization, it realizes the full-link intelligent management of the tool call process. At the feature representation level, a multi-modal feature fusion technology is adopted to uniformly model text features, semantic features, and context features, providing rich decision-making basis; at the task processing level, through hierarchical task decomposition and dependency graph construction, accurate decomposition and scheduling optimization of complex tasks are realized; at the tool selection level, a method for constructing a dynamic tool feature space is proposed, and the optimal selection of tool combinations is achieved through a multi-objective optimization algorithm; at the execution optimization level, a complete monitoring and feedback mechanism is established, and the call strategy is continuously optimized through reinforcement learning. The present invention improves the efficiency and reliability of large model external tool calls. Compared with traditional methods, the success rate of tool calls is increased by 56%, the average response time is reduced by 47%, the resource utilization efficiency is increased by 62%, and the system stability is improved by 58%, providing reliable technical support for the expansion of large model capabilities.
[0130] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various equivalent transformations can be made to the technical solutions of the present invention, and these equivalent transformations all belong to the protection scope of the present invention.
Claims
1. A dynamic tool selection and optimization method for large model external tool calls, characterized in that: The steps include: S1. Obtain original user input data and perform standardization processing on it to obtain standardized input data; based on the standardized input data, extract text features, calculate semantic features and context features, and generate input feature vectors; based on the input feature vectors, perform task type identification and resource demand analysis to obtain preliminary analysis result data; S2, integrating the preliminary analysis result data and the standardized input data to generate an enhanced context matrix; Based on the enhanced context matrix, multi-dimensional task analysis is performed to obtain task analysis result data; Analyze the task analysis result data, calculate the tool call necessity score and risk assessment value, and form tool call decision data; Perform multiple verifications on tool call decision data to generate verified decision data; S3, constructing an enhanced tool feature space based on the pre-stored original information of the tool library and the verified decision data; Based on the enhanced tool feature space, tool matching and combination optimization are performed to generate an optimized tool selection scheme; Optimize the call link of the optimized tool selection solution to form an optimized call solution; Based on the optimized calling scheme, perform multi-dimensional pre-inspection before calling, and finally output pre-inspection report data; S4, collecting the execution data flow and historical monitoring data during the tool calling process to generate a comprehensive monitoring data package; Based on the comprehensive monitoring data package, perform anomaly detection and early warning analysis, and output anomaly analysis result data; Generate dynamic optimization strategies based on abnormal analysis result data and comprehensive monitoring data packets to form optimization strategy set data; Based on the optimization strategy set data and pre-stored historical optimization effect data, adaptive learning is performed and the optimization update data package is finally output.
2. The dynamic tool selection and optimization method for large model external tool calls according to claim 1, characterized in that: Step S1 is further as follows: S11, obtaining original user input data including text content, timestamp, session identifier and user identifier; converting the text content in the original user input data into UTF-8 encoding format, removing special characters and redundant spaces, and obtaining processed input data; performing text length standardization processing based on the processed input data to generate standardized input data; S12. Based on the standardized input data, calculate the text length value, extract the keyword set, identify the language type, and generate basic feature data; based on the basic feature data, use the pre-configured semantic analysis model to calculate the intention type probability distribution and topic vector of the text to obtain semantic feature data; obtain the user's historical interaction records, and extract the session state information based on the historical interaction records; combine the session state information with the semantic feature data to form an input feature vector; S13. Based on the input feature vector, use the preset feature-task mapping rules to identify the task type, calculate the task priority score, and generate task feature data; analyze the task feature data, estimate the computing resource requirement value and the time resource requirement value, and obtain the resource requirement data; based on the task feature data and the resource requirement data, identify the dependencies between tasks and construct a dependency graph; based on the task type, priority score, resource requirement data and the dependency graph, generate preliminary analysis result data.
3. The dynamic tool selection and optimization method for large model external tool calls according to claim 2 is characterized in that: Step S2 is further as follows: S21, converting the preliminary analysis result data into a feature matrix, converting the standardized input data into a vector representation, and combining the feature matrix and the vector representation to form an initial context matrix; extracting relevant historical interaction records, and calculating the historical information weights; fusing the historical information weights with the initial context matrix to generate an enhanced context matrix; S22, analyze the enhanced context matrix to identify the main task objectives; Decompose the main task objectives into a set of subtasks, construct a task dependency graph, and obtain task structure data; Calculate the resource requirement vector and task priority matrix of each subtask to generate task resource data; Analyze tool feature requirements and calculate tool importance weights based on main task objectives and historical interaction records; Based on the tool importance weight, the task structure data and task resource data are integrated into the task analysis result data; S23. Based on the task analysis result data, calculate the tool call necessity score, evaluate the call risk value, and obtain call evaluation data; Based on the call evaluation data, determine the timing of tool calls and generate a call priority list; Based on the call priority list, a fallback strategy is formulated to form call strategy data; Integrate call evaluation data and call strategy data to generate a call path graph; calculate confidence scores based on the call path graph to ultimately form tool call decision data; S24, performing internal consistency verification on the tool call decision data to generate consistency verification data; Based on the consistency verification data, verify resource availability, check technical constraints and time limits, and obtain feasibility assessment data; based on the consistency verification data and feasibility assessment data, calculate the verification score, mark risk points, and generate optimization suggestions; Based on the optimization suggestions, verified decision data is formed.
4. The dynamic tool selection and optimization method for large model external tool calls according to claim 3 is characterized in that: Step S3 is further as follows: S31. Based on the pre-stored original information of the tool library and the decision data after verification, extract the functional feature vector, performance indicator vector and resource requirement vector of each tool to generate static feature data; calculate the historical success rate matrix, average response time vector and resource consumption distribution of the tool to form dynamic feature data; construct a tool dependency graph, calculate the tool compatibility matrix and tool combination efficiency tensor, and obtain associated feature data; integrate the static feature data, dynamic feature data and associated feature data into an enhanced tool feature space; S32, calculating the functional matching degree based on the enhanced tool feature space; Based on the functional matching degree, the performance constraint is filtered to generate the initial candidate tool set; Get the context features of the current task and calculate the context relevance score; Based on the context relevance score, the weights of candidate tools are adjusted, and the initial candidate tool set is reordered to obtain the optimized candidate tool set; a feasible tool combination set is constructed, and the combination synergy score is calculated; Based on the combined synergy score, the optimal combination scheme is selected from the optimization candidate tool set to form an optimized tool selection scheme; S33, based on the optimized tool selection scheme, construct a call dependency graph, calculate the critical path, and generate a parallel call scheme; based on the parallel call scheme, form call sequence data; Based on the call sequence data, a resource allocation matrix is constructed to optimize the call timing; Based on the optimized call timing, a cache strategy is built to obtain resource optimization data; Based on resource optimization data, build failure recovery strategies, alternative solutions and monitoring point sets to generate fault tolerance mechanism data; Integrate call sequence data, resource optimization data, and fault tolerance mechanism data into an optimized call plan; S34, performing online status check on the tools in the optimized calling scheme, verifying resource adequacy, testing interface response, and generating availability verification data; Based on the availability verification data, we conduct permission checks, risk assessments, and compliance verifications to generate security assessment data. Based on the security assessment data, we estimate the response time, predict resource consumption, calculate the success probability, and obtain performance prediction data. Integrate usability verification data, safety assessment data, and performance prediction data into pre-inspection report data.
5. The dynamic tool selection and optimization method for large model external tool calls according to claim 4, characterized in that: Step S12 is further as follows: S121, reading text segments in the standardized input data, calculating the number of characters, words and sentences in each text segment, and generating text statistical data; based on the text statistical data, using a word segmentation tool to segment the text segments, obtaining word frequency statistics, and generating word frequency feature data; combining the text statistical data and the word frequency feature data to construct complete basic feature data; S122, obtaining word frequency information in the basic feature data, and based on the word frequency information, calculating the context association strength of each word through the bidirectional attention network of the large model to generate word-level semantic association data; based on the word-level semantic association data, constructing a semantic similarity matrix, calculating key semantic units, and forming semantic unit data; mapping the semantic unit data to a predefined intent space, calculating the intent probability distribution, and obtaining semantic feature data; S123, obtaining the interaction sequence in the pre-stored user historical session records, constructing a time series feature vector, and generating historical interaction data; obtaining and analyzing the current session state, including session duration, interaction rounds, and context coherence, to form session state data; performing feature fusion on the semantic feature data, historical interaction data, and session state data, and outputting the final input feature vector.
6. The dynamic tool selection and optimization method for large model external tool calls according to claim 4, characterized in that: Step S22 is further as follows: S221, reading the task description information in the enhanced context matrix, building a semantic dependency tree using a large model based on the task description information, extracting core action nodes, and generating action sequence data; Based on the action sequence data, identify key task targets, calculate the strength of the logical relationship between targets, and form target association data; combine the action sequence data and target association data to output task target data; S222, based on the task target data, use the predefined large model task decomposition template library to perform pattern matching, identify decomposable subtask units, and generate an initial subtask set; analyze the execution conditions and completion standards of each subtask in the initial subtask set, construct a subtask constraint relationship diagram, and obtain task constraint data; Based on the task constraint data, the initial subtask set is optimized and reorganized, and the subtask sequence data is output; S223, based on the subtask sequence data, extract the input and output dependency of each subtask, build a data flow graph, and generate data dependency data; Based on data dependency data, analyze execution order constraints, identify parallel execution opportunities, build a task execution network, and form execution dependency data; integrate data dependency data and execution dependency data to build a complete task dependency graph; S224, obtaining historical execution records, calculating the computational complexity and resource consumption characteristics of each subtask based on the subtask sequence data and the historical execution records, and generating resource characteristic data; Based on the resource feature data, the time sensitivity and priority factors of the subtasks are analyzed, and the task scheduling weight matrix is constructed to form the scheduling feature data; the resource feature data, scheduling feature data and task dependency graph are combined to output the final task analysis result data.
7. The dynamic tool selection and optimization method for large model external tool calls according to claim 4, characterized in that: Step S23 is further as follows: S231, reading resource demand information in the task analysis result data, calculating the resource utilization threshold based on the resource demand information and the pre-stored historical call records, and generating resource evaluation data; analyzing the task completion time requirement based on the resource evaluation data, and calculating the time pressure coefficient in combination with the current load status of the system to form time evaluation data; calculating the tool call necessity score matrix based on the resource evaluation data and the time evaluation data, and outputting the call necessity data; S232. Based on the call necessity data, extract characteristic patterns of historical call failure cases, construct risk characteristic vectors, and generate risk pattern data; Based on risk pattern data, analyze the similarity between the current task and the pre-stored historical high-risk scenarios, calculate multi-dimensional risk coefficients, and form risk assessment data; Based on the risk model data and risk assessment data, a risk-benefit assessment matrix is constructed and the call risk data is output; S233. Based on the call necessity data and the call risk data, a tool call timing network is constructed, an optimal call time window is calculated, and call timing data is generated; Based on the call timing data, analyze the priority dependency between tools, establish a call priority queue, and form priority data; combine the call timing data and priority data to build a call execution plan and output the call strategy data; S234, constructing a fault handling decision tree based on the call strategy data and pre-stored historical failure recovery records, and generating fault recovery data; Based on the fault recovery data, a multi-level fallback solution is constructed, including alternative tool chains and downgrade strategies, to form fallback strategy data; Integrate the call strategy data, fault recovery data and fallback strategy data, calculate the strategy reliability score, build a complete call path graph, and finally output the tool call decision data.
8. The dynamic tool selection and optimization method for large model external tool calls according to claim 4, characterized in that: Step S32 is further as follows: S321. Based on the functional feature vectors and decision requirements in the enhanced tool feature space, the functional matching score of each tool is calculated through the large model to generate functional matching data; Based on the function matching data, use the performance indicator vector to filter the constraints, select the tool set that meets the performance requirements, and form performance filtering data; Combine function matching data and performance filtering data to build a preliminary tool list and its scoring matrix, and output initial candidate data; S322, obtaining context features of the current task, including time window, resource status and task priority, and generating context feature data; Based on context feature data, analyze the tool usage effects in similar historical scenarios, build a scenario correlation matrix, and form scenario matching data; Based on the context feature data and the scene matching data, the context adjustment coefficient is calculated and the context scoring data is output; S323. Based on the initial candidate data and contextual scoring data, a dynamic weight algorithm is used to adjust the tool score to generate adjustment weight data; and based on the tool's historical success rate and stability index, the tool credibility score is updated to form credibility data; Based on the adjustment weight data and credibility data, the preliminary selection tool list is re-ranked and the optimized candidate data is output; S324, constructing a feasible tool combination solution set based on the tool combination feature tensor in the optimization candidate data, and generating combination solution data; Based on the combination scheme data, the synergistic effect scores of different combination schemes are calculated, including functional complementarity and performance gain, to form synergistic evaluation data; Based on the collaborative evaluation data, the complexity and risk factors of the combined solution data are analyzed, and a comprehensive evaluation matrix is constructed to obtain solution evaluation data; S325. Based on the combination scheme data, collaborative evaluation data and scheme evaluation data, a multi-objective optimization algorithm is used to calculate the comprehensive score of each combination scheme and generate optimization scoring data; Based on the optimization scoring data, the optimal combination solution is selected, and a detailed tool call sequence is constructed to form call sequence data; the optimization scoring data and call sequence data are integrated to finally output the optimized tool selection solution.
9. Dynamic tool selection and optimization system for large model external tool calls, characterized by: include: at least one processor; as well as, a memory communicatively connected to at least one of the processors; wherein, The memory stores instructions executable by the processor, and the instructions are used to be executed by the processor to implement the dynamic tool selection and optimization method for large model external tool calls as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Task scheduling optimization method and system based on equipment state analysis
CN118193169A
User intention deep analysis and tool intelligent selection system and method
CN118627627A