CN-122019622-A - Instruction repairing method, device, equipment and medium
Abstract
The application belongs to the field of artificial intelligence, and relates to an instruction repairing method, device, equipment and medium. A multi-dimensional search query vector set is constructed based on the tool call instruction, the query information, and the error information. Matching repair information is retrieved from the hybrid knowledge base. And determining an adapted field constraint condition by combining an application scene corresponding to the query information, integrating the query information, the instruction, the error information, the repair information and the field constraint condition, generating a structured repair context, repairing a large model through a preset instruction, generating a corrected tool call instruction, and executing the corrected tool call instruction. The application can be applied to the business fields of finance, science, insurance, medical treatment and the like, and can improve the repairing efficiency of instructions.
Inventors
- LI JIANQIANG
- Jiang Jiesen
Assignees
- 平安科技(深圳)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260113
Claims (10)
- 1. A method of instruction repair comprising the steps of: When detecting that the tool calling instruction corresponding to the query information fails to execute, acquiring error information corresponding to the tool calling instruction, wherein the tool calling instruction is an executing instruction which is output by a large language model in response to the query information; Constructing a multi-dimensional search query vector set based on the tool call instruction, the query information and the error information; Based on the multi-dimensional search query vector set, performing search operation in a mixed knowledge base to obtain matched repair information, and calling fault multi-element document vectorization data by a pre-storage tool of the mixed knowledge base; determining a compliance strategy adapting to the application scene as a field constraint condition based on the application scene corresponding to the query information; Integrating the query information, the tool call instruction, the error information, the repair information and the domain constraint condition to generate a structured repair context; and integrating based on the repair context, repairing a large model by adopting a preset instruction, generating a corrected tool call instruction, and executing the corrected tool call instruction.
- 2. The method according to claim 1, wherein the step of constructing a multi-dimensional search query vector set based on the tool call instruction, the query information and the error information, specifically comprises: Carrying out semantic analysis on the query information to obtain user intention description; Based on the tool calling instruction, carrying out parameter consistency verification and correction on the user intention description to obtain target user intention description; Extracting resource limitation parameters from the target user intention description, and carrying out semantic expansion on the resource limitation parameters to obtain an equivalent parameter semantic set; Performing association matching on the equivalent parameter semantic set and a resource limitation configuration specification in a preset configuration specification knowledge base to generate an intention maintaining query vector; extracting error pattern features from the error information, and carrying out instruction association supplementation on the error pattern features based on the tool calling instruction to obtain an instruction association error feature set; Generating an error pattern query vector based on the instruction associated error feature set; and constructing a multi-dimensional search query vector set according to the error mode query vector and the intention maintenance query vector.
- 3. The method of claim 1, further comprising, prior to the step of performing a search operation in the hybrid knowledge base based on the set of multi-dimensional search query vectors to obtain matching repair information: Acquiring a document set of a mixed knowledge base to be constructed, wherein the document set comprises a history fault document, a technical specification document, a strategy configuration document and a community scheme document; Collecting field text data of a target field matched with the preset service scene of the mixed knowledge base, and constructing a corpus; acquiring a pre-trained universal text vector model, and performing field adaptation fine tuning on the pre-trained universal text vector model by adopting the corpus to obtain a text vector model adapted to the target field; Carrying out vectorization processing on the history fault document, the technical specification document, the strategy configuration document and the community scheme document by adopting the text vector model to obtain a corresponding text vector; And storing the text vectors, the historical fault document, the technical specification document, the strategy configuration document and the community scheme document in a correlated manner, and constructing a retrieval index based on the similarity between the text vectors to obtain the mixed knowledge base.
- 4. The method of claim 3, wherein the set of multi-dimensional search query vectors includes an error pattern query vector and an intent-to-hold query vector; the step of performing a search operation in a hybrid knowledge base based on the multi-dimensional search query vector set to obtain matched repair information specifically includes: Performing parallel search operation on the mixed knowledge base through the error mode query vector and the intention maintaining query vector to obtain a preliminarily matched document fragment set; Judging whether the number of the preliminarily matched document fragment sets exceeds a preset threshold value or not; If yes, carrying out deep interactive calculation on the document fragments in the document fragment set, the error mode query vector and the intention maintaining query vector respectively through a preset cross encoder to obtain a relevance score of each document fragment; according to the relevance score, sequencing the document fragment sets to obtain sequenced candidate document fragment sets; If not, determining the document fragment set as a sorted candidate document fragment set; And extracting the repair information matched with the error mode query vector and the intention maintenance query vector according to the sorted candidate document fragment set.
- 5. The method according to claim 1, wherein the step of determining, based on the application scenario corresponding to the query information, a compliance policy adapted to the application scenario as a domain constraint condition specifically includes: based on the application scene corresponding to the query information, carrying out scene feature dimension analysis on the tool calling instruction and the query information to generate a scene tag; Performing multidimensional matching on the scene tag and a preset scene strategy mapping library to obtain candidate compliance strategies, wherein the scene strategy mapping library stores mapping relations between application scenes and corresponding compliance strategies, and the compliance strategies are preconfigured with constraint priority rules and violation result specifications; screening the candidate compliance strategies according to the operation types of the tool calling instructions, determining an adaptive strategy set, and extracting constraint terms related to the operation types from the strategy set; Generating domain constraint conditions based on the constraint clauses, the constraint priority rules and the violation outcome specification.
- 6. The method according to claim 1, wherein the step of integrating the query information, the tool call instruction, the error information, the repair information, and the domain constraint to generate a structured repair context specifically comprises: acquiring a preset structured repair context template, wherein the template comprises a fact information area, a knowledge evidence area and a constraint condition area; Respectively filling the query information, the tool calling instruction and the error information into corresponding fields of the fact information area to obtain a filled fact information area; calculating the confidence score of the repair information by adopting a preset cross encoder, and sorting the repair information according to the confidence score to obtain sorted repair information; Acquiring source labels of the repair information from the mixed knowledge base, and filling the sequenced repair information, the confidence scores and the source labels into corresponding fields of the knowledge evidence region to obtain a filled knowledge evidence region; based on the application scene, extracting scene compliance requirements from the field constraint conditions, and filling the scene compliance requirements into corresponding fields of the constraint condition areas to obtain filled constraint condition areas; Carrying out causal relation detection on the filled fact information area and the filled knowledge evidence area, and removing first target data to obtain fact information area data and knowledge evidence area data; performing matching test on the filled constraint condition area and the application scene, and filtering second target data to obtain constraint condition area data; and integrating the fact information area data, the knowledge evidence area data and the constraint condition area data to generate a structured repair context.
- 7. The method according to claim 1, wherein the step of integrating based on the repair context and repairing a large model using a preset instruction to generate a corrected tool call instruction specifically comprises: Analyzing the error information, extracting error characteristics to obtain a service grade label, and dynamically adjusting the generation parameters of a preset instruction repair large model based on the service grade label; Generating a domain-specific system prompt word based on the application scene and the domain constraint condition, and integrating the domain-specific system prompt word with the repair context to obtain instruction repair guide information; And based on the instruction repairing guide information, repairing the large model by adopting the instruction after parameter adjustment, and generating a corrected tool calling instruction.
- 8. An instruction repair device, comprising: The acquisition module is used for acquiring error information corresponding to a tool call instruction when detecting that the tool call instruction corresponding to the query information fails to execute, wherein the tool call instruction is an execution instruction which is output by a large language model in response to the query information; The construction module is used for constructing a multi-dimensional search query vector set based on the tool calling instruction, the query information and the error information; the retrieval module is used for performing retrieval operation in a mixed knowledge base based on the multi-dimensional retrieval query vector set to obtain matched repair information, and the mixed knowledge base pre-storage tool calls fault multi-element document vectorization data; the determining module is used for determining a compliance strategy adapting to the application scene as a field constraint condition based on the application scene corresponding to the query information; the integration module is used for integrating the query information, the tool call instruction, the error information, the repair information and the domain constraint condition to generate a structured repair context; And the generation module is used for integrating based on the repair context, repairing the large model by adopting a preset instruction, generating a corrected tool call instruction, and executing the corrected tool call instruction.
- 9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which when executed by the processor implement the steps of the instruction repair method of any of claims 1 to 7.
- 10. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the instruction repair method of any of claims 1 to 7.
Description
Instruction repairing method, device, equipment and medium Technical Field The application relates to the technical field of artificial intelligence, is applied to online processing business scenes of finance technology, insurance, medical treatment and the like, and particularly relates to an instruction repairing method, device, equipment and medium. Background Under the current deep fusion of artificial intelligence technology and various business systems, a large language model (Large Language Model, LLM) is widely applied to a tool call instruction generation scene by virtue of strong natural language understanding and generating capability, can accurately respond to various business query requirements in key fields such as financial transaction processing, medical data interaction and the like, and becomes a core technical support for linking the business requirements and system execution. Aiming at the problem of failure in execution of a tool call instruction, the main stream solution in the industry is a self-thinking-back retry mechanism based on LLM, and the core realization logic is that after failure in execution of the tool call instruction is detected, the original query, the failed tool call instruction and corresponding error feedback information are simply spliced to form a new prompt word and are input to the same LLM again, and a model generates a corrected tool call instruction based on self-thinking-back capability so as to complete fault repair. However, the mainstream repairing mechanism exposes a plurality of remarkable technical defects in practical floor application, particularly in the key fields with extremely high requirements on compliance, such as finance, medical treatment and the like, the limitation is more remarkable, and the use requirement of practical business scenes is difficult to meet. On the one hand, the general LLM is not fully integrated into a domain-specific compliance strategy, so that the generated repair instruction is easy to violate the technical specifications of industry or related laws and regulations, and the compliance is not enough. On the other hand, aiming at complex types of tool call errors such as context semantic mismatch, authority configuration deletion, parameter logic conflict and the like, accurate positioning and efficient restoration of a fault source are difficult to realize only by means of a single mode of repeated retry, the restoration success rate is low, and the linkage problems such as service interruption, data abnormality and the like can be caused due to the fact that repeated retry exceeds the service level protocol contract range. Disclosure of Invention The embodiment of the application aims to provide an instruction repairing method, an instruction repairing device, computer equipment and a storage medium, which are used for solving the problems of poor compliance, low success rate of complex error repairing and insufficient repairing efficiency of the conventional tool calling error repairing mechanism. In a first aspect, an instruction repairing method is provided, which adopts the following technical scheme: When the failure of executing the tool calling instruction corresponding to the query information is detected, error information corresponding to the tool calling instruction is obtained, the tool calling instruction is an executing instruction which is output by a large language model in response to the query information, a multi-dimensional search query vector set is built based on the tool calling instruction, the query information and the error information, search operation is executed in a mixed knowledge base based on the multi-dimensional search query vector set, matched repair information is obtained, the mixed knowledge base prestores multi-element document vectorization data of tool calling faults, the compliance strategy of the adaptation application scene is determined to be a field constraint condition based on an application scene corresponding to the query information, the tool calling instruction, the error information, the repair information and the field constraint condition are integrated to generate a structured repair context, the large model is repaired by adopting a preset instruction based on the repair context, the corrected tool calling instruction is generated, and the corrected tool calling instruction is executed. In a second aspect, an instruction repairing device is provided, which adopts the following technical scheme: The acquisition module is used for acquiring error information corresponding to the tool calling instruction when detecting that the tool calling instruction corresponding to the query information fails to execute, wherein the tool calling instruction is an executing instruction which is output by the large language model in response to the query information; The construction module is used for constructing a multi-dimensional search query vector set based on the tool