Query request processing method and device, computer equipment and readable storage medium
By converting query instruction text into vectors and finding candidate function vectors in the function vector database, and then using large-scale language models to generate feedback results, the problem of inaccurate response results of AI tools is solved, and the accuracy and scalability of the results are improved.
Patent Information
- Application Number
- CN202411703426.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-07
AI Technical Summary
When existing AI tools handle query requests, the accuracy of the reply results is not high, it is difficult to deal with a large number of plug-ins and there are problems of inaccurate matching.
By converting the query instruction text into a query instruction vector, the candidate function vector is found in the preset function vector database, and the large-scale language model is used to generate the objective function call results, thereby generating feedback results.
It improves the accuracy of feedback results of AI tools, breaks the limitations of the context window of large-scale language model, allows dynamic addition and management of a large number of function plug-ins, and improves the scalability of AI tools.
Smart Images

Figure CN119576981A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a query request processing method, apparatus, computer equipment and readable storage medium. Background Art
[0002] Artificial Intelligence (AI) is an important driving force for the new round of scientific and technological revolution and industrial transformation. It is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI tools can interact with users in natural language, understand users' needs and problems, and provide corresponding information, perform tasks or generate solutions accordingly.
[0003] However, the AI tools in related technologies still have the problem of low accuracy in response results in practical applications. Summary of the invention
[0004] Based on this, it is necessary to provide a query request processing method, device, computer equipment and readable storage medium that can improve the accuracy of AI tool response results in response to the above technical problems.
[0005] In a first aspect, the present application provides a query request processing method, the method comprising:
[0006] When receiving the query instruction text, convert the query instruction text into a query instruction vector;
[0007] Searching for a candidate function vector in a preset function vector database according to the query instruction vector;
[0008] When a candidate function vector is found, a target function call result is generated according to the query instruction text, the candidate function vector and a preset large-scale language model, wherein the target function call result includes a function call flag;
[0009] When the function call flag indicates that the target function is queried, a feedback result is generated according to the target function call result and the query instruction text.
[0010] In one embodiment, searching for a candidate function vector in a preset function vector database according to the query instruction vector includes:
[0011] In a preset function vector database, according to the query instruction vector, searching for a preset number of pre-candidate function vectors, wherein the similarity between the pre-candidate function vector and the query instruction vector is greater than the similarity between the remaining function vectors in the function vector database and the query instruction vector;
[0012] According to a preset similarity threshold, a candidate function vector is determined from the plurality of pre-candidate function vectors.
[0013] In one embodiment, generating a target function call result according to the query instruction text, the candidate function vector and a preset large-scale language model includes:
[0014] Generate a function query template according to the query instruction text, the candidate function vector and a preset blank query template;
[0015] The function query template is input into the large-scale language model to obtain a target function call result.
[0016] In one embodiment, the target function call result also includes the target function name and target function parameters; and generating the feedback result according to the target function call result and the query instruction text includes:
[0017] According to the target function name, searching for the target function plug-in from a preset function plug-in library;
[0018] Extracting keywords from the query instruction text according to the target function parameters;
[0019] Generate feedback results based on the keywords and the objective function plug-in.
[0020] In one embodiment, the method further comprises:
[0021] When no candidate function vector is found, a feedback result is generated according to the query instruction text and a preset large-scale language model.
[0022] In one embodiment, the method further comprises:
[0023] When the function call flag indicates that the target function is not found, a feedback result is generated according to the query instruction text and a preset large-scale language model.
[0024] In a second aspect, the present application provides a query request processing device, the device comprising:
[0025] A first conversion module, configured to convert the query instruction text into a query instruction vector when receiving the query instruction text;
[0026] A first search module searches for a candidate function vector in a preset function vector database according to the query instruction vector;
[0027] A first execution module, configured to generate a target function call result according to the query instruction text, the candidate function vector and a preset large-scale language model when a candidate function vector is found, wherein the target function call result includes a function call flag;
[0028] The second execution module is used to generate a feedback result according to the target function call result and the query instruction text when the function call flag indicates that the target function is queried.
[0029] In a third aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the query request processing method described in any one of the above embodiments are implemented.
[0030] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the query request processing method described in any one of the above embodiments are implemented.
[0031] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the query request processing method described in any of the above embodiments.
[0032] The query request processing method, device, computer device and readable storage medium mentioned above, in the case of query instruction text, convert the query instruction text into a query instruction vector, search for candidate function vectors in a preset function vector database according to the query instruction vector, and screen one or more candidate function vectors with high similarity to the query instruction vector from the massive function vectors stored in the function vector database, so as to preliminarily ensure the accuracy of the function plug-in called subsequently and the accuracy of the feedback result generated for the query instruction text. After that, the candidate function vector and the query instruction text are input into the preset large-scale language model to obtain the target function call result, and the query instruction text is analyzed by the large-scale language model, so as to further select the most accurate function vector from each candidate function vector, further ensure the accuracy of the function plug-in called and the accuracy of the feedback result generated for the query instruction text. In addition, the present application can break the limitation of the context window of the large-scale language model by first searching for candidate function vectors with high similarity to the query instruction vector in the function vector database, and then using the large-scale language model to screen the candidate function vectors, so as to allow the dynamic addition and management of a large number of function plug-ins, improve the scalability of the AI tool, and further improve the accuracy of the feedback result of the AI tool. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 A flowchart of a query request processing method in one embodiment;
[0035] Figure 2 is a flow chart of step S102 in one embodiment;
[0036] Figure 3 is a flow chart of step S103 in one embodiment;
[0037] Figure 4 is a flow chart of step S104 in one embodiment;
[0038] Figure 5 is a structural block diagram of a query request processing device in one embodiment;
[0039] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] As described in the background technology section, AI assistants in related technologies usually rely on a fixed set of plug-ins and predefined function calls when processing query requests input by users, and are subject to the context window limitations of large-scale language models. It is difficult for AI assistants to handle a large number of plug-ins and difficult to expand flexibly. Moreover, AI assistants only select appropriate plug-ins through keyword matching or simple rules, which is prone to inaccurate matching problems. As a result, when processing complex query requests, performance bottlenecks are prone to occur, affecting user experience.
[0042] To solve the above technical problem, in an exemplary embodiment, please refer to Figure 1 The present application provides a query request processing method, which includes steps S101 to S104.
[0043] S101: When a query instruction text is received, convert the query instruction text into a query instruction vector.
[0044] In this embodiment, when the user inputs a query command text to the AI assistant, the control end of the AI assistant can use the pre-trained Embedding model m3e-base to convert the query command text into a query command vector. Embedding is a technology that converts high-dimensional sparse data (such as text) into low-dimensional dense vectors. Through Embedding, text data can be converted into vectors of fixed length, which can be operated in the vector space, such as calculating similarity. Furthermore, the control end can call the appropriate function plug-in based on the query command vector. In one example, the user can also input a query command voice to the AI assistant, and the control end of the AI assistant can first convert the query command voice into a query command text, and then convert the query command text into a query command vector.
[0045] S102: searching for candidate function vectors in a preset function vector database according to the query instruction vector.
[0046] It can be understood that after the query instruction text is converted into a query instruction vector, the control end can call the pre-built Faiss (Facebook AI Similarity Search) vector search service, search the function vector database in the Faiss vector search service for a function vector that is highly similar to the query instruction vector, and mark it as a candidate function vector.
[0047] S103: When a candidate function vector is found, a target function call result is generated according to the query instruction text, the candidate function vector and a preset large-scale language model, wherein the target function call result includes a function call flag.
[0048] A large-scale language model is a model that can learn language structure and semantics from a large amount of text data through deep learning technology. In the application, one or more candidate function vectors with high similarity may be found. Therefore, the control end needs to input the query instruction text and the candidate function vector into the preset large-scale language model, and the large-scale language model determines the final target function call result from multiple candidate function vectors based on the query instruction text.
[0049] S104: When the function call flag indicates that the target function has been queried, a feedback result is generated according to the target function call result and the query instruction text.
[0050] The target function call result includes a function call flag call_function, which is used to indicate whether the function needs to be called. If the function call flag call_function is that the target function is queried, that is, the function needs to be called, the target function call result also includes the target function name name and the target function parameters arguments to be called. Then, the control end can find the target function plug-in from the function plug-in set according to the target function name name, parse the keywords required for the target function parameters arguments from the query instruction text, and pass them to the target function plug-in, so that the user can obtain the generation feedback result.
[0051] In the above-mentioned query request processing method, in the case of a query instruction text, the query instruction text is converted into a query instruction vector, and a candidate function vector is searched in a preset function vector database according to the query instruction vector. By screening one or more candidate function vectors with high similarity to the query instruction vector from the massive function vectors stored in the function vector database, the accuracy of the function plug-in called subsequently and the accuracy of the feedback result generated for the query instruction text can be preliminarily guaranteed. After that, the candidate function vector and the query instruction text are input into a preset large-scale language model to obtain the target function call result. The query instruction text is analyzed by the large-scale language model, and the most accurate function vector can be further selected from each candidate function vector, further ensuring the accuracy of the function plug-in called and the accuracy of the feedback result generated for the query instruction text. In addition, the present application can break the limitation of the context window of the large-scale language model by first searching for candidate function vectors with high similarity to the query instruction vector in the function vector database, and then using the large-scale language model to screen the candidate function vectors, allowing a large number of function plug-ins to be dynamically added and managed, improving the scalability of the AI tool, and further improving the accuracy of the feedback result of the AI tool.
[0052] In an exemplary embodiment, see Figure 2 , step S102, searching for candidate function vectors in a preset function vector database according to the query instruction vector, including step S201 and step S202.
[0053] S201: searching a preset number of pre-candidate function vectors in a preset function vector database according to a query instruction vector, wherein the similarity between the pre-candidate function vectors and the query instruction vector is greater than the similarity between the remaining function vectors in the function vector database and the query instruction vector.
[0054] Specifically, the similarity between the query instruction vector and each function vector in the function vector database may be calculated. Exemplarily, the preset number may be three, that is, the first three function vectors with the highest similarity to the query instruction vector may be determined as pre-candidate function vectors.
[0055] S202: Determine a candidate function vector from a plurality of pre-candidate function vectors according to a preset similarity threshold.
[0056] After determining a preset number of pre-candidate function vectors, it is necessary to further determine whether the selected pre-candidate function vectors are accurate. Therefore, a preset similarity threshold can be set to determine the pre-candidate function vectors whose similarity with the query instruction vector exceeds the preset similarity threshold as candidate function vectors.
[0057] In an exemplary embodiment, see Figure 3 , step S103, generating a target function call result according to the query instruction text, the candidate function vector and the preset large-scale language model, including step S301 and step S302.
[0058] S301: Generate a function query template according to a query instruction text, a candidate function vector and a preset blank query template.
[0059] It is understandable that the control end can prepare a blank query template in a standard format in advance, and embed the query instruction text and the candidate function vector into the blank query template so that the large-scale language model can accurately understand and process it. In addition, the blank query template can also specify output format requirements to ensure that the results generated by the large-scale language model meet expectations. For example, the blank query template can instruct the large-scale language model to output the target function call results in JSON format.
[0060] S302: Input the function query template into the large-scale language model to obtain the target function call result.
[0061] In the application, before the function query template is input into the large-scale language model, the large-scale language model needs to be initialized, such as initializing the large-scale language model using the specified API and model, selecting the appropriate model and parameter settings (such as temperature parameters) to optimize the accuracy and consistency of the generated results; and defining the response mode of the large-scale language model, the response mode contains detailed information of the target function call. Exemplarily, the response mode includes the following fields: function call flag call_function: Boolean type, indicating whether the function needs to be called, target function name name: string type, if the function needs to be called, it contains the name of the function, target function parameters arguments: dictionary type, if the function needs to be called, it contains the parameters of the function and their values, and the parameter name and parameter value are stored in the dictionary as key-value pairs.
[0062] After initializing the large-scale language model and defining the response mode of the large-scale language model, when the query instruction text and the candidate function vector are embedded in the blank query template, the function query template is obtained, and the function query template is input into the large-scale language model to obtain the target function call result including the function call flag call_function, the target function name name and the target function parameters arguments.
[0063] In an exemplary embodiment, see Figure 4 , step S104, generating feedback results according to the target function call result and the query instruction text, including steps S401 to S403.
[0064] S401: searching for a target function plug-in from a preset function plug-in library according to the target function name.
[0065] When the large-scale language model outputs the target function call result, and the target function call result indicates that the target function needs to be called, the global namespace dictionary (globals()) can be used to obtain the corresponding plug-in function reference, and the corresponding function object can be found in the global namespace by the target function name, and the target function plug-in can be found from the preset function plug-in library.
[0066] S402: extracting keywords from the query instruction text according to the target function parameters.
[0067] Next, if the target function requires parameters, the keywords in the query instruction text are extracted, and the parsed keywords are passed to the target function plug-in in the form of parameters.
[0068] S403: Generate feedback results based on the keywords and the target function plug-in.
[0069] After that, the objective function plug-in can execute the corresponding plug-in function, generate feedback results, and return the feedback results to the user.
[0070] In an exemplary embodiment, the query request processing method further includes the step of generating a feedback result based on the query instruction text and a preset large-scale language model when no candidate function vector is found.
[0071] In the application, there may be a situation where the similarity of all or part of the pre-candidate function vectors is greater than or equal to the preset similarity threshold, or there may be a situation where the similarity of all pre-candidate function vectors is less than the preset similarity threshold. If the similarity of all pre-candidate function vectors is less than the preset similarity threshold, that is, no candidate function vector is found, the query instruction text can be directly input into the large-scale language model, and the large-scale language model directly generates feedback results.
[0072] In an exemplary embodiment, the query request processing method further includes the step of generating a feedback result according to the query instruction text and a preset large-scale language model when the function call flag indicates that the target function has not been queried.
[0073] It can be understood that if the large-scale language model determines that all candidate function vectors cannot match the query instruction text, the output function call flag is that the target function is not found, which means that there is no need to call the function plug-in. The query instruction text can be directly input into the large-scale language model, and the large-scale language model directly generates feedback results.
[0074] In an exemplary embodiment, before receiving the input query instruction text, the query request processing method of the present application also includes the step of building a Faiss vector search service.
[0075] For example, the package management tool (pip) can be used to install the Faiss library and other dependent libraries (such as FastAPI, uvicorn, HuggingFace Transformers, etc.), create a project directory and file structure, configure an environment variable file to store paths and other configuration information, and configure a logger for debugging and monitoring. Secondly, load a pre-trained embedding model (such as m3e-base), configure model parameters (such as devices, standardization options, etc.), define a function to load an existing function vector database from disk, the function vector database is stored in fields, and each field corresponds to an independent Faiss index. Then initialize the FastAPI application instance, configure the cross-origin resource sharing (CORS) middleware, define an upload interface for receiving and processing query instruction text uploaded by users, convert it into a vector representation, and update or create the corresponding Faiss index, define a search interface for receiving user queries, converting it into a vector representation, and searching for the three most similar results in the function vector database. Finally, uvicorn can be used to start the FastAPI application, listen to the specified port, and provide Faiss vector search service.
[0076] In the application, after building the Faiss vector search service, the query request processing method of the present application also includes the step of converting the entry function corresponding to the plug-in into a function call format and registering it in the Faiss vector search service.
[0077] Specifically, the entry function of each plug-in is described in a unified format to facilitate matching by the Faiss vector search service. For example, please refer to Table 1, which is a table of standard format for function plug-in description. By standardizing the function plug-in description format, the scalability and maintainability of the plug-in system can be ensured, while improving the accuracy and consistency of function plug-in calls.
[0078] Table 1 Function plugin description standard format
[0079]
[0080] After that, you can develop a plug-in to call the entry function and build a corpus of its function call descriptions, convert them into vector representations using the pre-trained Embedding model m3e-base, and insert these description vectors into the Faiss index.
[0081] In a detailed embodiment, when a user inputs a query instruction text to an AI assistant, the control end of the AI assistant can use a pre-trained Embedding model to convert the query instruction text into a query instruction vector, and then call the Faiss vector search service to search for candidate function vectors that have a high similarity with the query instruction vector and meet a preset similarity threshold from the function vector database. After that, the query instruction text and the candidate function vector are embedded in a blank query template to obtain a function query template and input it into a large-scale language model to obtain a target function call result including a function call flag call_function, a target function name name, and target function parameters arguments. If the target function call result indicates that the target function needs to be called, the corresponding function object can be searched in the global namespace through the target function name name, and the target function plug-in can be searched from the preset function plug-in library to extract keywords in the query instruction text, and the parsed keywords are passed to the target function plug-in in the form of parameters. Finally, the target function plug-in can execute the corresponding plug-in function, generate accurate feedback results, and return the feedback results to the user.
[0082] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0083] Based on the same inventive concept, the embodiment of the present application also provides a query request processing device for implementing the query request processing method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the one or more query request processing device embodiments provided below can refer to the limitations of the query request processing method above, and will not be repeated here.
[0084] In an exemplary embodiment, Figure 5 As shown, a query request processing device is provided, including a first conversion module 501, a first search module 502, a first execution module 503 and a second execution module 504.
[0085] The first conversion module 501 is used to convert the query instruction text into a query instruction vector when receiving the query instruction text.
[0086] The first search module 502 searches for candidate function vectors in a preset function vector database according to the query instruction vector.
[0087] The first execution module 503 is used to generate a target function call result according to the query instruction text, the candidate function vector and a preset large-scale language model when a candidate function vector is found, wherein the target function call result includes a function call flag.
[0088] The second execution module 504 is used to generate a feedback result according to the target function call result and the query instruction text when the function call flag indicates that the target function is queried.
[0089] In an exemplary embodiment, the first searching module includes a first searching submodule and a first determining submodule.
[0090] The first search submodule is used to search for a preset number of pre-candidate function vectors in a preset function vector database according to a query instruction vector, wherein the similarity between the pre-candidate function vectors and the query instruction vector is greater than the similarity between the remaining function vectors in the function vector database and the query instruction vector.
[0091] The first determination submodule is used to determine a candidate function vector from a plurality of pre-candidate function vectors according to a preset similarity threshold.
[0092] In an exemplary embodiment, the first execution module includes: a first execution submodule and a second execution submodule.
[0093] The first execution submodule is used to generate a function query template according to the query instruction text, the candidate function vector and the preset blank query template.
[0094] The second execution submodule is used to input the function query template into the large-scale language model to obtain the target function call result.
[0095] In an exemplary embodiment, the target function call result also includes the target function name and target function parameters; the second execution module includes: a second search submodule, a third execution submodule and a fourth execution submodule.
[0096] The second search submodule is used to search for the target function plug-in from the preset function plug-in library according to the target function name.
[0097] The third execution submodule is used to extract keywords in the query instruction text according to the target function parameters.
[0098] The fourth execution submodule is used to generate feedback results according to the keywords and the target function plug-in.
[0099] In an exemplary embodiment, the query request processing device further includes: a third execution module, which is used to generate a feedback result based on the query instruction text and a preset large-scale language model when no candidate function vector is found.
[0100] In an exemplary embodiment, the query request processing device further includes: a fourth execution module, which is used to generate a feedback result based on the query instruction text and a preset large-scale language model when the function call flag indicates that the target function has not been queried.
[0101] Each module in the query request processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0102] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the query request processing method described in any of the above embodiments when executing the computer program.
[0103] The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a query request processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0104] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0105] In an exemplary embodiment, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the query request processing method described in any of the above embodiments are implemented.
[0106] In an exemplary embodiment, the present application provides a computer program product, including a computer program, which implements the steps of the query request processing method described in any of the above embodiments when executed by a processor.
[0107] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0108] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0109] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0110] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A query request processing method, characterized in that: The method comprises: When receiving the query instruction text, convert the query instruction text into a query instruction vector; Searching for a candidate function vector in a preset function vector database according to the query instruction vector; When a candidate function vector is found, a target function call result is generated according to the query instruction text, the candidate function vector and a preset large-scale language model, wherein the target function call result includes a function call flag; When the function call flag indicates that the target function is queried, a feedback result is generated according to the target function call result and the query instruction text.
2. The query request processing method according to claim 1, characterized in that: The searching for a candidate function vector in a preset function vector database according to the query instruction vector includes: In a preset function vector database, according to the query instruction vector, searching for a preset number of pre-candidate function vectors, wherein the similarity between the pre-candidate function vector and the query instruction vector is greater than the similarity between the remaining function vectors in the function vector database and the query instruction vector; According to a preset similarity threshold, a candidate function vector is determined from the plurality of pre-candidate function vectors.
3. The query request processing method according to claim 1, characterized in that: The generating a target function call result according to the query instruction text, the candidate function vector and a preset large-scale language model includes: Generate a function query template according to the query instruction text, the candidate function vector and a preset blank query template; The function query template is input into the large-scale language model to obtain a target function call result.
4. The query request processing method according to claim 1, characterized in that: The target function call result also includes the target function name and target function parameters; the feedback result is generated according to the target function call result and the query instruction text, including: According to the target function name, searching for the target function plug-in from a preset function plug-in library; Extracting keywords from the query instruction text according to the target function parameters; Generate feedback results based on the keywords and the objective function plug-in.
5. The query request processing method according to claim 1, characterized in that: The method further comprises: When no candidate function vector is found, a feedback result is generated according to the query instruction text and a preset large-scale language model.
6. The query request processing method according to claim 1, characterized in that: The method further comprises: When the function call flag indicates that the target function is not found, a feedback result is generated according to the query instruction text and a preset large-scale language model.
7. A query request processing device, characterized in that: The device comprises: A first conversion module, configured to convert the query instruction text into a query instruction vector when receiving the query instruction text; A first search module searches for a candidate function vector in a preset function vector database according to the query instruction vector; A first execution module, configured to generate a target function call result according to the query instruction text, the candidate function vector and a preset large-scale language model when a candidate function vector is found, wherein the target function call result includes a function call flag; The second execution module is used to generate a feedback result according to the target function call result and the query instruction text when the function call flag indicates that the target function is queried.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Entity state perception-based query construction method, system and equipment and medium
CN120849677A