Scene problem reply method and device, equipment, storage medium and program product
Through the scenario problem reply method based on the preset vector library and interface parameters extraction model, the plug-in interface is directly called to generate answer results, which solves the problems of poor data security and low problem reply accuracy in the existing technology, and improves data security and reply accuracy.
Patent Information
- Application Number
- CN202411279689.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-31
AI Technical Summary
In the prior art, the problem response method based on the large language model has problems such as poor data security and low accuracy of problem responses, especially due to the user data sensitivity in enterprise documents and the high requirements of the AI Agent inference engine for function calls. This makes it difficult to guarantee data security and accuracy.
Using preset-based vector library and pre-trained interface parameters to extract the model, obtain the corresponding plug-in interface parameters through target scenario problems, and directly call the plug-in interface to generate answer results, avoiding user data training and tool selection inference planning, and improving data security Sex and reply accuracy.
The model is extracted through interface parameters without using user data for training, and directly calls the plug-in interface, which solves the problems of poor data security and low problem response accuracy, and improves the accuracy of data security and problem response accuracy.
Smart Images

Figure CN119226464A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a scenario question answering method, device, equipment, storage medium and program product. Background Art
[0002] Currently, there are two ways to intelligently answer questions for multi-scenario business queries:
[0003] 1) A question answering method based on a large language model. The method first inputs the target question, then vectorizes the target question to obtain a question vector, and then searches in a preset document vector database based on the question vector to obtain relevant documents matching the question vector. Finally, prompt information for the large language model is generated based on the relevant documents retrieved from the target question, and the prompt information is input into the large language model to obtain the answer corresponding to the target question.
[0004] 2) Use the AI Agent of the large model as the reasoning engine to determine which tools to choose based on the current scenario, and then decide the next action based on the information obtained after using the tool, and finally get the answer to the problem.
[0005] However, the answers obtained through the question answering method based on the large language model can be obtained by training the large model with a large number of enterprise documents, while the user data in the enterprise documents may be sensitive private data within the enterprise and cannot be directly obtained through large model training, resulting in poor data security. AI Agent applications need to use function calls to implement reasoning, which has high requirements for the model. It must have strong planning capabilities and support function calls. Currently, there are relatively few models that support function calls. At the same time, when there are too many tools and methods, the large model may not be able to select the best tool, and the accuracy of question and answer is low.
[0006] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0007] The main purpose of this application is to provide a scenario question answering method, device, equipment, storage medium and program product, aiming to solve the technical problems of poor data security and low accuracy of question answering in the prior art.
[0008] To achieve the above objectives, the present application proposes a scenario question answering method, the method comprising:
[0009] Get the target scenario problem;
[0010] Based on a preset vector library and a pre-trained interface parameter extraction model, corresponding plug-in interface parameters are obtained according to the target scenario problem;
[0011] According to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answering result.
[0012] In one embodiment, the step of acquiring corresponding plug-in interface parameters according to the target scenario problem based on a preset vector library and a pre-trained interface parameter extraction model includes:
[0013] Vectorize the target scenario problem to obtain a target scenario problem vector;
[0014] Based on a preset similarity algorithm, the target scenario question vector is matched with the standard question vector in the vector library to obtain a target standard question vector;
[0015] According to the target standard question vector, obtaining associated prompt information;
[0016] The target standard question vector and prompt information are input into the interface parameter extraction model to obtain the plug-in interface parameters.
[0017] In one embodiment, before the step of inputting the target standard question vector and the prompt information into the interface parameter extraction model to obtain the plug-in interface parameters, the step further includes:
[0018] Get scene information, scene standard issues, and plug-in interface definition data;
[0019] Generate the prompt information according to the scenario information, scenario standard questions and plug-in interface definition data;
[0020] The prompt information and scenario standard questions are input into a preset large language model for training to obtain the interface parameter extraction model.
[0021] In one embodiment, the step of matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm and obtaining the target standard question vector further includes:
[0022] Vectorizing the scene standard question to obtain the standard question vector;
[0023] The standard question vector is stored in the vector library, and the standard question vector is associated with the prompt information.
[0024] In one embodiment, the step of matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm to obtain the target standard question vector includes:
[0025] Based on the similarity algorithm, similarity calculation is performed on the target scene question vector and the standard question vector in the vector library to obtain a similarity data set;
[0026] Select the maximum value in the similarity data set and record it as the target similarity data;
[0027] Determine whether the target similarity data is greater than a preset similarity threshold;
[0028] If so, the standard question vector corresponding to the target similarity data is used as the target standard question vector.
[0029] In one embodiment, the step of calling the corresponding plug-in interface according to the plug-in interface parameters to generate the scenario question answer result includes:
[0030] According to the plug-in interface parameters, obtaining corresponding plug-in interface definition data;
[0031] According to the plug-in interface definition data, calling the corresponding plug-in interface to obtain initial response data;
[0032] Filling the initial response data into a preset scenario question response template to generate a scenario question response;
[0033] According to the response to the scenario question, the response result of the scenario question is obtained.
[0034] In addition, to achieve the above purpose, the present application also proposes a scenario question answering device, the scenario question answering device comprising:
[0035] A question acquisition module is used to obtain the target scenario questions;
[0036] A parameter acquisition module, used to acquire corresponding plug-in interface parameters according to the target scenario problem based on a preset vector library and a pre-trained interface parameter extraction model;
[0037] The question answering module is used to call the corresponding plug-in interface according to the plug-in interface parameters to generate the scenario question answering result.
[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a scenario question answering device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the scenario question answering method as described above.
[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the scenario question answering method described above are implemented.
[0040] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the scenario question answering method described above.
[0041] The present application provides a scenario question answering method, which is based on a preset vector library and a pre-trained interface parameter extraction model. According to the target scenario question, the corresponding plug-in interface parameters are obtained, and then according to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answering result. The interface parameter extraction model does not use user data for training. The corresponding plug-in interface can be directly called through the plug-in interface parameters, and there is no need for inference planning of tool selection. Therefore, the technical problems of poor data security and low accuracy of question answering in the prior art are solved, and the data security and accuracy of question answering are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A flowchart of the first embodiment of the method for answering questions in this application scenario is provided;
[0045] Figure 2 A flowchart diagram of the second embodiment of the method for answering questions in this application scenario;
[0046] Figure 3 A brief flowchart of the scenario question answering method provided in Example 2 of the present application;
[0047] Figure 4 A schematic diagram of the module architecture of the scenario question answering method provided in Example 2 of the present application;
[0048] Figure 5 This is a schematic diagram of the module structure of the scenario question answering device of the embodiment of the present application;
[0049] Figure 6 A schematic diagram of the device structure of the hardware operating environment involved in the scenario question answering method in the embodiment of the present application.
[0050] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0051] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0052] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0053] The main solutions of the embodiments of this application are:
[0054] Get the target scenario problem;
[0055] Based on a preset vector library and a pre-trained interface parameter extraction model, corresponding plug-in interface parameters are obtained according to the target scenario problem;
[0056] According to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answering result.
[0057] Since the data security of question answering methods based on large language models in the prior art is poor, the method of using large model AI Agent as a reasoning engine to determine which tools to select according to the current scenario and the information obtained after the use of the tools for intelligent question answering has low accuracy.
[0058] The present application provides a solution, which is based on a preset vector library and a pre-trained interface parameter extraction model. According to the target scenario problem, the corresponding plug-in interface parameters are obtained, and then according to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answer result. The interface parameter extraction model does not use user data for training. The corresponding plug-in interface can be directly called through the plug-in interface parameters, and there is no need for reasoning planning for tool selection. Therefore, the technical problems of poor data security and low accuracy of question responses in the prior art are solved, and the data security and accuracy of question responses are improved.
[0059] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a scenario question answering system, etc. The following takes the scenario question answering system as an example to illustrate this embodiment and the following embodiments.
[0060] Based on this, the present application embodiment provides a scenario question answering method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for answering questions in this application scenario.
[0061] In this embodiment, the scenario question answering method includes steps S10 to S40:
[0062] Step S10, obtaining the target scenario problem;
[0063] It should be noted that the target scenario question is a business query question in a certain scenario input by the user.
[0064] Step S20, based on a preset vector library and a pre-trained interface parameter extraction model, obtain corresponding plug-in interface parameters according to the target scenario problem;
[0065] The scenario question answering system converts the target scenario question into a vector representation. This step is achieved by searching a preset vector library, and then using a pre-trained interface parameter extraction model to extract the required plug-in interface parameters from the vector representation.
[0066] Step S30, calling the corresponding plug-in interface according to the plug-in interface parameters to generate a scenario question answering result.
[0067] The scenario question answering system selects and calls the corresponding plug-in interface according to the plug-in interface parameters, performs the corresponding operations or calculations, and then the plug-in interface returns the processing results, which are usually the content of the answer to the user's question. Finally, the generated results are provided to the user as the final answer to the target scenario question, and the scenario question answering result is obtained.
[0068] In a feasible implementation, step S30 may include steps S301 to S304:
[0069] Step S301, obtaining corresponding plug-in interface definition data according to the plug-in interface parameters;
[0070] Step S302, calling the corresponding plug-in interface according to the plug-in interface definition data to obtain initial response data;
[0071] Step S303, filling the initial response data into a preset scenario question response template to generate a scenario question response;
[0072] Step S304, obtaining the scenario question response result according to the scenario question response.
[0073] The scenario question answering system first parses the incoming plug-in interface parameters, which usually include the interface name, request type, required data fields, etc., and then searches the internally stored interface definition library or document for the interface definition that matches the parsed parameters. The plug-in interface definition data includes the interface operation mode, the required input and output data format, the calling method and other detailed information. Then, the relevant plug-in interface definition data is extracted from the definition library. This data describes in detail how to call the interface, including the required parameters, the format of the return value and the processing logic, etc. Then, according to the plug-in interface definition data, the corresponding plug-in interface is called to obtain the initial reply data, and then the initial reply data is filled into the preset scenario question reply template to generate a scenario question reply. Among them, the scenario question reply template usually contains placeholders for inserting dynamic data. The template can be a simple text format or a more complex template, such as HTML, Markdown, etc. Finally, according to the scenario question reply, the scenario question reply result is obtained.
[0074] In this implementation, by standardizing the plug-in interface data and filling it into the template, automatic generation of question responses is achieved, reducing the need for manual processing and improving efficiency and consistency; the use of plug-in interface definition data and templates allows the system to have a better modular design, and the plug-in interface can be easily replaced or upgraded, allowing the system to flexibly handle different scenario problems and be easy to expand and adapt to new requirements; the system can obtain data from different plug-in interfaces and integrate it into a unified response template, enhancing the system's ability to process multi-source data; by formatting data into easy-to-understand scenario question responses, the user experience is improved, making the final output more friendly and in line with user needs; a flexible and standardized data processing and response generation mechanism is implemented, which can effectively improve the system's automation level, data integration capabilities and user experience, and can be widely used in scenarios that require processing complex data and generating customized responses, such as customer service systems, intelligent question and answer systems, etc.
[0075] This embodiment provides a scenario question answering method based on a preset vector library and a pre-trained interface parameter extraction model. According to the target scenario question, the corresponding plug-in interface parameters are obtained, and then according to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answering result. The interface parameter extraction model does not use user data for training. The corresponding plug-in interface can be directly called through the plug-in interface parameters, and there is no need for inference planning of tool selection. Therefore, the technical problems of poor data security and low accuracy of question answering in the prior art are solved, and the data security and accuracy of question answering are improved.
[0076] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 , step S20 includes steps S201 to S204:
[0077] Step S201, vectorizing the target scene problem to obtain a target scene problem vector;
[0078] Step S202, matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm to obtain a target standard question vector;
[0079] Step S203, obtaining associated prompt information according to the target standard question vector;
[0080] Step S204: input the target standard question vector and prompt information into the interface parameter extraction model to obtain the plug-in interface parameters.
[0081] The scenario question answering system vectorizes the target scenario question to obtain a target scenario question vector, wherein the vectorization process includes text preprocessing, vocabulary embedding or representation, vector aggregation, model output, etc., and then based on a preset similarity algorithm, matches the target scenario question vector with the standard question vector in the vector library to obtain a target standard question vector, wherein commonly used similarity algorithms include cosine similarity algorithm, Euclidean distance algorithm, Manhattan distance algorithm, etc., and then obtains associated prompt information based on the target standard question vector, and finally inputs the target standard question vector and the prompt information into the interface parameter extraction model to obtain the plug-in interface parameters.
[0082] In a feasible implementation manner, before step S204, steps S401 to S403 may also be included:
[0083] Step S401, obtaining scenario information, scenario standard questions and plug-in interface definition data;
[0084] Step S402, generating the prompt information according to the scenario information, scenario standard questions and plug-in interface definition data;
[0085] Step S403: input the prompt information and the scenario standard question into a preset large language model for training to obtain the interface parameter extraction model.
[0086] The scenario question answering system obtains scenario information, scenario standard questions and plug-in interface definition data, and then builds prompt information based on the scenario information, scenario standard questions and plug-in interface definition data. Finally, the prompt information and scenario standard questions are input into the preset large language model for training. The model will learn how to extract interface parameters from the prompt information and scenario questions, and finally obtain the interface parameter extraction model.
[0087] In this implementation, by obtaining scenario information, scenario standard questions and plug-in interface definition data; generating the information based on the scenario information, scenario standard questions and plug-in interface definition data; inputting the prompt information and scenario standard questions into a preset large language model for training to obtain the interface parameter extraction model, an accurate interface parameter extraction model is constructed. This model can automatically generate prompt information adapted to specific scenarios and extract interface parameters therefrom, thereby improving the overall system intelligence level and operational efficiency, solving the accuracy and efficiency issues of interface parameter extraction in specific scenarios, and providing support for subsequent response to scenario questions.
[0088] In another feasible implementation manner, before step S202, steps S501 to S502 may also be included:
[0089] Step S501, vectorizing the scene standard question to obtain the standard question vector;
[0090] Step S502: storing the standard question vector in the vector library, and associating the standard question vector with the prompt information.
[0091] The scenario question answering system selects appropriate text vectorization technology, such as word embeddings, TF-IDF, BERT (Bidirectional Encoder Representations from Transformers), etc., to vectorize the scenario standard questions to obtain standard question vectors, and then stores the vectorized standard questions in a structured vector library. The vector library can be a database, an index system or a specific vector storage system to ensure efficient retrieval, and then associates the standard question vector with the corresponding prompt information to establish a mapping relationship between the vector and the prompt information.
[0092] In this implementation, by storing the standard question vectors in a vector library, similarity searches can be performed quickly, thereby speeding up question retrieval. The vectorization of standard questions can capture the semantic features of the questions, enabling the system to have a better understanding of user queries, and associating the vectors with prompt information to ensure that the retrieved standard questions not only match the semantics, but also provide relevant context or supplementary information, thereby improving the accuracy and relevance of the answers.
[0093] In another feasible implementation, step S202 may include steps S2021 to S2024:
[0094] Step S2021, based on the similarity algorithm, similarity calculation is performed between the target scene question vector and the standard question vector in the vector library to obtain a similarity data set;
[0095] Step S2022, selecting the maximum value in the similarity data set and recording it as target similarity data;
[0096] Step S2023, determining whether the target similarity data is greater than a preset similarity threshold;
[0097] Step S2024: If yes, the standard question vector corresponding to the target similarity data is used as the target standard question vector.
[0098] The scenario question answering system uses a pre-selected similarity algorithm (such as cosine similarity, Euclidean distance, etc.) to calculate the similarity between the target scenario question vector and the standard question vector in the vector library to obtain a similarity data set, and then selects the maximum value in the similarity data set, recorded as the target similarity data, and then compares the target similarity data with a preset similarity threshold to determine whether the target similarity data is greater than the preset similarity threshold. If the target similarity data is greater than the preset similarity threshold, the standard question vector corresponding to the target similarity data is used as the target standard question vector.
[0099] Among them, the similarity algorithm can adopt the cosine similarity algorithm. Cosine similarity is an algorithm used to measure the similarity of two vectors in direction. It is used to determine how similar two vectors are in space and is often used in text analysis and recommendation systems.
[0100] The process of similarity calculation using the cosine similarity algorithm is as follows:
[0101] 1. Vectorization.
[0102] 1) Feature extraction: Extract features from objects (such as text, images, etc.). For example, text can be represented by word frequency or word embedding, and images can be represented by pixel values or the output of a deep learning model.
[0103] 2) Numerical representation: The extracted features are converted into a numerical vector. Each feature corresponds to a dimension in the vector. In this way, all objects are represented as numerical vectors of the same dimension, which is convenient for comparison.
[0104] 2. Dot product calculation.
[0105] 1) Multiply corresponding components: For two vectors, multiply their values in the same position one by one. For example, multiply the values of vector A and vector B in the first dimension, multiply the values in the second dimension, and so on.
[0106] 2) Sum: Add the above product results together to get a single number, which is the dot product result.
[0107] 3. Calculation of mold length.
[0108] 1) Square each component: Square each value in the vector. For example, square the first component of the vector, square the second component, and so on.
[0109] 2) Sum: Add all the squared values together to get a sum.
[0110] 3) Square root: Take the square root of the above sum to get the modulus of the vector. This value reflects the length or size of the vector.
[0111] 4. Similarity calculation
[0112] 1) Calculate the dot product: Use the dot product result calculated above.
[0113] 2) Calculate the product of the moduli: Calculate the product of the moduli of the two vectors.
[0114] 3) Calculate the similarity ratio: Divide the dot product result by the product of the two vector moduli to get the similarity value. This value indicates the similarity of the two vectors in direction, ranging from 0 to 1. The closer the value is to 1, the more similar the directions of the two vectors are.
[0115] In this implementation, by calculating the similarity between the target scenario question vector and the standard question vector in the vector library, the most matching standard question can be found, thereby improving the accuracy of retrieval. By calculating the similarity between the target scenario question vector and the standard question vector in the vector library, the most matching standard question can be found, thereby improving the accuracy of retrieval. By setting a similarity threshold, it is ensured that only sufficiently matching standard questions will be selected, thereby avoiding mismatching and improving the reliability of the system.
[0116] In this embodiment, by vectorizing the target scenario questions, the system can automatically convert natural language questions into a computer-processable format, thereby performing more efficient question matching and parsing. Based on the similarity algorithm, the system can accurately match the target scenario question vector with the standard question vector and obtain the associated prompt information, which improves the system's understanding and response capabilities to the problem. By inputting the target standard question vector and prompt information into the interface parameter extraction model, the system can automatically extract and generate the required plug-in interface parameters, simplifying the interface call process and improving the degree of automation. Thus, a fully automated process from problem parsing to parameter extraction is achieved, improving the system's intelligence level, response speed and accuracy.
[0117] For example, to help understand the implementation process of the scenario question answering method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 3 and Figure 4 , Figure 3A brief flowchart of a scenario question answering method is provided. Figure 4 A schematic diagram of the module architecture of a scenario question answering method is provided.
[0118] When receiving the target scenario question input by the user, the target scenario question is first vectorized, and the most similar matching standard question is retrieved in the preset vector library, and then the scenario information associated with the preset standard question and the debugged Prompt (prompt word) are obtained. The target scenario question and the preset Prompt are input into the LLM large model, and the JSON input parameter of the plug-in API to be called by the query scenario question is obtained. The answer corresponding to the target scenario question is obtained by calling the corresponding API and returning the data output template content, and then the answer is returned to the user. In this embodiment, the scenario question reply system includes a Prompt automatic construction debugging module, a scenario management module, a question vectorization module and a question and answer module. Through the scene management module, the vectorization module and the Prompt automatic construction debugging module, the standard questions for various scenarios, the plug-in API definition, and the debugged Prompt are configured in advance. When the standard question cannot be matched or the desired JSON cannot be extracted during the session, the user is guided to input a target question similar to the standard question through a session, so that multi-scenario question and answer can be completed accurately.
[0119] Specifically, the functions of each module in the scenario question answering system are as follows:
[0120] 1) Scenario management module, which is used to preset the business personnel's scenario standard questions, the plug-in API definitions corresponding to the questions, the output data template definitions and scenario information in advance. Multiple scenario standard questions are supported, representing different ways of entering scenario questions. Among them, the plug-in API definition includes the interface request method, request path, input parameter return body field definition; the input parameter return body field definition includes the field code, field name, field description, and field type information corresponding to the input and return parameters. The request input parameter definition in the plug-in API definition includes the specific parameter fields corresponding to the request API. The output data template definition uses the FreeMarker Template Language (FTL) language to write the template, flexibly design the fields corresponding to the output data of the scenario, and identify the data to be filled in by placeholders. The API interface output data can be filled into the output data template through the FreeMarker template engine.
[0121] 2) Prompt automatically constructs a debugging module, which is used to automatically construct Prompt prompts based on the preset scenario standard questions in the scenario management module, the plug-in API definition corresponding to the question, the output data template definition, and the scenario information, so that the user question and answer module can input the target scenario question and Prompt into the LLM big model and extract the input parameter JSON of the request plug-in API. The specific example is as follows: User asks: Query the customer balance of customer number 100001, Prompt: "Based on the context of user input, it is recognized that this is a customer query scenario, and the output is in json format. The cltNbr field is returned in json format. The "cltNbr" field represents the customer number. Among them, the output data corresponding to the json field is extracted from the user input context. If no data is extracted, the corresponding output is an empty string.". The output result of the big model: {"cltNbr":"100001"}.
[0122] 3) Problem vectorization module, used to vectorize standard problems, map standard problems into floating-point vector data, and store them in the Milvus vector library.
[0123] 4) Question and answer module, used to receive the user input of the target scene question, vectorize the target scene question, and obtain the question vector; then based on the question vector, search the vector library in the question vectorization module, use the similarity algorithm IP (which is more friendly to Chinese semantic matching) to obtain the standard question that best matches the question vector; then obtain the scene information and plug-in API definition corresponding to the standard question, and the preset Prompt information through the preset scene standard question, the plug-in API definition corresponding to the question, the output data template definition and the scene information in the scene management module; then input the target scene question and Prompt into the LLM large model, extract the input parameter JSON of the request plug-in API, and finally call the corresponding plug-in API to obtain the return body data, fill the return body data and the output data template in the scene management module with content, that is, obtain the data that needs to be replied to the user, reply to the user, and complete the question and answer. Among them, the target scene question vectorization and the vector library perform similarity calculation to obtain the similarity score, which is compared with the preset similarity threshold, and the top1 standard question with a score greater than 300 is selected.
[0124] In addition, after the target scenario question and prompt are input into the LLM large model (qwen-72b), if the corresponding data is not extracted, the user is guided to complete the question description and provide the necessary keyword information. Then, through the user question and answer module, the corresponding JSON is extracted according to the keyword information, and the plug-in API is called to obtain the data and return it to the user. When the user process cannot match the standard question or cannot extract the desired JSON, the user is guided to enter the standard question through the conversation, and the multi-scenario question and answer can be completed accurately.
[0125] In combination with Example 1 and Example 2, the scenario question answering method described in this embodiment has the following advantages over the prior art:
[0126] 1) It can solve the problem that relevant business personnel need to log in to the portal and open the corresponding menu path to obtain data when querying the multi-scenario business data of the jurisdiction users, which involves repeated operations, long search for the corresponding menu path, and long time consumption. It is simple and convenient to use;
[0127] 2) Supports configuration of standard questions, configuration of corresponding scenario API plug-in definitions, and online debugging of the corresponding prompt of the scenario standard question LLM extraction JSON. Through Milvus vectorization and IP similarity algorithm, standard questions and preset plug-in API information of the corresponding scenario are found. At the same time, for problems with large deviations, through conversation guidance, users can be guided to ask target scenario questions similar to standard questions, and then use the LLM large language model (qwen-72b) and the configured prompt extraction plug-in to input the required input parameter JSON, and then call the corresponding plug-in to obtain the business information of the corresponding scenario. It can accurately complete multi-scenario Q&A, improving data security and the accuracy of question responses.
[0128] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the method of answering questions in the scenario of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0129] This application also provides a scenario question answering device, please refer to Figure 5 , the scenario question answering device comprises:
[0130] A question acquisition module 10 is used to acquire the target scenario question;
[0131] The parameter acquisition module 20 is used to acquire corresponding plug-in interface parameters according to the target scenario problem based on a preset vector library and a pre-trained interface parameter extraction model;
[0132] The question answering module 30 is used to call the corresponding plug-in interface according to the plug-in interface parameters to generate a scenario question answering result.
[0133] Optionally, the parameter acquisition module 20 is further used for:
[0134] Vectorize the target scenario problem to obtain a target scenario problem vector;
[0135] Based on a preset similarity algorithm, the target scenario question vector is matched with the standard question vector in the vector library to obtain a target standard question vector;
[0136] According to the target standard question vector, obtaining associated prompt information;
[0137] The target standard question vector and prompt information are input into the interface parameter extraction model to obtain the plug-in interface parameters.
[0138] Optionally, before the step of inputting the target standard question vector and the prompt information into the interface parameter extraction model to obtain the plug-in interface parameters, the step further includes:
[0139] Get scene information, scene standard issues, and plug-in interface definition data;
[0140] Generate the prompt information according to the scenario information, scenario standard questions and plug-in interface definition data;
[0141] The prompt information and scenario standard questions are input into a preset large language model for training to obtain the interface parameter extraction model.
[0142] Optionally, before the step of matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm and obtaining the target standard question vector, the step further includes:
[0143] Vectorizing the scene standard question to obtain the standard question vector;
[0144] The standard question vector is stored in the vector library, and the standard question vector is associated with the prompt information.
[0145] Optionally, the step of matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm to obtain the target standard question vector includes:
[0146] Based on the similarity algorithm, similarity calculation is performed on the target scene question vector and the standard question vector in the vector library to obtain a similarity data set;
[0147] Select the maximum value in the similarity data set and record it as the target similarity data;
[0148] Determine whether the target similarity data is greater than a preset similarity threshold;
[0149] If so, the standard question vector corresponding to the target similarity data is used as the target standard question vector.
[0150] Optionally, the question answering module 30 is further used for:
[0151] According to the plug-in interface parameters, obtaining corresponding plug-in interface definition data;
[0152] According to the plug-in interface definition data, calling the corresponding plug-in interface to obtain initial response data;
[0153] Filling the initial response data into a preset scenario question response template to generate a scenario question response;
[0154] According to the response to the scenario question, the response result of the scenario question is obtained.
[0155] The scenario question answering device provided by the present application adopts the scenario question answering method in the above embodiment, which can solve the technical problems of poor data security and low accuracy of question answering in the prior art. Compared with the prior art, the beneficial effects of the scenario question answering device provided by the present application are the same as the beneficial effects of the scenario question answering method provided by the above embodiment, and the other technical features in the scenario question answering device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0156] The present application provides a scenario question answering device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the scenario question answering method in the above-mentioned embodiment one.
[0157] Reference below Figure 6 , which shows a schematic diagram of the structure of a scenario question answering device suitable for implementing the embodiment of the present application. The scenario question answering device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The scenario question answering device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0158] like Figure 6As shown, the scene question answering device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the scene question answering device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the scene question answering device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a scene question answering device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0159] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0160] The scenario question answering device provided by the present application adopts the scenario question answering method in the above embodiment, which can solve the technical problems of poor data security and low accuracy of question answering in the prior art. Compared with the prior art, the beneficial effects of the scenario question answering device provided by the present application are the same as the beneficial effects of the scenario question answering method provided by the above embodiment, and the other technical features in the scenario question answering device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0161] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0162] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0163] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the scenario question answering method in the above-mentioned embodiment.
[0164] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0165] The above-mentioned computer-readable storage medium may be included in the scenario question answering device; or it may exist independently without being assembled into the scenario question answering device.
[0166] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the scenario question answering device, the scenario question answering device:
[0167] Get the target scenario problem;
[0168] Based on a preset vector library and a pre-trained interface parameter extraction model, corresponding plug-in interface parameters are obtained according to the target scenario problem;
[0169] According to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answering result.
[0170] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0171] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0172] The modules involved in the embodiments of the present application may be implemented by software or hardware, wherein the name of the module does not limit the unit itself in some cases.
[0173] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned scenario question answering method, and can solve the technical problems of poor data security and low accuracy of question answering in the prior art. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the scenario question answering method provided in the above-mentioned embodiment, and will not be repeated here.
[0174] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned scenario question answering method when executed by a processor.
[0175] The computer program product provided by this application can solve the technical problems of poor data security and low accuracy of question responses in the prior art. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the scenario question response method provided by the above embodiment, which will not be repeated here.
[0176] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A scenario question answering method, characterized in that: The method comprises: Get the target scenario problem; Based on a preset vector library and a pre-trained interface parameter extraction model, corresponding plug-in interface parameters are obtained according to the target scenario problem; According to the plug-in interface parameters, the corresponding plug-in interface is called to generate the scenario question answering result.
2. The method according to claim 1, characterized in that The step of obtaining corresponding plug-in interface parameters based on the preset vector library and the pre-trained interface parameter extraction model according to the target scenario problem includes: Vectorize the target scenario problem to obtain a target scenario problem vector; Based on a preset similarity algorithm, the target scenario question vector is matched with the standard question vector in the vector library to obtain a target standard question vector; According to the target standard question vector, obtaining associated prompt information; The target standard question vector and prompt information are input into the interface parameter extraction model to obtain the plug-in interface parameters.
3. The method according to claim 2, characterized in that Before the step of inputting the target standard question vector and the prompt information into the interface parameter extraction model to obtain the plug-in interface parameters, the step further includes: Get scene information, scene standard issues, and plug-in interface definition data; Generate the prompt information according to the scenario information, scenario standard questions and plug-in interface definition data; The prompt information and scenario standard questions are input into a preset large language model for training to obtain the interface parameter extraction model.
4. The method according to claim 3, characterized in that Before the step of matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm to obtain the target standard question vector, the step further includes: Vectorizing the scene standard question to obtain the standard question vector; The standard question vector is stored in the vector library, and the standard question vector is associated with the prompt information.
5. The method according to claim 2, characterized in that The step of matching the target scenario question vector with the standard question vector in the vector library based on a preset similarity algorithm to obtain the target standard question vector comprises: Based on the similarity algorithm, similarity calculation is performed on the target scene question vector and the standard question vector in the vector library to obtain a similarity data set; Select the maximum value in the similarity data set and record it as the target similarity data; Determine whether the target similarity data is greater than a preset similarity threshold; If so, the standard question vector corresponding to the target similarity data is used as the target standard question vector.
6. The method according to claim 1, characterized in that The step of calling the corresponding plug-in interface according to the plug-in interface parameters to generate the scenario question answer result comprises: According to the plug-in interface parameters, obtaining corresponding plug-in interface definition data; According to the plug-in interface definition data, calling the corresponding plug-in interface to obtain initial response data; Filling the initial response data into a preset scenario question response template to generate a scenario question response; According to the response to the scenario question, the response result of the scenario question is obtained.
7. A scenario question answering device, characterized in that: The device comprises: A question acquisition module is used to obtain the target scenario questions; A parameter acquisition module, used to acquire corresponding plug-in interface parameters according to the target scenario problem based on a preset vector library and a pre-trained interface parameter extraction model; The question answering module is used to call the corresponding plug-in interface according to the plug-in interface parameters to generate the scenario question answering result.
8. A scenario question answering device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the scenario question answering method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the scenario question answering method as described in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the scenario question answering method as claimed in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Question answering processing server, client and realization method
CN107704521A
Large model plug-in calling method and device, equipment and medium
CN117112065A
Question and answer reply method and system based on large model, terminal and storage medium
CN117851569A
Large model plug-in calling method and device, electronic equipment and storage medium
CN118132164A
Intelligent reply method and device
CN118607529A
Cited By
Generation method and device of scene question and answer model of intelligent agent, equipment and medium
CN119739880A
