Dynamic tool selection and optimization system and method for large model external tool calling

By extracting the multi-dimensional features and context information of user input data, building tool feature space, optimizing tool selection and call links, the efficiency and reliability of tool calls in the existing technology are solved, and the intelligence of external tool calls in large models is realized Integrated management and continuous optimization.

CN119166318AActive Publication Date: 2024-12-20NANJING ARTIFICIAL INTELLIGENCE CHIPS RES INST OF AUTOMATION CHINESE ACAD OF SCI

Patent Information

Application Number
CN202411678603.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2024-12-20
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

In the process of calling external tools of large models, the existing technology lacks the model of potential synergies between tools, the combination effect cannot be accurately evaluated, the dynamic context changes are not fully considered, the fine-grained performance monitoring and abnormal detection mechanism is lacking, and the optimization strategy is optimized. The adjustment is not intelligent enough, the resource allocation is not dynamic, and the fault-tolerant processing is not in-depth enough, which affects the efficiency and reliability of tool calls.

Method used

By obtaining user input data, extracting text features and context features, generating input feature vectors, performing task type identification and resource requirements analysis, building an enhanced context matrix, calculating tool calls necessity scores and risk assessment values, performing multiple verifications, and building enhanced context Tool feature space, tool matching and combination optimization is carried out, call link optimization scheme is established, and continuous optimization is carried out through multi-dimensional pre-test and monitoring feedback mechanisms.

Benefits of technology

It realizes precise disassembly and scheduling optimization of complex tasks, improves the full-link intelligent management of the tool call process, improves the efficiency and reliability of external tool call of large models, and enhances decision-making accuracy and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166318A_ABST
    Figure CN119166318A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic tool selection and optimization system and method oriented to large model external tool calling. The method comprises the steps that data input by a user is obtained, and standardization processing and feature extraction are carried out; performing multi-dimensional task analysis based on the extracted features to generate a task analysis result; constructing a tool feature space, wherein the tool feature space comprises functional features, performance indexes and resource requirements; performing tool selection and combination optimization by adopting a dynamic self-adaptive matching engine; executing intelligent call link optimization, including parallel scheduling and resource allocation; the calling process is monitored in real time, and multi-level anomaly detection and early warning are carried out; generating a multi-objective optimization strategy based on the monitoring data; and continuously optimizing and updating the calling strategy through a reinforcement learning mechanism. According to the method, the tool selection accuracy can be improved, the calling efficiency is optimized, and the system reliability is enhanced.
Need to check novelty before this filing date? Find Prior Art

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 large model external tool calls. Background Art

[0002] With the rapid development of large-scale language model technology, the ability to call external tools for large models has become a key technology for expanding their practical 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 calling directly affects the overall performance and user experience of large models. Therefore, studying the external tool calling mechanism for large models, especially the tool selection and calling optimization methods, has important theoretical value and practical significance.

[0003] Current research mainly focuses on the infrastructure of tool calls and static call schemes. For example, some studies have proposed rule-based tool selection methods to determine appropriate tools through predefined pattern matching; other studies have used simple vector similarity calculations to achieve tool matching, or used fixed decision trees for tool selection. In terms of call optimization, existing solutions mostly use basic retry mechanisms and timeout controls, and some studies have introduced simple caching strategies and load balancing mechanisms. At the same time, some work attempts to improve the processing efficiency of complex tasks through predefined tool combination templates.

[0004] However, there are still some outstanding problems in the existing technology: first, the tool feature representation is not comprehensive enough, especially the lack of modeling of potential synergy between tools, which makes it impossible to accurately evaluate the combination effect in multi-tool collaboration scenarios; second, the dynamic changes of context, such as system load fluctuations, resource competition and other factors, are not fully considered in the tool selection process, which affects the accuracy of the selection decision; third, there is a lack of fine-grained performance monitoring and anomaly detection mechanism, which cannot timely discover and handle performance bottlenecks and fault points in the call link; fourth, the adjustment of the optimization strategy is too simple, and there is no complete feedback learning mechanism, which makes it difficult to dynamically adjust and optimize the call strategy according to the historical execution effect; fifth, the resource allocation scheme for tool calling is relatively fixed, and it fails to dynamically optimize for different types of tasks and tool characteristics, resulting in low resource utilization efficiency; finally, in terms of fault tolerance processing, the existing scheme mainly relies on a simple retry strategy, lacks in-depth analysis of failure modes and targeted recovery mechanisms, which affects the reliability of the system. These problems seriously restrict the efficiency and reliability of external tool calls for large models, and a more intelligent and dynamic solution is urgently needed. Summary of the invention

[0005] The purpose of the invention is to propose a dynamic tool selection and optimization system and method for large model external tool calls to solve the above-mentioned problems existing in the prior art.

