Task cue word optimization method and device, electronic equipment and storage medium
By retrieving and reconstructing task request prompts from the experience knowledge base, the problem of large language models being dependent on the quality of user input is solved, achieving efficient and reliable intelligent agent prompt optimization, and improving the professionalism of the generated results and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-03-31
AI Technical Summary
Existing large language models rely on the quality of prompts from user input for task understanding and response, lacking flexibility and professionalism, resulting in low output quality. Furthermore, existing systems fail to effectively optimize the quality of user input and utilize feedback data, making it difficult to meet the high-quality and high-efficiency requirements of professional fields.
By retrieving and matching historical execution strategies from the experience knowledge base, semantic enhancement and instruction reconstruction of task request prompts are performed using reference records. Combined with a dual-path hybrid retrieval mechanism and feedback-driven knowledge accumulation, an efficient and reliable intelligent agent prompt optimization system is constructed.
It significantly improves the professionalism and feasibility of prompt words, reduces the risk of large models generating illusions, improves the accuracy and practicality of generated results, supports small models in completing complex tasks, and reduces resource waste and response latency.
Smart Images

Figure CN121766313A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and more specifically, to a method, apparatus, electronic device, and storage medium for optimizing task prompt words. Background Technology
[0002] With the rapid development of artificial intelligence technology, especially Large Language Models (LLMs), AI agents have demonstrated powerful capabilities in natural language understanding, task planning, tool invocation, and automated execution, and have been widely applied in various fields such as code generation, document writing, data analysis, and customer service. Users typically express their task requirements by inputting a "prompt word" in natural language, and the AI system then generates a corresponding response based on that prompt word.
[0003] However, in practical applications, it has been found that the output quality of large language models is highly dependent on the quality of the input prompts. Ideal prompts should possess clear task objectives, complete contextual information, a reasonable format structure, and necessary constraints. However, most ordinary users lack professional prompting engineering knowledge, and their input prompts often suffer from problems such as vague expression, missing information, and unclear intent.
[0004] To improve the quality of prompts, current practices involve using fixed system-level prompt templates and concatenating preset instructions with user input to guide model behavior. However, this approach lacks flexibility, cannot dynamically adjust optimization strategies based on different task types, and has limited support for complex or highly specialized requests. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a method, apparatus, electronic device and storage medium for optimizing task prompt words.
[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, the present invention provides a method for optimizing task prompt words, the method comprising: Based on the task request prompt words input by the user, the system retrieves matching historical execution strategies from the experience knowledge base to obtain at least one reference record. The experience knowledge base stores verified task processing schemes and scheme metadata. The task request prompt is semantically enhanced and the instruction is reconstructed using the reference record to obtain the adjusted task request prompt.
[0007] Optionally, the step of retrieving matching historical execution strategies from the experience knowledge base based on user-inputted task request prompts to obtain at least one reference record includes: The task request prompt is converted into a task vector, and a first reference record is determined from each practice record in the experience knowledge base based on the task vector; Keyword extraction is performed on the task request prompts, and a second reference record is determined from each practice record in the experience knowledge base based on the extracted keywords; The first reference record and the second reference record are merged and sorted to determine the reference record.
[0008] Optionally, the step of determining the first reference record from each practice record in the experience knowledge base based on the task vector includes: Calculate the semantic similarity between the task vector and each of the practice records; Practice records with semantic similarity greater than a first preset threshold are used as the first reference records.
[0009] Optionally, the step of determining the second reference record from the practice records in the experience knowledge base based on the extracted keywords includes: The practice records containing the extracted keywords will be used as the second reference records.
[0010] Optionally, the step of semantically enhancing and reconstructing the task request prompt using the reference record includes: Extract at least one of the following from the reference record: task objective description, execution procedure specifications, tool invocation method, and error prevention measures; The extracted content is integrated into the task request prompt to obtain the adjusted task request prompt.
[0011] Optionally, the method further includes: The adjusted task request prompt is provided to the artificial intelligence model, and the response result generated by the artificial intelligence model is returned to the user; Collect user feedback on the response results, and package the feedback information, the task request prompt, the adjusted task request prompt, and the response results into a feedback record; Cluster analysis is performed on all currently accumulated feedback records to generate practice records that can be written into the aforementioned experience knowledge base.
[0012] Optionally, the step of performing cluster analysis on all currently accumulated feedback records to generate practice records that can be written into the experience knowledge base includes: Statistically analyze the proportion of positive feedback in feedback records for the same type of task; If the ratio is greater than the second preset threshold and the feedback records corresponding to the same type of task have a consistent task processing path, then a practice record that can be written into the experience knowledge base is generated based on the feedback records corresponding to the same type of task.
[0013] Secondly, the present invention provides a task prompt word optimization device, the device comprising: The acquisition module is used to retrieve matching historical execution strategies from the most recently updated experience knowledge base based on the task request prompt words input by the user, and obtain at least one reference record, wherein the experience knowledge base stores verified task processing schemes and scheme metadata; The adjustment module is used to perform semantic enhancement and instruction reconstruction on the task request prompt using the reference record, so as to obtain the adjusted task request prompt.
[0014] Thirdly, the present invention provides an electronic device including a processor and a memory, the memory storing machine-executable instructions executable by the processor, the processor executing the machine-executable instructions to implement the task prompt word optimization method described in the first aspect above.
[0015] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the task prompt word optimization method as described in the first aspect above.
[0016] The task prompt word optimization method, apparatus, electronic device, and storage medium provided in this invention retrieve matching historical execution strategies from an experience knowledge base based on user-input task request prompt words to obtain at least one reference record. The experience knowledge base stores verified task processing schemes and scheme metadata. The reference record is used to semantically enhance and reconstruct the instructions for the task request prompt words, resulting in adjusted task request prompt words. Because this invention retrieves matching historical execution strategies from an experience knowledge base based on user-input task request prompt words, it fully utilizes the stored verified task processing schemes and their metadata, achieving accurate intent recognition of ambiguous or incomplete user instructions. Furthermore, the retrieved reference record is used to semantically enhance and reconstruct the instructions for the original prompt words, effectively supplementing key information such as task objectives, execution steps, tool calls, and error prevention, significantly improving the professionalism, completeness, and executability of the prompt words. This process not only significantly reduces the risk of large models generating illusions and improves the accuracy and practicality of the generated results, but also reduces dependence on models with large parameter sets, enabling smaller models to complete complex tasks. It combines performance optimization and cost savings, significantly improving the overall task execution quality and user experience of the intelligent agent.
[0017] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This figure shows a schematic block diagram of an electronic device provided by an embodiment of the present invention; Figure 2 This illustration shows a flowchart of a task prompt word optimization method provided by an embodiment of the present invention. Figure 1 ; Figure 3 This illustration shows a flowchart of a task prompt word optimization method provided by an embodiment of the present invention. Figure 2 ; Figure 4 The diagram shows a functional block diagram of a task prompt word optimization device provided in an embodiment of the present invention.
[0020] Icons: 100 - Electronic device; 110 - Memory; 120 - Processor; 130 - Communication module; 200 - Task prompt word optimization device; 201 - Acquisition module; 202 - Adjustment module. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0022] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0023] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0024] Against the backdrop of rapid development in artificial intelligence technology, AI agents, as intelligent systems capable of autonomously perceiving, understanding, planning, and executing tasks, have been widely applied in various fields such as code generation, technical consulting, automated operation and maintenance, and intelligent customer service. However, current mainstream AI agent systems still face many key technical bottlenecks in practical applications, severely restricting their usability and reliability in professional scenarios.
[0025] Existing AI agents primarily rely on the parameterized knowledge of Large Language Models (LLMs) for task understanding and response. These systems typically use fixed system prompt templates and process user requests through the general reasoning capabilities of pre-trained models. For example, when receiving a vague instruction like "Write me a web crawler," the system can only generalize based on the knowledge already learned within the model, lacking a deep understanding of the specific task context, industry standards, or best practices. This approach, which relies entirely on the model's "internal strength," has significant limitations: on the one hand, small-parameter models perform poorly in complex tasks or vertical domains due to their limited knowledge capacity; on the other hand, even for large-scale models, it is difficult to ensure the professionalism and accuracy of the output, especially in technical tasks requiring precise configuration and adherence to specific procedures.
[0026] To address these shortcomings, some existing systems have introduced retrieval-enhanced generation techniques, attempting to obtain supplementary information from external knowledge bases. A typical implementation involves segmenting static documents (such as API manuals and technical white papers) into text fragments, constructing vector indexes, using semantic similarity matching mechanisms to retrieve relevant content, and then injecting this as context into the input of a large model to improve response quality. While this method alleviates the knowledge gap problem to some extent, it still has significant drawbacks: First, existing RAG technologies primarily focus on retrieving static knowledge fragments rather than providing task-level execution solutions. The retrieved content is often fragmented factual statements or definitions, failing to constitute a complete operational process or methodological guidance. For example, in development tasks, users not only need to know the function of a certain API, but also need to understand the complete practical path, such as the call order, exception handling strategies, and performance optimization suggestions. These key elements cannot be effectively organized and presented in traditional RAG systems.
[0027] Secondly, existing systems generally lack prompt optimization mechanisms, failing to proactively improve the quality of users' raw input. In practice, most end-users lack professional prompt engineering capabilities, and the questions they submit are often vaguely worded and incomplete, forcing the model to rely on guesswork to infer intent, greatly increasing the risk of misjudgment and illusion. The existing architecture does not rewrite, complete, or structure prompts at the front end, missing a crucial opportunity to improve output quality.
[0028] Furthermore, user feedback data in existing systems is only used for post-event statistical analysis and has not yet formed a closed-loop learning mechanism. Although some platforms provide "like / dislike" functions to collect human feedback, these valuable evaluation signals have not been systematically transformed into reusable knowledge assets. Feedback data is usually stored in isolation, lacking a complete connection with the original task context, and cannot drive the automatic updating and iteration of the knowledge base, resulting in the system's inability to achieve the self-evolutionary capability of "getting better with use."
[0029] Finally, due to the lack of efficient caching and scheduling mechanisms, the existing system has a high response latency, especially in multi-turn dialogue scenarios with frequent interactions. Repeatedly executing the same retrieval and optimization process wastes resources and affects the user experience.
[0030] In summary, existing technologies have significant shortcomings in terms of knowledge organization granularity, prompt word optimization capabilities, feedback utilization efficiency, and system performance optimization, making it difficult to meet the demands of professional fields for high-quality, high-efficiency, and sustainably evolving intelligent agent services. Therefore, this invention provides a task prompt word optimization method, apparatus, electronic device, and storage medium, which will be described in detail below.
[0031] Please refer to Figure 1 This is a block diagram of an electronic device 100. The electronic device 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, processor 120, and communication module 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0032] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0033] The processor 120 is used to read / write data or programs stored in the memory 110 and to perform corresponding functions.
[0034] The communication module 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through the network, and to send and receive data through the network.
[0035] It should be understood that, Figure 1 The structure shown is only a schematic diagram of the electronic device 100. The electronic device 100 may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0036] Please refer to Figure 2 The task prompt word optimization method provided in this embodiment of the invention includes steps S101 to S102.
[0037] S101, based on the task request prompt words input by the user, retrieve matching historical execution strategies from the experience knowledge base to obtain at least one reference record.
[0038] The experience knowledge base stores verified task processing solutions and solution metadata.
[0039] In this embodiment of the invention, the "experience knowledge base" is a structured best practice repository that stores task-level best practice records that have been manually verified or systematically refined and validated. Each best practice record includes, but is not limited to, the following metadata: task vector, best practice text, execution step specifications, tool invocation method, error prevention measures, applicable scenario tags, confidence level, etc. This knowledge base is built using a RAG architecture, supporting real-time retrieval and incremental writing to ensure the freshness and practicality of the knowledge.
[0040] To improve retrieval accuracy and recall, this embodiment of the invention adopts a dual-path hybrid retrieval mechanism, combining the advantages of semantic similarity and keyword matching to avoid the problems of missed or false detections in a single mode.
[0041] In a possible implementation, step S101 may include sub-steps S101-1 to S101-3.
[0042] S101-1, convert the task request prompt into a task vector, and determine the first reference record from each practice record in the experience knowledge base based on the task vector.
[0043] In this embodiment of the invention, the semantic similarity between the task vector and each practice record can be calculated; practice records with a semantic similarity greater than a first preset threshold can be used as first reference records.
[0044] When a user enters a prompt for a task request (such as "help me write a web crawler"), it is first encoded into a task vector in a high-dimensional space using a pre-trained embedding model. Then, the vector similarity between this task vector and the task vectors corresponding to each practice record in the experience knowledge base is calculated using vector indexing (e.g., using cosine similarity measurement).
[0045] Set a first preset threshold (e.g., 0.75), and filter out all practice records with a similarity greater than this threshold as the first reference record set. These records represent past success cases that are highly relevant to the current task at the semantic level, and can effectively capture the user's potential intent, even if their expression is incomplete or contains terminological biases.
[0046] For example, even if a user only says "write a web crawler", vector matching can be used to identify that it has a high semantic relevance to historical practice records such as "Python Web Crawler Design Guidelines" and "Scrapy Framework Usage Specifications", thereby extracting the corresponding best practice fragments.
[0047] S101-2, extract keywords from the task request prompts, and determine the second reference record from each practice record in the experience knowledge base based on the extracted keywords.
[0048] In this embodiment of the invention, practice records containing extracted keywords can be used as a second reference record.
[0049] To further enhance domain sensitivity and key element coverage, keyword extraction is performed simultaneously. Natural language processing is applied to the original prompts to identify technical terms, verb phrases, and entity nouns (such as "crawler," "login," "anti-crawler," "XPath parsing," etc.), forming a keyword set.
[0050] Then, the keyword inverted index (II) is queried to quickly locate practice records containing one or more of the above keywords, forming a second reference record set. This path is suitable for task scenarios that require precise matching of specific technical components, API names, or industry terms, making up for key details that pure semantic matching may miss.
[0051] S101-3, merge and sort the first reference record and the second reference record to determine the reference record.
[0052] The two candidate record sets from S101-1 and S101-2 are merged and deduplicated, and then reordered according to a comprehensive scoring function. The scoring function can comprehensively consider the following factors: vector similarity score; number and weight of keyword matches; confidence of the original practice record; and frequency of recent calls (i.e., popularity factor).
[0053] Finally, the top-K records (e.g., K=3) are selected as the reference records for this optimization, for use in subsequent prompt word reconstruction.
[0054] The dual-path retrieval mechanism of this invention can improve retrieval accuracy, especially in vertical domain tasks, and solves the problem that traditional single-modal retrieval is easily affected by noise interference or semantic drift.
[0055] S102, using the reference record, semantic enhancement and instruction reconstruction are performed on the task request prompt, resulting in the adjusted task request prompt.
[0056] Based on obtaining high-quality reference records, this embodiment of the invention initiates a prompt word optimization process, aiming to transform the user's original vague and unstructured requests into clear, professional, and executable guidance instructions.
[0057] In a possible implementation, step S102 may include sub-steps S102-1 to S102-2.
[0058] S102-1, extract at least one of the following from the reference record: task objective description, execution procedure specifications, tool invocation method, and error prevention measures.
[0059] By analyzing each reference record, key elements that facilitate task execution are extracted, including but not limited to: task objective description (i.e., clearly defining the expected output, such as "generating a runnable Python script"), execution step specifications (i.e., step-by-step logic, such as "first check robots.txt → set User-Agent → process Cookies"), tool invocation methods (i.e., recommended libraries or APIs, such as "it is recommended to use requests.Session() to manage sessions"), and error prevention measures (i.e., common exceptions and coping strategies, such as "adding timeout control and retry mechanism" and "capturing HTTP 403 status code").
[0060] S102-2, The extracted content is integrated into the task request prompt to obtain the adjusted task request prompt.
[0061] By employing a template-based approach combined with dynamic filling, the extracted content is organically integrated into the original user input, achieving a surgical rewriting of the prompts. The rewriting process follows these principles: preserving the user's original semantic intent, supplementing missing professional context, strengthening the structured expression of instructions (such as listing steps using Markdown format), and avoiding the injection of redundant information to prevent prompt bloat.
[0062] For example, the original prompt "Help me write a web crawler" is optimized to: "Please write a robust web crawler program using Python, with the following requirements:" 1. Implement using the requests or Scrapy framework; 2. Respect the website's robots.txt protocol; 3. Set appropriate request headers (User-Agent, Accept-Language); 4. Includes exception handling mechanisms (network timeout, HTTP 403 / 500 response); 5. Supports automatic retry function; 6. Data parsing should preferably use lxml or Beautiful Soup.
[0063] The optimized prompts are not only more specific and actionable, but also significantly reduce the likelihood of large models producing illusions, thus improving the professionalism and reliability of the output results.
[0064] Further, please refer to Figure 3 The task prompt word optimization method provided in this embodiment of the invention also includes steps S103 to S105.
[0065] S103, the adjusted task request prompt is provided to the artificial intelligence model, and the response result generated by the artificial intelligence model is returned to the user.
[0066] After optimization, the adjusted prompts are forwarded to the backend large model API (such as a locally deployed 106B parameter model or a cloud-based LLM service) to trigger inference generation. The generated results, after format validation and security filtering, are then displayed to the user by the agent client.
[0067] It is worth noting that the present invention employs a delay optimization strategy to execute the complete search and suggestion optimization process only when the user makes their first request; for subsequent rounds of dialogue, a session caching mechanism is enabled to directly reuse the loaded best practice context, avoid redundant calculations, significantly reduce system latency, and improve the smoothness of interaction.
[0068] S104, collect user feedback information on the response result, and package the feedback information, the task request prompt, the adjusted task request prompt, and the response result into a feedback record.
[0069] After viewing the AI-generated results, users can express their satisfaction by clicking "like" or "dislike". The following complete context is packaged into a feedback record: the original task request prompt, the adjusted optimization prompt, the AI-generated response result, the user feedback type (positive / negative), the current session ID and timestamp, and the identifier of the relevant practice record.
[0070] This mechanism ensures that every interaction becomes the data foundation for the system's learning, providing real-world behavioral signals for the continuous evolution of the knowledge base.
[0071] S105, perform cluster analysis on all currently accumulated feedback records to generate practice records that can be written into the experience knowledge base.
[0072] Regularly perform offline batch processing on accumulated feedback records to execute knowledge extraction tasks and promote the self-growth of the experience knowledge base.
[0073] In a possible implementation, step S105 may include sub-steps S105-1 to S105-2.
[0074] S105-1, Calculate the proportion of positive feedback in the feedback records for the same type of task.
[0075] Feedback records are clustered based on task vectors and categorized into similar task clusters (such as "web crawler development", "API debugging", "SQL injection detection", etc.). For each task cluster, the percentage of feedback records that received "likes" is calculated and recorded as the positive feedback ratio.
[0076] S105-2, If the proportion is greater than the second preset threshold and the feedback records corresponding to the same type of task have a consistent task processing path, then based on the feedback records corresponding to the same type of task, a practice record that can be written into the experience knowledge base is generated.
[0077] If the two conditions are met, namely, "the proportion of positive feedback exceeds the second preset threshold (e.g., 80%)" and "the task processing paths in the corresponding feedback records are consistent (e.g., most successful cases use the same toolchain and exception handling logic)," a structured candidate practice record will be extracted from all feedback records, marked with an initial confidence level (e.g., 85%), and submitted to the knowledge management layer for review.
[0078] Technical staff can review, modify, or reject the proposal in the background. Once approved, the candidate practice record is officially entered into the database, becoming a new knowledge source for future task optimization.
[0079] In summary, this invention constructs an efficient, reliable, and sustainably evolving intelligent agent prompt optimization system through multi-level retrieval, precise prompt word reconstruction, and feedback-driven knowledge accumulation. Compared to existing technologies, this solution significantly reduces the illusion rate, improves the success rate of complex tasks, and supports near-large model performance on models with a smaller number of parameters, demonstrating outstanding technological advancement and broad application prospects.
[0080] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of the task prompt word optimization device 200 is given below. Further, please refer to... Figure 4 , Figure 4 This is a functional block diagram of a task prompt word optimization device 200 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the task prompt word optimization device 200 provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The task prompt word optimization device 200 includes: The module 201 is used to retrieve matching historical execution strategies from the most recently updated experience knowledge base based on the task request prompt words input by the user, and obtain at least one reference record, wherein the experience knowledge base stores verified task processing schemes and scheme metadata.
[0081] The adjustment module 202 is used to perform semantic enhancement and instruction reconstruction on the task request prompt using reference records to obtain the adjusted task request prompt.
[0082] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory 110 shown is either stored in or embedded in the operating system (OS) of the electronic device 100, and can be used by... Figure 1 The processor 120 in the memory executes the commands. Meanwhile, the data and program code required to execute the above modules can be stored in memory.
[0083] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0084] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0085] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, electronic device 100, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0086] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for optimizing task prompt words, characterized in that, The method includes: Based on the task request prompt words input by the user, the system retrieves matching historical execution strategies from the experience knowledge base to obtain at least one reference record. The experience knowledge base stores verified task processing schemes and scheme metadata. The task request prompt is semantically enhanced and the instruction is reconstructed using the reference record to obtain the adjusted task request prompt.
2. The task prompt word optimization method as described in claim 1, characterized in that, The step of retrieving matching historical execution strategies from the experience knowledge base based on user-input task request prompts to obtain at least one reference record includes: The task request prompt is converted into a task vector, and a first reference record is determined from each practice record in the experience knowledge base based on the task vector; Keyword extraction is performed on the task request prompts, and a second reference record is determined from each practice record in the experience knowledge base based on the extracted keywords; The first reference record and the second reference record are merged and sorted to determine the reference record.
3. The task prompt word optimization method as described in claim 2, characterized in that, The step of determining the first reference record from each practice record in the experience knowledge base based on the task vector includes: Calculate the semantic similarity between the task vector and each of the practice records; Practice records with semantic similarity greater than a first preset threshold are used as the first reference records.
4. The task prompt word optimization method as described in claim 2, characterized in that, The step of determining the second reference record from the practice records in the experience knowledge base based on extracted keywords includes: The practice records containing the extracted keywords will be used as the second reference records.
5. The task prompt word optimization method as described in claim 1, characterized in that, The step of semantically enhancing and reconstructing the task request prompt using the reference record includes: Extract at least one of the following from the reference record: task objective description, execution procedure specifications, tool invocation method, and error prevention measures; The extracted content is integrated into the task request prompt to obtain the adjusted task request prompt.
6. The task prompt word optimization method as described in claim 1, characterized in that, The method further includes: The adjusted task request prompt is provided to the artificial intelligence model, and the response result generated by the artificial intelligence model is returned to the user; Collect user feedback on the response results, and package the feedback information, the task request prompt, the adjusted task request prompt, and the response results into a feedback record; Cluster analysis is performed on all currently accumulated feedback records to generate practice records that can be written into the aforementioned experience knowledge base.
7. The task prompt word optimization method as described in claim 6, characterized in that, The step of performing cluster analysis on all currently accumulated feedback records to generate practice records that can be written into the experience knowledge base includes: Statistically analyze the proportion of positive feedback in feedback records for the same type of task; If the ratio is greater than the second preset threshold and the feedback records corresponding to the same type of task have a consistent task processing path, then a practice record that can be written into the experience knowledge base is generated based on the feedback records corresponding to the same type of task.
8. A task prompt word optimization device, characterized in that, The device includes: The acquisition module is used to retrieve matching historical execution strategies from the most recently updated experience knowledge base based on the task request prompt words input by the user, and obtain at least one reference record, wherein the experience knowledge base stores verified task processing schemes and scheme metadata; The adjustment module is used to perform semantic enhancement and instruction reconstruction on the task request prompt using the reference record, so as to obtain the adjusted task request prompt.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the task prompt word optimization method according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the task prompt word optimization method as described in any one of claims 1-7.