A Large Model Prompt Intelligent Routing Method, Device, Equipment and Storage Medium
By generating a decision tree and building a model based on the amount of knowledge data, the problem of building a single industry model and the problem of insufficient accuracy in answering public models is solved, and a higher accuracy of prompt word correspondence is achieved.
Patent Information
- Application Number
- CN202510206990.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-02-25
AI Technical Summary
It is difficult for a single industry to establish a private industry model. The public big model has poor accuracy in answering prompt words to a single industry, due to the limited amount of public knowledge.
By generating a decision tree based on the code file and a preset database, determining the amount of knowledge data of the module node, building a first model to process the user's prompt words, and with the help of the tag node in the decision tree, whether to access the second model to improve the accuracy of the answer.
By calculating the knowledge data volume of module nodes and deploying a server model with corresponding knowledge volume, the accuracy of prompt words corresponds to the answers is improved and the high accuracy needs of a single industry user is met.
Smart Images

Figure CN119691137B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of large models, and particularly to an intelligent routing method, device, equipment and storage medium for large model prompt words. Background Art
[0002] The continuous development of AI large models has brought a good intelligent experience to users.
[0003] Since a single industry needs not only a large amount of highly private data but also a high cost to build its own private industry model. Limited by the difficulty of obtaining a large amount of highly private data and cost constraints, it is generally very difficult for a single industry to build its own private industry model at present; there are already many public large models on the market, but for a single industry, the public large models can only answer the prompt words given by users based on the publicly available knowledge of the single industry. Limited by the small amount of publicly available knowledge in a single industry, the accuracy of the answers corresponding to the prompt words will be poor. Summary of the Invention
[0004] To facilitate improving the accuracy of the answers corresponding to the prompt words, this application provides an intelligent routing method, device, equipment and storage medium for large model prompt words.
[0005] In a first aspect, this application provides an intelligent routing method for large model prompt words, including:
[0006] Generating a decision tree based on a code file and a preset database;
[0007] Determining the node types of each module node under a conditional node in the decision tree, and determining the knowledge data volume of the module node based on the node type, the decision tree, the code file and the database;
[0008] Constructing a first model based on the knowledge data volume of the module node, and processing the prompt word based on the first model in response to the first model hitting the prompt word issued by the user;
[0009] In response to the first model not hitting the prompt word, determining whether to use the prompt word to access a second model based on the prompt word and a label node in the decision tree.
[0010] In a second aspect, this application provides an intelligent routing device for large model prompt words, including:
[0011] A decision tree construction module, configured to generate a decision tree based on a code file and a preset database;
[0012] A data volume calculation module, configured to determine the node types of each module node under a conditional node in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file, and the database;
[0013] A model processing module, configured to construct a first model based on the knowledge data volume of the module node, and in response to the first model hitting a prompt word issued by a user, process the prompt word based on the first model;
[0014] An access judgment module, configured to, in response to the first model not hitting the prompt word, determine whether to use the prompt word to access a second model based on the prompt word and a label node in the decision tree.
[0015] In a third aspect, the present application provides a computer device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps in the above method are implemented.
[0016] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method are implemented.
[0017] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0018] The above large model prompt word intelligent routing method, device, equipment and storage medium generate a decision tree based on a code file and a preset database; determine the node types of each module node under a conditional node in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file, and the database; construct a first model based on the knowledge data volume of the module node, and in response to the first model hitting a prompt word issued by a user, process the prompt word based on the first model; in response to the first model not hitting the prompt word, determine whether to use the prompt word to access a second model based on the prompt word and a label node in the decision tree. Through the above implementation, by calculating the knowledge data volume corresponding to each module node, it is convenient to deploy the first model to a server corresponding to the knowledge data volume. Since there is knowledge corresponding to the knowledge data volume in the first model, it is possible to effectively answer the prompt word issued by the user within the knowledge scope of the first model, thereby improving the accuracy of the answer corresponding to the prompt word.
[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become easily understood through the following description. Brief Description of the Drawings
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0021] Figure 1 It is a flowchart of an intelligent routing method for large model prompt words provided in an embodiment of the present application;
[0022] Figure 2 It is a schematic structural diagram of an intelligent routing device for large model prompt words provided in an embodiment of the present application;
[0023] Figure 3 It is a schematic structural diagram of a computer device provided in an embodiment of the present application;
[0024] Figure 4 It is an internal structural diagram of a computer-readable storage medium provided in an embodiment of the present application. Detailed Description of the Embodiments
[0025] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of this article and the above drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or equipment.
[0027] In this text, the term "and / or" is merely a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, in this text, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0028] Embodiment 1
[0029] Figure 1 is a flowchart of a large model prompt word intelligent routing method provided for Embodiment 1 of this application. Refer to Figure 1 , this method can be executed by the device that executes this method, and this device can be implemented in software and / or hardware. This method includes:
[0030] S110. Generate a decision tree based on the code file and a preset database.
[0031] In this embodiment, in order to provide another routing option for prompt words for users in a single industry on the basis of the second model, it is necessary to construct the first model of this single industry. Here, the prompt word is the content that the user is about to input into the model.
[0032] In this embodiment, the first model is composed of knowledge models carried on different servers, and each knowledge model has a certain amount of knowledge data. In order to facilitate determining the amount of knowledge data of each knowledge model, it is necessary to build a decision tree associated with this first model. To obtain this decision tree, corresponding programming work needs to be carried out first to obtain the corresponding code file. In order to facilitate storing the data required when the code file runs, a preset database is also prepared for this code file; by extracting the feature data corresponding to the above single industry from the code file, a primary decision tree can be constructed. Further, the primary decision tree can be improved through the primary decision tree and the database to obtain the target decision tree.
[0033] S120. Determine the node types of each module node under the conditional node in the decision tree, and determine the knowledge data amount of the module node based on the node type, the decision tree, the code file, and the database.
[0034] Among them, the root node of the decision tree is established based on the storage path of the code file. To obtain this storage path, it is necessary to first build a front-end engineering framework compiler loader through Node.js (a JavaScript runtime environment based on the Chrome V8 engine), then configure the front-end engineering framework compiler loader into the front-end engineering file, and then trigger the front-end engineering framework compiler loader to read this code file by running the Nup runbuild instruction, so as to obtain the storage path of this code file. The storage path includes multiple storage nodes.
[0035] Exemplarily, a storage path is a / b / c / d / e / dform / dconstant……, where a, b, c, d, e, dform, dconstant…… are storage nodes at each level respectively; starting from the last-level storage node of this storage path and moving forward in sequence, for each level of node, it is judged whether there is a file under this level of storage node. If not, this level of node is taken as the service function module corresponding to this storage path, and the service function module is a function module of the corresponding service system; exemplarily, a service system is specifically a case management system, and among them, there is a function module which is a case query module.
[0036] After determining the service function module corresponding to this storage path, the storage node corresponding to this service function module is taken as the root node of the decision tree, and the next-level storage node of this root node is taken as the second-level node of this decision tree; exemplarily, dform is taken as the root node of this decision tree, and the next-level storage node dconstant of dform is taken as the second-level node of this decision tree.
[0037] Furthermore, to expand this decision tree, in this embodiment, three third-level nodes are also added under this second-level node, namely a model node, a condition node, and a label node; subsequently, by further extracting the feature data corresponding to the above single industry from this code file, fourth-level nodes under each third-level node can be added, and the fourth-level nodes under the condition node are denoted as module nodes, and each module node is used to determine the corresponding knowledge model. To determine the data volume of the knowledge required to determine the corresponding knowledge model, it is necessary to classify each module node to determine the node type of each module node; in this embodiment, the node types include: time type, organization type, fuzzy matching type, and interval type.
[0038] Among them, if it is judged that the module node contains time information, it is determined that the node type of this module node is the time type, where this time information includes annual information and start and end time information; exemplarily, the annual information is such as 20XX, etc., and the start and end time information is used to represent the start time and end time of a period of time, such as from X month of 20XX to Y month of 20YY, etc.
[0039] Among them, if it is judged that the module node contains the org field, it is determined that the node type of this module node is the organization type; it should be noted that the org field indicates that the data corresponding to the module node is data with an organizational relationship.
[0040] Among them, the information included in the module node includes the table name and field type of the data table. If it is judged that the table name of the module node is the same as the table name of the data table in the database and the field type is the same as the type of the fields in the data table, it is determined that the node type of this module node is the fuzzy matching type.
[0041] Among them, if it is determined that the fuzzy node contains an interval symbol, the node type of the module node is determined to be an interval type; for example, the interval symbols are "<", ">", "≤", and "≥", etc.
[0042] It should be noted that after determining the node types corresponding to each module node one by one, further according to the node types corresponding to each model node, as well as the above decision tree, code file, and database, the amount of knowledge data corresponding to each model node one by one can be determined, and this amount of knowledge data is recorded as the knowledge data volume.
[0043] S130. Construct a first model based on the knowledge data volume of the module node, and in response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model.
[0044] Among them, the first model is constructed based on the knowledge models carried on multiple servers, and each knowledge model is established based on the knowledge data volume of each module node. After the first model is constructed, users in a single industry corresponding to the first model can send a prompt word to the first model; for example, a prompt word is "Please give cases of annual ZZ information statistics for the XX industry in the YY year"; after the first model receives this prompt word, if it matches content with a relatively high degree of matching in the decision tree (in this embodiment, specifically, the fourth-level node under the decision tree condition node), then the prompt word is processed to meet the user's needs.
[0045] In an optional embodiment, after responding to the first model hitting the prompt word issued by the user, it further includes: determining the module node corresponding to the prompt word in the decision tree, determining the module nodes of the same node type as this module node, and generating a guiding question based on the module nodes of the same node type.
[0046] Among them, the prompt word can be matched with each module node under the conditional node. Specifically, that is to say, the similarity between the prompt word and the content in the module node (such as some Chinese characters) is judged, and this similarity is recorded as the matching degree. It is judged whether this matching degree is greater than the preset matching degree threshold. Exemplarily, the matching degree threshold is 80%. If this matching degree is greater than the matching degree threshold, it means that in the decision tree, content with a higher matching degree with the prompt word is matched. At this time, the module node corresponding to the matching degree greater than the preset matching degree threshold is used as the module node corresponding to the prompt word in the decision tree; after the module node completes classification, each node type includes a certain number of module nodes. The node type corresponding to the module node corresponding to the prompt word in the decision tree also includes module nodes of the same node type as this module node; through the module nodes of the same node type as this module node, a guiding question for guiding the user to issue a new prompt word can be generated; it should be noted that although the prompt word initially issued by the user may match content with a relatively high matching degree in the decision tree, the prompt word may not be suitable for effective processing by the first model. Therefore, in order to improve the user experience, a guiding question can be further generated according to the obtained module nodes of the same node type, so that the user can send a prompt word more suitable for effective processing by the first model to the first model again; Exemplarily, the guiding question is "Do you want to query cases according to the case name?".
[0047] S140. In response to the first model not hitting the prompt word, determine whether to use the prompt word to access the second model based on the prompt word and the label node in the decision tree.
[0048] Among them, after the first model receives the prompt word, if no content with a relatively high matching degree with the prompt word is matched in the corresponding decision tree (in this embodiment, mainly the fourth-level nodes of the decision tree), it means that there is no content corresponding to the prompt word in the fourth-level nodes under the conditional node; however, there may still be content with a relatively high matching degree with the prompt word in the fourth-level nodes under the label node; for this reason, it can be further judged whether there is content with a relatively high matching degree with the prompt word in the fourth-level nodes under the label node. If it exists, it means that the first model still has the ability to accurately answer the prompt word. At this time, the first model is still used to process the prompt word and answer the prompt word; if it does not exist, it means that the first model does not have the ability to accurately answer the prompt word. At this time, the prompt word is used to further access the second model so that the second model answers the prompt word.
[0049] It should be noted that in this embodiment, a decision tree is generated based on a code file and a preset database; the node types of each module node under a conditional node in the decision tree are determined, and the knowledge data volume of the module node is determined based on the node type, the decision tree, the code file, and the database; a first model is constructed based on the knowledge data volume of the module node, and when the first model hits a prompt word issued by a user, the prompt word is processed based on the first model; when the first model does not hit the prompt word, it is determined whether to use the prompt word to access a second model based on the prompt word and a label node in the decision tree. Through the above implementation, by calculating the knowledge data volume corresponding to each module node, it is convenient to deploy the first model to a server corresponding to the knowledge data volume. Since there is knowledge corresponding to the knowledge data volume in the first model, the prompt word issued by the user can be effectively answered within the knowledge scope of the first model, thereby improving the accuracy of the answer corresponding to the prompt word.
[0050] Embodiment 2
[0051] A large model prompt word intelligent routing method provided by Embodiment 2 of the present application refines the "generating a decision tree based on a code file and a preset database" in Embodiment 1; it should be noted that for parts not detailed in this embodiment, the descriptions of other embodiments can be referred to. The method includes:
[0052] S211. Determine a root node based on the storage path of the code file, and add secondary nodes under the root node.
[0053] Among them, through step S120 in Embodiment 1, it can be seen that starting from the last-level storage node of the storage path and moving forward in turn for each level of node, it is judged whether there is a file under this level of storage node. If not, this level of node is used as the service function module corresponding to the storage path, and then the storage node corresponding to this service function module is used as the root node of the decision tree. Further, secondary nodes can be added under the root node. Exemplarily, dform is used as the root node of the decision tree, and the next-level storage node dconstant of dform is used as the secondary node of the decision tree.
[0054] S212. Add tertiary nodes under the secondary nodes, where the tertiary nodes include model nodes, conditional nodes, and label nodes.
[0055] Among them, the tertiary nodes in this embodiment include model nodes, conditional nodes, and label nodes. In other embodiments, there is no specific limitation.
[0056] S213. Determine the quaternary nodes under the tertiary nodes based on the code file.
[0057] Among them, the code file contains feature data corresponding to a single industry. After extracting the feature data from the code file, the feature data can be used as a fourth-level node under the third-level node. It should be noted that the feature data includes: data labels, label values, text descriptions, etc.
[0058] S214. Determine new fourth-level nodes under the label node based on a preset database and the second-level node.
[0059] Among them, a menu table is set in the database. The menu table contains multiple menus, and each menu has a corresponding menu path. In this embodiment, the second-level node of the decision tree is dconstant, and the storage path of this second-level node is "a / b / c / d / e / dform / dconstant". After adding fourth-level nodes under the model node, condition node, and label node through the code file, further, obtain the storage path of the second-level node and the menu paths of each menu in the menu table in the database; then respectively determine whether each menu path is consistent with the storage path of the second-level node. If there is a menu path that is consistent with the storage path of the second-level node, add the menu name corresponding to this menu path under the label node, so as to be the new fourth-level node under the label node.
[0060] S215. Obtain a decision tree based on the root node, the second-level node, the third-level node, and the fourth-level node.
[0061] Among them, in this embodiment, a decision tree is constructed by adding a second-level node under the root node, adding a third-level node under the second-level node, and adding a fourth-level node under the third-level node. In other embodiments, it is not specifically limited.
[0062] S220. Determine the node types of each module node under the condition node in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file, and the database.
[0063] S230. Construct a first model based on the knowledge data volume of the module node. In response to the first model hitting a prompt word issued by the user, process the prompt word based on the first model.
[0064] S240. In response to the first model not hitting the prompt word, determine whether to use the prompt word to access a second model based on the prompt word and the label node in the decision tree.
[0065] Embodiment Three
[0066] A large model prompt intelligent routing method provided in the third embodiment of the present application refines the step of "determining the fourth-level node under the third-level node based on the code file" in the second embodiment. It should be noted that for parts not detailed in this embodiment, reference can be made to the descriptions of other embodiments. The method includes:
[0067] S311. Determine the root node based on the storage path of the code file, and add a second-level node under the root node.
[0068] S312. Add a third-level node under the second-level node, where the third-level node includes a model node, a condition node, and a label node.
[0069] S3131. In response to the existence of a global label in the code file, use the label value of the global label as the fourth-level node under the label node.
[0070] Among them, the global label includes a title label and a header label. Exemplarily, the title label is " <title>Case management< / title> ", and the label value of the global label is the Chinese character in the global label. Exemplarily, the label value of the title label " <title>Case management< / title> " is "Case Management".
[0071] S3132. In response to the existence of a form label in the code file, use the form ID and form fields corresponding to the form label as the fourth-level node under the model node, and use the form fields as the fourth-level node under the label node.
[0072] Among them, the form label is the form label in this embodiment, that is, the form label. Parsing the form label can obtain the corresponding form, and the form includes a form ID and form fields. If there is a form label in the code file, then "form ID + form fields" should be used as the fourth-level node under the model node, and at the same time, the form fields should be used as the fourth-level node under the label node.
[0073] S3133. In response to the existence of a table label in the code file, use the table header description and field identifier corresponding to the table label as the fourth-level node under the model node, and use the table header description as the fourth-level node under the label node.
[0074] Among them, the table tag is also the table tag in this embodiment. Parsing the table tag can obtain the corresponding table. The table includes a header description and field identifiers. The header description is used to display the theme of the table, such as "transcript". The field identifiers are also the field names of each field in the table. Exemplarily, the field names include: task brief, task type, task attribute...; If there is a table tag in the code file, the "field identifier + header description" needs to be used as the fourth-level node under the model node, and the header description also needs to be used as the fourth-level node under the tag node.
[0075] S3134. In response to the existence of additional tags in the code file, use the Chinese description corresponding to the additional tags as the fourth-level node under the tag node.
[0076] Among them, the additional tags are other types of tags in the code file except for the global tags, form tags, and table tags, such as span tags, etc.; The corresponding Chinese description can be obtained for this additional tag, and this Chinese description can be used to add to the tag node and thus serve as the fourth-level node under the tag node.
[0077] S314. Based on a preset database and the secondary node, determine the new fourth-level node under the tag node.
[0078] S315. Obtain a decision tree based on the root node, the secondary node, the tertiary node, and the fourth-level node.
[0079] S320. Determine the node types of each module node under the conditional node in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file, and the database.
[0080] S330. Build a first model based on the knowledge data volume of the module node. In response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model.
[0081] S340. In response to the first model not hitting the prompt word, determine whether to use the prompt word to access the second model based on the prompt word and the tag node in the decision tree.
[0082] Embodiment 4
[0083] A large model prompt word intelligent routing method provided in Embodiment 4 of this application refines the "using the tag value of the global tag as the fourth-level node under the tag node" in Embodiment 3 and supplements the steps after "and using the header description as the fourth-level node under the tag node" in Embodiment 3; It should be noted that for the parts not detailed in this embodiment, the descriptions of other embodiments can be referred to. This method includes:
[0084] S411. Determine the root node based on the storage path of the code file, and add secondary nodes under the root node.
[0085] S412. Add tertiary nodes under the secondary nodes, where the tertiary nodes include model nodes, condition nodes, and label nodes.
[0086] S41311. In response to the existence of global labels in the code file.
[0087] S41312. In response to the existence of punctuation marks in the label value of the global label, perform regular splitting on the label value to obtain sub-label values.
[0088] It should be noted that there may be punctuation marks in the label value of the global label. If there are punctuation marks in the label value of the global label, the label value should not be directly used as the fourth-level node under the label node, because it will have an adverse impact on the process of subsequent matching between the prompt words and the fourth-level nodes under the label node. Therefore, after obtaining the label value of the global label, it is necessary to further determine whether there are punctuation marks in the label value. If so, it is necessary to perform regular splitting on the label value. Regular splitting means removing the punctuation marks in the label value and splitting the label value at the original punctuation marks to obtain multiple sub-label values. Exemplarily, assume that the label value of a global label is "query, process". After performing regular splitting on this label value, two sub-label values are obtained, namely "query" and "process".
[0089] S41313. Use the sub-label values as the fourth-level nodes under the label node.
[0090] Among them, when there are punctuation marks in the label value of the global label, the sub-label values corresponding to the label value should be used as the fourth-level nodes under the label node.
[0091] S4132. In response to the existence of form labels in the code file, use the form ID and form fields corresponding to the form labels as the fourth-level nodes under the model node, and use the form fields as the fourth-level nodes under the label node.
[0092] S4133. In response to the existence of table labels in the code file, use the header description and field identifiers corresponding to the table labels as the fourth-level nodes under the model node, and use the header description as the fourth-level nodes under the label node.
[0093] S4134. In response to the existence of additional labels in the code file, use the Chinese description corresponding to the additional labels as the fourth-level nodes under the label node.
[0094] S414. Determine the new fourth-level nodes under the label node based on a preset database and the secondary nodes.
[0095] S415. Obtain a decision tree based on the root node, the secondary nodes, the tertiary nodes, and the quaternary nodes.
[0096] S420. Determine the node types of each module node under the conditional nodes in the decision tree, and determine the knowledge data volume of the module nodes based on the node types, the decision tree, the code file, and the database.
[0097] S430. Construct a first model based on the knowledge data volume of the module nodes. In response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model.
[0098] S440. In response to the first model not hitting the prompt word, determine whether to use the prompt word to access the second model based on the prompt word and the label nodes in the decision tree.
[0099] Embodiment Five
[0100] A large model prompt word intelligent routing method provided in Embodiment Five of the present application refines the "determine the knowledge data volume of the module nodes based on the node types, the decision tree, the code file, and the database" in Embodiment One; it should be noted that for parts not detailed in this embodiment, reference can be made to the descriptions of other embodiments. The method includes:
[0101] S510. Generate a decision tree based on the code file and a preset database.
[0102] S521. Determine the node types of each module node under the conditional nodes in the decision tree.
[0103] Among them, it can be known from step S120 of Embodiment One that each module node under the conditional nodes can be classified into the corresponding node types, where the node types include: time type, organization type, fuzzy matching type, and interval type.
[0104] S522. Determine the target data table based on the decision tree, the code file, and the database.
[0105] Among them, the database includes multiple data tables, and one of the data tables is related to the decision tree. Only through the data table related to the decision tree can the knowledge data volume of the module nodes be further determined. In this embodiment, by matching the decision tree, the code file, and the database, the data table related to the decision tree can be determined from multiple data tables.
[0106] S523. Determine the knowledge data volume of the corresponding module nodes based on the target data table and the node types.
[0107] It should be noted that the calculation methods of the knowledge data volume of module nodes of different node types are different.
[0108] Among them, if the node type of the module node is a time type and specifically annual information, then determine the time classification statistical SQL statement corresponding to the target data table, and add the time classification statistical SQL statement to the module node; it should be noted that if the org field exists in the target data table, that is, the target data table contains data with organizational relationships, at this time, the org field also needs to be added to the time classification statistical SQL statement; subsequently, by executing the time classification statistical SQL statement, the knowledge data volume of the module node can be obtained. If the node type of the module node is a time type and specifically start and end time information, then determine the full amount SQL statement corresponding to the target data table, and add the full amount SQL statement to the module node. Similarly, if the org field exists in the target data table, that is, the target data table contains data with organizational relationships, at this time, the org field also needs to be added to the full amount SQL statement; subsequently, by executing the full amount SQL statement, the knowledge data volume of the module node can be obtained.
[0109] Among them, if the node type of the module node is an organization type, then determine the organization classification statistical SQL statement corresponding to the target data table, and add the organization classification statistical SQL statement to the module node; subsequently, by executing the organization classification statistical SQL statement, the knowledge data volume of the module node can be obtained.
[0110] Among them, if the node type of the module node is a fuzzy matching type, then determine the full amount SQL statement corresponding to the target data table, and add the full amount SQL statement to the module node; subsequently, by executing the full amount SQL statement, the knowledge data volume of the module node can be obtained.
[0111] Among them, if the node type of the module node is an interval type, then group the target data table according to the interval symbols in the module node to obtain multiple groups of tables, then determine the SQL statements corresponding to the group tables, and add each SQL statement to the module node; subsequently, by executing each SQL statement, the knowledge data volume of the module node can be obtained.
[0112] S530. Construct a first model based on the knowledge data volume of the module node, and in response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model;
[0113] S540. In response to the first model not hitting the prompt word, determine whether to use the prompt word to access the second model based on the prompt word and the label node in the decision tree.
[0114] Example Six
[0115] A large model prompt intelligent routing method provided in Embodiment VI of the present application refines "determining the target data table based on the decision tree, the code file, and the database" in Embodiment V; it should be noted that for parts not detailed in this embodiment, reference can be made to the descriptions of other embodiments. The method includes:
[0116] S610. Generate a decision tree based on the code file and a preset database.
[0117] S621. Determine the node types of each module node under the conditional node in the decision tree.
[0118] S6221. In response to the existence of a table name in the database that is the same as the file identifier of the code file, determine whether the matching degree between the form ID in the decision tree and the fields of the data table exceeds a preset matching threshold.
[0119] Among them, there are multiple data tables in the database, and each data table has a corresponding table name; the code file has a corresponding code identifier; there are multiple form IDs under the model node or conditional node of the decision tree, and there are also multiple fields in the data table. If it is necessary to determine the data table corresponding to the decision tree, that is, the target data table, from multiple data tables, it is necessary to first determine the data table whose table name is the same as the file identifier of the code file from multiple data tables; then it is also necessary to calculate the matching degree between the form ID in the decision tree and the fields of the data table. Among them, taking a form ID as an example, if the form ID is the same as the name of a field in the data table, it means that the form ID matches the field name. By sequentially matching the multiple form IDs in the decision tree with the names of the multiple fields of each data table, the ratio of the number of successfully matched fields to the total number of fields in the data table is the matching degree. In order to facilitate judging the size of the matching degree, a matching threshold is also preset. Exemplarily, the matching threshold is 80%.
[0120] S6222. If so, use the data table as the target data table.
[0121] Among them, if the matching degree exceeds the preset matching threshold, it means that the matching degree is relatively high, that is, it represents that the data table corresponding to the matching degree is the data table related to the decision tree, that is, the target data table.
[0122] S623. Determine the knowledge data volume of the corresponding module node based on the target data table and the node type.
[0123] S630. Build a first model based on the knowledge data volume of the module node. In response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model.
[0124] S640. In response to the first model missing the prompt word, determine whether to use the prompt word to access the second model based on the prompt word and the label node in the decision tree.
[0125] Embodiment Seven
[0126] A large model prompt word intelligent routing method provided in Embodiment Seven of this application refines "constructing a first model based on the knowledge data volume of the module node" in Embodiment One; it should be noted that for parts not detailed in this embodiment, reference can be made to the descriptions of other embodiments. The method includes:
[0127] S710. Generate a decision tree based on the code file and a preset database.
[0128] S720. Determine the node types of each module node under the condition node in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file, and the database.
[0129] S731. Determine the server corresponding to the module node based on the knowledge data volume.
[0130] Among them, the knowledge data volume corresponding to each module node under the condition node can be calculated. In this embodiment, for constructing a knowledge model for building the first model, multiple servers are preset, and each server has a corresponding knowledge data capacity. In this embodiment, the server corresponding to each module node can be determined according to the knowledge data capacity of each server and the knowledge data volume of each module node; for example, assume that the knowledge data volume of module node A is 5K, the knowledge data volume of module node B is 2K, the knowledge data capacity of server 1 is 8K, and the knowledge data capacity of server 2 is 5K. Then it is determined that the server corresponding to module node A is server 1, and the server corresponding to module node B is server 2, and so on.
[0131] S732. Construct a corresponding knowledge model based on the knowledge data volume of the module node, and deploy the knowledge model on the server corresponding to the module node.
[0132] Among them, a corresponding knowledge model can be built according to the knowledge data volume of the module node. Subsequently, for building the first model, the knowledge model also needs to be deployed on the server corresponding to the module node.
[0133] S733. Obtain the first model based on the knowledge models on each server.
[0134] Among them, the first model is a collection of each knowledge model.
[0135] S734. In response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model.
[0136] S740. In response to the first model not hitting the prompt word, determine whether to use the prompt word to access the second model based on the prompt word and the label nodes in the decision tree.
[0137] It should be understood that although the steps in the flowcharts involved in the above embodiments are sequentially shown according to the indication of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0138] Embodiment VIII
[0139] Based on the same inventive concept, this embodiment also provides a prompt word intelligent routing device for implementing the above-mentioned large model prompt word intelligent routing method. The implementation solutions provided by this device to solve problems are similar to the implementation solutions recorded in the above method. Therefore, the specific limitations in one or more embodiments of the following prompt word intelligent routing device can refer to the limitations on the prompt word intelligent routing method in the above text, and will not be repeated here.
[0140] In this embodiment, as Figure 2 shown, a large model prompt word intelligent routing device is provided, including:
[0141] A decision tree construction module, configured to generate a decision tree based on the code file and a preset database;
[0142] A data volume calculation module, configured to determine the node types of each module node under the condition nodes in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file, and the database;
[0143] A model processing module, configured to construct a first model based on the knowledge data volume of the module node, and in response to the first model hitting the prompt word issued by the user, process the prompt word based on the first model;
[0144] An access judgment module, configured to determine whether to use the prompt word to access the second model based on the prompt word and the label nodes in the decision tree in response to the first model not hitting the prompt word.
[0145] Each module in the above-mentioned prompt word intelligent routing device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0146] It should be noted that in this embodiment, a decision tree is generated based on the code file and the preset database; the node types of each module node under the condition node in the decision tree are determined, and the knowledge data volume of the module node is determined based on the node type, the decision tree, the code file, and the database; a first model is constructed based on the knowledge data volume of the module node, and in response to the first model hitting the prompt word issued by the user, the prompt word is processed based on the first model; in response to the first model not hitting the prompt word, it is determined whether to use the prompt word to access the second model based on the prompt word and the label nodes in the decision tree. Through the above implementation, by calculating the knowledge data volume corresponding to each module node, it is convenient to deploy the first model to the server corresponding to the knowledge data volume. Since there is knowledge corresponding to the knowledge data volume in the first model, the prompt word issued by the user can be effectively answered within the knowledge scope of the first model, thereby improving the accuracy of the answer corresponding to the prompt word.
[0147] Embodiment Nine
[0148] In this embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 3 shown. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, 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, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a large model prompt word intelligent routing method.
[0149] Those skilled in the art can understand, Figure 3The structure shown is only a block diagram of some structures related to the present disclosure solution, and does not constitute a limitation on the computer device to which the present disclosure solution is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have a different component arrangement.
[0150] Embodiment Ten
[0151] In this embodiment, a computer-readable storage medium is provided. As Figure 4 shown, a computer program is stored thereon, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0152] Embodiment Eleven
[0153] In this embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0154] 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 for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or fully authorized by all parties.
[0155] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. 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 methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided by the present disclosure can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided by the present disclosure can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0156] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, 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, it should be considered as the scope recorded in this specification.
[0157] The above-described embodiments only represent several implementation manners of the present disclosure. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the patents of the present disclosure. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present disclosure, several modifications and improvements can still be made, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the appended claims.
Claims
1. A large model prompt word intelligent routing method, characterized in that: include: Generate a decision tree based on code files and a preset database; Determine the node type of each module node under the condition node in the decision tree, and determine the amount of knowledge data of the module node based on the node type, the decision tree, the code file and the database; Building a first model based on the amount of knowledge data of the module node, and in response to the first model hitting a prompt word issued by a user, processing the prompt word based on the first model; In response to the first model not hitting the prompt word, determining whether to use the prompt word to access the second model based on the prompt word and the label node in the decision tree; Wherein, constructing a first model based on the amount of knowledge data of the module node includes: Determine the server corresponding to the module node based on the amount of knowledge data; Building a corresponding knowledge model based on the knowledge data volume of the module node, and deploying the knowledge model on a server corresponding to the module node; A first model is obtained based on the knowledge models on each server.
2. The method according to claim 1, characterized in that The generating of a decision tree based on the code file and a preset database includes: Determine a root node based on the storage path of the code file, and add a secondary node under the root node; Adding a third-level node under the second-level node, wherein the third-level node includes a model node, a condition node, and a label node; Determine a fourth-level node under the third-level node based on the code file; Determine a new fourth-level node under the label node based on a preset database and the second-level node; A decision tree is obtained based on the root node, the second-level nodes, the third-level nodes and the fourth-level nodes.
3. The method according to claim 2, characterized in that The determining the fourth-level node under the third-level node based on the code file includes: In response to the presence of a global tag in the code file, using a tag value of the global tag as a fourth-level node under the tag node; In response to the existence of a form tag in the code file, the form ID and form fields corresponding to the form tag are used as fourth-level nodes under the model node, and the form fields are used as fourth-level nodes under the tag node; In response to the presence of a table tag in the code file, a table header description and a field identifier corresponding to the table tag are used as a fourth-level node under the model node, and the table header description is used as a fourth-level node under the tag node; In response to the existence of an additional tag in the code file, the Chinese description corresponding to the additional tag is used as a fourth-level node under the tag node.
4. The method according to claim 3, characterized in that The step of using the label value of the global label as a fourth-level node under the label node includes: In response to the presence of punctuation marks in the label value of the global label, performing regular expression segmentation on the label value to obtain sub-label values; Using the sub-label value as the fourth-level node under the label node; After describing the table header as a fourth-level node under the label node, the method further includes: In response to the existence of a form tag in the code file, the fourth-level tag corresponding to the form tag under the model node is moved to under the condition node as a fourth-level node under the condition node.
5. The method according to claim 1, characterized in that The determining the amount of knowledge data of the module node based on the node type, the decision tree, the code file and the database comprises: Determine a target data table based on the decision tree, the code file, and the database; The amount of knowledge data of the corresponding module node is determined based on the target data table and the node type.
6. The method according to claim 5, characterized in that The determining of the target data table based on the decision tree, the code file and the database includes: In response to the existence in the database of a table name of a data table that is consistent with the file identifier of the code file, determining whether a matching degree between the form ID in the decision tree and a field of the data table exceeds a preset matching threshold; If so, the data table is used as the target data table.
7. A large model prompt word intelligent routing device, characterized in that: The device comprises: A decision tree construction module is used to generate a decision tree based on code files and a preset database; A data volume calculation module, used to determine the node type of each module node under the condition node in the decision tree, and determine the knowledge data volume of the module node based on the node type, the decision tree, the code file and the database; A model processing module, configured to construct a first model based on the amount of knowledge data of the module node, and in response to the first model hitting a prompt word issued by a user, process the prompt word based on the first model; an access judgment module, configured to determine whether to use the prompt word to access the second model based on the prompt word and the label node in the decision tree in response to the first model not hitting the prompt word; Wherein, constructing a first model based on the amount of knowledge data of the module node includes: Determine the server corresponding to the module node based on the amount of knowledge data; Building a corresponding knowledge model based on the knowledge data volume of the module node, and deploying the knowledge model on a server corresponding to the module node; A first model is obtained based on the knowledge models on each server.
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.
Citation Information
Patent Citations
Method for protecting model privacy, data privacy and model consistency of decision tree model
CN117077038A
Methods and systems for automated generation of personalized messages
WO2018209254A1
Cited By
Bank intelligent customer service question answering method and system based on large model
CN120994786A