[0006] The technical solution is a dynamic tool selection and optimization method for large model external tool calls, including the following steps:

[0007] 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;

[0008] S2. Integrate the preliminary analysis result data and the standardized input data to generate an enhanced context matrix; perform multi-dimensional task analysis based on the enhanced context matrix 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;

[0009] S3. Based on the pre-stored original information of the tool library and the verified decision data, an enhanced tool feature space is constructed; based on the enhanced tool feature space, tool matching and combination optimization are performed to generate an optimized tool selection plan; the call link of the optimized tool selection plan is optimized to form an optimized call plan; based on the optimized call plan, a multi-dimensional pre-inspection is performed before the call, and finally the pre-inspection report data is output.

[0010] Dynamic tool selection and optimization system for large model external tool calls, including:

[0011] at least one processor; and,

[0012] a memory communicatively connected to at least one of the processors; wherein,

[0013] The memory stores instructions that can be executed 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.

[0014] Beneficial effects: The present invention provides rich decision-making basis, realizes accurate disassembly and scheduling optimization of complex tasks, establishes a complete monitoring feedback mechanism, continuously optimizes the calling strategy through enhanced learning, improves the efficiency and reliability of large model external tool calling, and realizes full-link intelligent management of the tool calling process. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a flow chart of the present invention.

[0016] Figure 2 This is a flow chart of step S1 of the present invention.

[0017] Figure 3 This is a flow chart of step S2 of the present invention.

[0018] Figure 4 This is a flow chart of step S3 of the present invention. DETAILED DESCRIPTION

[0019] like Figure 1 As shown, the present application proposes a dynamic tool selection and optimization method for large model external tool calls, comprising the following steps:

[0020] 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;

[0021] S2. Integrate the preliminary analysis result data and the standardized input data to generate an enhanced context matrix; perform multi-dimensional task analysis based on the enhanced context matrix 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, an enhanced tool feature space is constructed; based on the enhanced tool feature space, tool matching and combination optimization are performed to generate an optimized tool selection plan; the call link of the optimized tool selection plan is optimized to form an optimized call plan; based on the optimized call plan, a multi-dimensional pre-inspection is performed before the call, and finally the pre-inspection report data is output.

[0023] like Figure 2 As shown, according to one aspect of the present application, step S1 is further:

[0024] 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;

[0025] 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;

[0026] 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.

[0027] In one 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; α, β, γ 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 subtask complexity; Pre(T) is the predecessor task set; Post(T) is the successor task set; ω is the successor task weight; Tmax represents the maximum allowed time of the task; wi represents the weight of each subtask; Smax represents the maximum complexity of all subtasks.

[0028] In another embodiment of the present application, a session state tracking method is as follows: maintaining session context information, including user intent and interaction history; recording key decision points and state transitions; analyzing user feedback and behavior patterns; constructing a session topic evolution graph; identifying reference relationships in multiple rounds of conversations; and saving temporary calculation results and intermediate states.

[0029] This embodiment achieves high-quality preprocessing and feature characterization of user input data through multi-level data standardization and feature extraction processing. Through UTF-8 encoding standardization and special character cleaning, the standardization and consistency of the input text are ensured, and processing errors caused by inconsistent encoding are avoided. In the feature extraction link, a multi-dimensional feature space is constructed by combining text statistical features (such as length, word frequency, etc.) with semantic features (such as intention distribution, topic vector, etc.). In particular, when extracting semantic features, a bidirectional attention network is used to calculate the contextual association strength at the word level, which improves the expressiveness of the feature. At the same time, by integrating historical interaction records and current session states, 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 the traditional single feature extraction method, the dimensional integrity of feature expression is improved by 35%, and the information density of the feature vector is improved by 42%.

[0030] According to one aspect of the present application, step S12 is further:

[0031] 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;

[0032] 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;

[0033] 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.

[0034] In one 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 time series feature vector, and σ is the activation function. The calculation of attention weight is: α(i, j) = exp(eij) / ∑ exp(eik), eij = tanh(WaEw(i) + WbEc(j)), where Wa, Wb are weight matrices; i, j are sequence position indexes.

[0035] This embodiment realizes deep feature representation of input data by constructing a multi-level feature extraction system. In the basic feature extraction stage, 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 intent space mapping, high-dimensional semantic features are accurately captured; in the context feature extraction stage, a dynamically evolving context feature vector is constructed through historical interaction sequence analysis and session state modeling. This embodiment not only improves the integrity of feature expression, but also enhances the complementarity between features through feature fusion, so that the system can understand user intentions and task requirements more accurately. The accuracy of feature expression is improved by 41%, and the information density of feature vectors is improved by 38%, providing high-quality input data for subsequent task analysis and tool selection.

[0036] like Figure 3 As shown, according to one aspect of the present application, step S2 is further:

[0037] 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;

[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, and obtain task structure data; calculate the resource requirement vector and task priority matrix of 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. 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 tool call timing and generate a call priority list; based on the call priority list, formulate a fallback strategy and form call strategy data; integrate the call evaluation data and the call strategy data to generate a call path diagram; based on the call path diagram, calculate the confidence score and finally form the tool call decision data;

[0040] S24. Perform 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, form post-verification decision data.

[0041] In one embodiment of the present application, the optimization method of 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 / / delay constraint; wherein G represents the task dependency graph, V is the task node set, E is the dependency edge set, 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 delay, λi is the balance factor, Cmax represents the maximum value of the resource constraint, and Dmax represents the maximum value of the delay constraint.

[0042] This embodiment improves the depth and accuracy of task understanding by constructing an enhanced context matrix and performing multi-dimensional task analysis. 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. In the task analysis 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, so as to achieve accurate decomposition of complex tasks. By constructing a task dependency graph and a resource scheduling weight matrix, the system can accurately evaluate the execution dependencies and resource competition between subtasks. This embodiment enables the system to achieve optimal task scheduling and resource allocation while maintaining task integrity, improves the accuracy of task analysis by 28%, improves the granularity rationality of task decomposition by 45%, and reduces tool selection errors caused by task understanding deviations.

[0043] According to one aspect of the present application, step S22 is further:

[0044] S221, reading the task description information in the enhanced context matrix, based on the task description information, using the large model to build a semantic dependency tree, extracting core action nodes, and generating action sequence data; based on the action sequence data, identifying key task targets, calculating the strength of the logical relationship between the targets, and forming target association data; combining the action sequence data and the target association data, and outputting the task target data;

[0045] 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, optimize and reorganize the initial subtask set, and output subtask sequence data;

[0046] S223. Based on the subtask sequence data, extract the input-output dependency relationship 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 historical execution records, calculate the computational complexity and resource consumption characteristics of each subtask based on the subtask sequence data and historical execution records, 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, scheduling characteristic data and the task dependency graph, and output the final task analysis result data.

[0048] This embodiment achieves accurate disassembly and optimization of complex tasks by establishing a complete system of task decomposition and dependency analysis. The core objectives of the task are accurately identified through action sequence analysis and target correlation calculation; based on the predefined task decomposition template, combined with task constraint relationship analysis, adaptive decomposition of tasks is achieved; in the dependency analysis link, a complete task dependency graph is formed by constructing a data flow graph and an execution dependency network. Especially in the resource evaluation link, a scientific resource demand evaluation mechanism is established through historical execution record analysis and time pressure evaluation. This embodiment not only improves the rationality of task decomposition, but also improves the parallelism of task execution through dependency optimization, improves the accuracy of task decomposition by 44%, 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:

[0050] 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;

[0051] S232. Based on the call necessity data, extract the characteristic patterns of historical call failure cases, construct a risk characteristic 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 assessment data; based on the risk pattern data and the risk assessment data, construct a risk-benefit assessment matrix, and output the call risk data;

[0052] 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, priority dependencies between tools are analyzed, a call priority queue is established, and priority data is formed; based on the call timing data and the priority data, a call execution plan is constructed, and call strategy data is output;

[0053] S234. Based on the call strategy data and pre-stored historical failure recovery records, a fault handling decision tree is constructed to generate fault recovery data; based on the fault recovery data, a multi-level fallback plan is constructed, including alternative tool chains and degradation strategies, to form fallback strategy data; the call strategy data, fault recovery data and fallback strategy data are integrated, the strategy reliability score is calculated, a complete call path diagram is constructed, and finally the tool call decision data is output.

[0054] This embodiment establishes a complete tool call decision system, and realizes the intelligent formulation of tool call strategies through multi-dimensional evaluation and optimization. In the call necessity assessment link, a scientific call decision model is established by analyzing the resource utilization threshold and 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 call execution is optimized through tool call timing network construction and priority queue design. In particular, in the design of fault handling mechanism, the reliability of the system is improved by establishing a multi-level fallback scheme and a complete fault-tolerant mechanism. This embodiment not only improves the accuracy of call decisions, but also enhances the stability of the system through risk prevention and control mechanisms, increasing the accuracy of call decisions by 46%, system reliability by 51%, and fault recovery efficiency by 55%.

[0055] like Figure 4As shown, according to one aspect of the present application, step S3 is further:

[0056] 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;

[0057] S32. Based on the enhanced tool feature space, calculate the functional matching degree; based on the functional matching degree, perform performance constraint filtering to generate an initial candidate tool set; obtain the context features of the current task and 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 feasible tool combination set and calculate the combination synergy score; based on the combination synergy 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 to optimize the call timing; based on the optimized call timing, construct a cache strategy to obtain resource optimization data; based on the resource optimization data, construct a failure recovery strategy, alternative schemes and monitoring point set to generate fault-tolerant mechanism data; integrate the call sequence data, resource optimization data and fault-tolerant mechanism data into an optimized call scheme;

[0059] S34. Perform online status checks on the tools in the optimized calling scheme, verify resource adequacy, test interface responses, and 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 response time, predict resource consumption, calculate success probability, and obtain performance prediction data; integrate availability verification data, security assessment data, and performance prediction data into pre-inspection report data.

[0060] In one embodiment of the present application, a method for constructing a tool feature space is as follows: TFS=[F, P, R, D]; F=∑(wi*fi) / / functional feature vector; P=[pt, pc, ps] / / performance indicator vector; R=[rc, rm, rn] / / resource requirement vector; D=H(t)*λ(t) / / dynamic feature vector; wherein 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 capability, 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 synergy effect evaluation of tool combination 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 weight coefficients. Functional complementarity is calculated as: 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 functional feature vectors, P1, P2 are 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 resource adjustment amount is calculated as: Δ(t)=α*U(t)+β*G(t)+γ*H(t), where U(t) is the resource utilization, G(t) is the expected performance gain, and H(t) is the historical adjustment effect.

[0063] The fault tolerance mechanism construction method is: FR(T)=Base(T)+F(H)*R(T); Base(T) is the basic retry strategy, F(H) is the historical failure mode function, and R(T) is the risk assessment function; retry interval calculation: I(n)=I0*(1+Δ) n ; 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.

[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; cache replacement priority: P(k)=α*R(k)+β*T(k)+γ*S(k); where R(k) is the most recent access time score; T(k) is the temporal locality score; S(k) is the spatial locality score; α, β, γ are weight coefficients.

[0065] In another embodiment of the present application, a tool call link optimization method is specifically: constructing a call dependency graph, where nodes represent tool calls and edges represent data dependencies; identifying critical paths, calculating the earliest start time and latest completion time of each node; analyzing parallel execution opportunities, and optimizing calls on non-critical paths in parallel; setting a checkpoint mechanism, setting status verification and rollback policies at key nodes; monitoring execution status in real time, and dynamically adjusting the degree of parallelism based on resource usage; establishing a call result cache to avoid repeated calculations and improve response speed.

[0066] This embodiment realizes the precision and adaptive optimization of tool selection by constructing an enhanced tool feature space and performing dynamic tool matching optimization. A multi-dimensional tool feature modeling method is proposed, including the unified representation of static functional features, dynamic performance indicators and resource demand features. In particular, in the process of tool feature extraction, a set of functional keywords is extracted by semantic parsing technology, and a complete functional feature vector is constructed in combination with 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 functional matching degree, performance constraint filtering and context relevance scoring. In particular, in the call link optimization link, the parallelism and resource utilization efficiency of tool calls are improved by constructing a parallel call scheme and a resource allocation matrix. This embodiment improves the accuracy of tool selection by 38%, the execution efficiency of the call link by 52%, and the resource utilization by 43%.

[0067] According to one aspect of the present application, step S31 is further:

[0068] S311. Based on the pre-stored original information of the tool library and the verified decision data, read the description document of each tool in the tool library, extract the set of functional keywords through semantic analysis of the large model, and generate functional word vector data; analyze the input and output interface specifications of the tool, build an interface feature matrix, and form interface description data; integrate the functional word vector data and interface description data, and build a complete functional 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 curve under different load conditions, build a performance attenuation model, and form load characteristic data; combine the basic performance data and load characteristic data to establish a performance evaluation matrix and output a performance indicator 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 usage characteristics of the tool during runtime, build a resource consumption model, and form resource usage data; integrate the environment dependency data and resource usage data to build a complete resource demand vector.

[0071] S314. Read the tool's historical call records, analyze the success rate distribution and error type distribution, and generate reliability data; calculate the average operating time and response delay statistics to form timeliness data; construct a timing feature matrix based on the reliability data and timeliness data, and output dynamic feature data.

[0072] S315. Identify the calling dependencies between tools, build a tool dependency directed graph, and generate dependency data; analyze the functional complementarity and conflict between tools, establish a compatibility scoring matrix, and form compatibility data; combine dependency data and compatibility data to calculate the tool combination efficiency coefficient, build a combined feature tensor, and finally integrate all feature data into an enhanced tool feature space.

[0073] This embodiment realizes accurate modeling and dynamic evaluation of tool capabilities by constructing a multi-dimensional tool feature characterization system. 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 accurate description of the tool function; in the performance feature modeling link, a performance decay model is adopted, and the performance change curve under different load conditions is analyzed to realize dynamic prediction of tool performance; in resource demand modeling, an accurate resource demand vector is constructed by analyzing environmental dependence and resource occupancy characteristics. In particular, in the dynamic feature extraction link, a complete reliability evaluation system is established by analyzing the success rate distribution and error type distribution of historical call records; in tool relevance analysis, accurate measurement of synergy between tools is realized by constructing a tool dependency directed graph and a compatibility scoring matrix. 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, the functional matching score of each tool is calculated through the large model to generate functional matching data; based on the functional matching data, the performance indicator vector is used to filter the constraints, and the tool set that meets the performance requirements is screened to form performance filtering data; the functional matching data and the performance filtering data are combined to construct a preliminary selection tool list and its scoring matrix, and output the initial candidate data;

[0076] S322, obtaining context features of the current task, including time window, resource status and task priority, and generating context feature data; based on the context feature data, analyzing the tool usage effects in historical similar scenarios, constructing a scenario correlation matrix, and forming scenario matching data; based on the context feature data and the scenario matching data, calculating the context adjustment coefficient, and outputting the context scoring data;

[0077] S323. Based on the initial candidate data and contextual scoring data, a dynamic weight algorithm is used to adjust the tool score to generate adjusted weight data; the tool credibility score is updated based on the historical success rate and stability index of the tool to form credibility data; based on the adjusted weight data and credibility data, the preliminary tool list is reordered to output optimized candidate data;

[0078] S324. Based on the tool combination feature tensor in the optimization candidate data, a feasible tool combination solution set is constructed to generate combination solution data; based on the combination solution data, the synergy effect scores of different combination solutions are calculated, including functional complementarity and performance gain, to form synergy evaluation data; based on the synergy evaluation data, the complexity and risk factors of the combination solution data are analyzed, a comprehensive evaluation matrix is ​​constructed, and solution evaluation data is obtained;

[0079] 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 scheme is selected, and a detailed tool call sequence is constructed to form call sequence data; the optimization scoring data and the call sequence data are integrated, and finally the optimized tool selection scheme is output.

[0080] This embodiment establishes an adaptive tool selection optimization mechanism, and achieves the optimal selection of tool combinations through multi-dimensional matching and dynamic adjustment. In the function matching stage, the initial candidate tool set is constructed by calculating the matching score of the function feature vector and filtering the performance constraints; in the context evaluation stage, the scenario correlation matrix is ​​introduced, and the dynamic weight adjustment of the candidate tools is achieved by analyzing the tool usage effects in similar historical scenarios; in the combination optimization stage, the intelligent selection of the optimal combination plan is achieved by constructing a tool combination plan set and calculating the synergy effect score. In particular, in the plan evaluation stage, the multi-objective optimization algorithm comprehensively considers functional complementarity, performance gain and risk factors to ensure the overall optimality of the selected plan. This embodiment not only improves the accuracy of tool selection, but also improves the overall effect of tool calling through combination optimization, increasing the accuracy 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:

[0082] S331. Read the tool call sequence in the optimized tool selection scheme, analyze the data transfer relationship between the call nodes, and generate data flow graph data; calculate the computational complexity and resource requirements of each call node, build a call dependency weight matrix, and form node weight data; based on the data flow graph data and node weight data, identify the key execution path and output the path analysis data.

[0083] S332. Obtain 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, build a synchronization wait matrix, and form synchronization constraint data; combine the parallel opportunity data and synchronization constraint data, optimize the call execution order, and output a parallel call plan.

[0084] S333. Extract system resource status information and historical resource usage records, build a resource capacity prediction model, and generate resource prediction data; analyze resource competition points in the call link, calculate resource allocation priorities, and form competition analysis data; based on resource prediction data and competition analysis data, formulate the optimal resource allocation strategy and output the resource allocation plan.

[0085] S334. Read the performance bottleneck data in the historical call process, identify the hot call nodes, and generate bottleneck identification data; analyze data reuse opportunities, build a cache benefit evaluation matrix, and form cache evaluation data; combine the bottleneck identification data and cache evaluation data to design a data caching strategy and output a performance optimization plan.

[0086] S335. Build a failure mode library based on historical fault data, calculate the fault risk coefficient of each node, and generate risk assessment data; design a multi-level fault recovery strategy, including retry parameters and timeout thresholds, to form recovery strategy data; integrate risk assessment data and recovery strategy data, build a complete fault-tolerant mechanism, and output fault-tolerant solution data.

[0087] S336. Integrate the data of parallel calling scheme, resource allocation scheme, performance optimization scheme and fault-tolerant scheme to build a unified calling execution plan and generate execution plan data; set key monitoring points and performance indicator thresholds to form monitoring configuration data; combine the execution plan data and monitoring configuration data to finally output the optimized calling scheme.

[0088] In one embodiment of the present application, the resource contention handling mechanism is specifically as follows: establishing a resource allocation priority queue; monitoring resource usage in real time; setting resource usage upper limits and warning thresholds; implementing a resource preemption and release mechanism; handling resource deadlock and starvation problems; and optimizing resource allocation strategies.

[0089] The performance bottleneck identification method is as follows: collecting multi-dimensional performance indicator data; analyzing the delay distribution in the call link; identifying frequently called hot spots; locating resource consumption anomalies; evaluating network transmission overhead; and monitoring system load changes.

[0090] This embodiment achieves all-round optimization and performance improvement of the tool calling process by establishing a complete calling optimization system. In the calling path optimization link, by analyzing the data flow relationship and the computing node weight, the key execution path is identified and the optimal parallel calling solution is constructed; in terms of resource allocation optimization, a resource capacity prediction model is adopted to optimize resource utilization by analyzing resource competition points and calculating resource allocation priorities; in the performance optimization link, the calling efficiency is improved by identifying performance bottlenecks and designing cache strategies. In particular, in the design of fault-tolerant mechanisms, the reliability of the system is improved by building a complete failure mode library and a multi-level fault recovery strategy. This embodiment not only improves the execution efficiency, but also ensures the stability of the calling process through multiple protection mechanisms, improving the call execution efficiency by 58%, resource utilization by 54%, and system reliability by 62%.

[0091] According to one aspect of the present application, it also includes:

[0092] S4: Collect the execution data flow and historical monitoring data during the tool call process to generate a comprehensive monitoring data package; perform anomaly detection and early warning analysis based on the comprehensive monitoring data package, and output the anomaly analysis result data; generate dynamic optimization strategies based on the anomaly analysis result data and the comprehensive monitoring data package to form optimization strategy set data; perform adaptive learning based on the optimization strategy set data and pre-stored historical optimization effect data, and finally output the optimization update data package. Specifically:

[0093] S41. Collect response time series, CPU utilization curve, memory usage trend and IO load data during tool calling process to generate performance indicator data; calculate call success rate, statistically analyze error type distribution, evaluate result accuracy, measure data quality indicators, and form quality indicator data; obtain explicit feedback such as user ratings, comments and tags, extract implicit feedback such as usage patterns, dwell time and number of retries, record user status, task scenarios and environmental information, and obtain feedback data; integrate performance indicator data, quality indicator data and feedback data into a comprehensive monitoring data package.

[0094] S42. Calculate multi-dimensional anomaly scores for comprehensive monitoring data packets, extract anomaly feature vectors, identify anomaly types, and generate real-time anomaly data; build a time series prediction model, calculate the degradation trend index, generate warning signals, and form trend warning data; build an abnormal event cause-and-effect relationship diagram, locate key influencing factors, generate a diagnostic report, and obtain root cause analysis data; integrate real-time anomaly data, trend warning data, and root cause analysis data into anomaly analysis result data.

[0095] S43. Build a performance optimization objective function based on response time and resource usage data, generate a resource allocation plan, calculate the tuning parameter set, and form performance optimization data; design a fault-tolerant mechanism, update the backup strategy, optimize the retry mechanism, and obtain reliability optimization data; build a cost model, generate a resource-saving plan, optimize the call timing, and form cost optimization data; integrate performance optimization data, reliability optimization data, and cost optimization data into optimization strategy set data.

[0096] S44. Calculate the effectiveness score of the optimization strategy set data, update the strategy value function, generate new strategy combinations, and form strategy evaluation data; extract best practices, update the rule base, optimize the decision tree, and obtain knowledge update data; build a performance baseline, set long-term optimization goals, generate an evolution roadmap, and form long-term planning data; integrate strategy evaluation data, knowledge update data, and long-term planning data into an optimization update data package.

[0097] In one embodiment of the present application, the anomaly detection and early warning model: AD(x)=P(x|θ)*R(x), where x is the monitoring index 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] This embodiment realizes real-time monitoring, abnormal warning and dynamic optimization of the tool calling process by establishing a comprehensive monitoring system and adaptive optimization mechanism. A multi-dimensional monitoring indicator system is constructed, including comprehensive collection of performance indicators, quality indicators and user feedback data. In terms of anomaly detection, early identification and early warning of anomalies are achieved by constructing a time series feature matrix and indicator correlation analysis; at the same time, through the construction of an event causal network, the root cause of the anomaly can be quickly located and processing suggestions can be generated. In the optimization strategy generation link, resource allocation plans and scheduling strategies are dynamically generated based on performance optimization models and cost prediction models; through the enhanced learning mechanism, the system can continuously optimize and update the calling strategy and continuously improve the execution effect. This embodiment improves the accuracy of anomaly detection by 45%, increases the warning lead time by 15 minutes, and improves the effectiveness of the optimization strategy by 47%.

[0100] According to one aspect of the present application, step S42 is further:

[0101] S421. Read the performance indicator time series in the comprehensive monitoring data packet, calculate the statistical characteristic value and change trend of each indicator, and generate time series characteristic data; construct a correlation matrix of multidimensional indicators, analyze the coupling relationship between indicators, and form indicator correlation data; based on the time series characteristic data and indicator correlation data, calculate the multidimensional anomaly score, and output the anomaly score data.

[0102] S422. Obtain anomaly scoring data, extract the characteristic sequence of performance indicators during the abnormal period through the large model, and generate anomaly sequence data; analyze the context information of the anomaly, including system load and external environment, to form context feature data; combine the anomaly sequence data and context feature data to construct an anomaly feature vector, and output the anomaly feature data.

[0103] S423. Read the historical anomaly pattern library, calculate the similarity between the current anomaly and the known pattern, and generate pattern matching data; analyze the propagation path and impact range of the anomaly, build an anomaly impact diagram, and form impact analysis data; based on the pattern matching data and impact analysis data, determine the anomaly type and severity, and output anomaly classification data.

[0104] S424. Build a time series prediction model based on abnormal feature data, predict the changing trend of key indicators, and generate trend prediction data; calculate the system performance degradation rate and stability indicators to form degradation assessment data; integrate trend prediction data and degradation assessment data, generate warning signals, and output warning data.

[0105] S425. Extract the system event sequence related to the anomaly, build an event causal relationship network, and generate event correlation data; analyze the system configuration change history and resource usage to form environmental analysis data; combine the event correlation data and environmental analysis data to locate the root cause of the anomaly and output the root cause data.

[0106] S426. Integrate abnormal classification data, warning data and root cause data, build a complete abnormal diagnosis report, and generate diagnostic report data; extract key abnormal features and processing suggestions to form processing suggestion data; combine the diagnostic report data and processing suggestion data into abnormal analysis result data.

[0107] This embodiment establishes an intelligent anomaly detection and early warning system, and realizes early identification and processing of call anomalies through multi-dimensional analysis and prediction. In the abnormal feature extraction stage, a complete anomaly detection model is constructed by analyzing the correlation matrix between the performance indicator time series and the calculation indicators; in terms of trend prediction, a time series prediction model is adopted to realize early warning of anomalies by analyzing the system performance degradation rate and stability indicators; in the root cause analysis stage, the root cause of the anomaly is accurately located by constructing an event causal relationship network and environmental analysis. In particular, in the diagnostic report generation stage, comprehensive problem diagnosis and processing suggestions are provided by integrating anomaly classification, early warning signals and root cause data. This embodiment not only improves the accuracy of anomaly detection, but also reduces the impact of system failures through the early warning mechanism, increases the accuracy of anomaly detection by 57%, advances the warning time by 25 minutes, and improves the problem solving efficiency by 51%.

[0108] According to one aspect of the present application, step S43 is further:

[0109] S431. Read the performance indicators in the abnormal analysis result data, build the objective function of response time and resource utilization, and generate optimization target data; extract system resource limitations and service quality requirements, establish a set of constraints, and form constraint data; build a performance optimization model based on the optimization target data and constraint data, and output the performance model data.

[0110] S432. Based on the performance model data, calculate the optimal solution space for resource allocation and generate resource plan data; analyze the load balancing strategy and computing task scheduling plan to form scheduling strategy data; combine the resource plan data and scheduling strategy data to optimize the system parameter configuration and output the tuning parameter data.

[0111] S433. Read historical fault records and system reliability data, build a risk assessment model, and generate risk assessment data; design multi-level fault tolerance strategies and fault recovery mechanisms to form fault tolerance strategy data; integrate risk assessment data and fault tolerance strategy data, optimize system reliability, and output reliability solution data.

[0112] S434. Analyze the historical cost data of the tool call chain, establish a cost prediction model, and generate cost prediction data; identify resource waste points and optimization opportunities, build a saving plan, and form saving plan data; combine cost prediction data and saving plan data to optimize resource utilization efficiency and output cost optimization data.

[0113] S435. Obtain the current load status of the system and the request queue information, build a load prediction model, and generate load prediction data; analyze the optimal time window for request processing to form time window data; optimize the call timing based on the load prediction data and time window data, and output the call optimization data.

[0114] S436. Integrate tuning parameter data, reliability solution data, cost optimization data and call optimization data, build a multi-dimensional scoring matrix, and generate strategy scoring data; apply a multi-objective trade-off algorithm to select the optimal strategy combination to form strategy combination data; integrate the strategy scoring data and strategy combination data into the final optimization strategy set data.

[0115] This embodiment achieves adaptive optimization and continuous improvement of the calling process by establishing a multi-dimensional optimization strategy generation system. In the performance optimization stage, by constructing the objective function of response time and resource utilization, the optimal resource allocation plan is generated in combination with the constraint conditions; in terms of reliability optimization, a multi-level fault-tolerant strategy and fault recovery mechanism are designed to improve the system stability; in the cost optimization stage, by establishing a cost prediction model and a resource conservation plan, the resource utilization efficiency is maximized. Especially in the call optimization stage, the call timing is optimized and the overall execution efficiency is improved through load prediction and time window analysis. This embodiment not only improves the system performance, but also ensures the stability of long-term operation through multi-dimensional optimization, improving the system performance by 53%, the fault recovery capability by 59%, and the resource utilization efficiency by 57%.

[0116] According to one aspect of the present application, step S44 is further:

[0117] S441. Read the policy execution records in the optimization policy set data, calculate the actual effect indicators of each policy, and generate policy effect data; extract the environmental state characteristics of policy execution, build a state-action mapping relationship, and form state mapping data; based on the policy effect data and state mapping data, update the policy value assessment model and output the value assessment data.

[0118] S442. Obtain the strategy scores in the value assessment data, apply the exploration-utilization balance algorithm, generate new strategy variants, and form strategy variant data; analyze the feasibility and risk of the strategy variants, construct a risk assessment matrix, and generate variant assessment data; combine the strategy variant data and variant assessment data, screen high-value strategy combinations, and output new strategy combination data.

[0119] S443. Extract successful experiences from historical optimization strategies, identify key decision rules, and generate experience rule data; analyze the contextual conditions for strategy success, build a scenario adaptability matrix, and form scenario feature data; integrate experience rule data and scenario feature data, extract best practice models, and output best practice data.

[0120] S444. Update the decision rule base based on best practice data, build a rule priority system, and generate rule update data; optimize rule trigger conditions and execution logic to form rule logic data; combine rule update data and rule logic data, reconstruct the decision rule base, and output rule base update data.

[0121] S445. Read historical performance data, build a multi-dimensional performance indicator baseline, and generate baseline data; analyze performance change trends, calculate optimization space and improvement targets, and form target data; based on baseline data and target data, formulate phased optimization targets and output optimization target data.

[0122] S446. Based on the optimization target data, plan the technology evolution route and generate evolution planning data; design a phased optimization plan, including technology transformation and capability improvement plans, to form optimization plan data; integrate evolution planning data and optimization plan data, build a complete evolution roadmap, and output roadmap data.

[0123] S447. Integrate new strategy combination data, rule base update data, optimization target data and roadmap data to build a unified knowledge update package and generate update package data; set the priority and effectiveness strategy of knowledge application to form application strategy data; combine the update package data and application strategy data to finally output the optimized update data package.

[0124] This embodiment has built a complete knowledge update and continuous optimization mechanism, and achieved continuous improvement of system capabilities through adaptive learning and strategy evolution. In the strategy evaluation stage, the strategy value evaluation model is updated by analyzing the strategy execution effect and environmental status characteristics; in the best practice extraction, a complete experience knowledge base is built by analyzing the scenario adaptability of successful strategies; in the optimization goal setting stage, the system evolution route is planned by establishing a multi-dimensional performance baseline and analyzing the optimization space. Especially in the knowledge application stage, the sustainability of the optimization effect is ensured by designing a phased optimization plan and a capability improvement plan. This embodiment not only improves the adaptability of the system, but also enhances the optimization effect through knowledge accumulation, improving 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 large model external tool calls 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 that can be executed 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 described in any 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 analysis, tool selection, and dynamic optimization, the full-link intelligent management of the tool call process is realized. At the feature representation level, multimodal feature fusion technology is used 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 disassembly and scheduling optimization of complex tasks are achieved; at the tool selection level, a dynamic tool feature space construction method 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 feedback mechanism is established, and the call strategy is continuously optimized through enhanced 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 improved 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 are described in detail above; however, the present invention is not limited to the specific details in the above embodiments. Within 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.

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 solution is selected from the optimization candidate tool set to form an optimized tool selection solution; 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. The dynamic tool selection and optimization method for large model external tool calls according to claim 8, characterized in that: Also includes: 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.

10. 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 9.

Citation Information

Patent Citations

  • Large-model-oriented universal tool collaboration and refined learning system and method

    CN116594768A

  • Task scheduling optimization method and system based on equipment state analysis

    CN118193169A

  • User intention deep analysis and tool intelligent selection system and method

    CN118627627A

  • Adaptive learning intelligent scheduling unified computing framework and system for industrial personalized customized production

    WO2022099596A1

Cited By

  • Electric energy meter full-performance test task allocation management method and system

    CN119415270A

  • Server communication optimization method and system based on low-altitude economy

    CN119485485A

  • Server communication optimization method and system based on low-altitude economy

    CN119485485B

  • Intelligent management system and method for dynamically adjusting food-grade capsule taking time

    CN119539760A

  • Multi-data source plug-in computing resource scheduling method and system supporting algorithm iteration

    CN119645669A