An intelligent processing method for express work orders based on RAG
Through the RAG-based method, the user's question vector is vectorized and stored in the vector database. Combined with the large model's quadratic intent recognition, the problem of excessive context semantic understanding and computing resource consumption in express work order processing is solved, and efficient and accurate work order processing is achieved.
Patent Information
- Application Number
- CN202411839961.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-04
AI Technical Summary
When the existing express delivery ticket processing system faces changes in user needs, the keyword matching cannot understand the context semantics, and the calculation resources consumed by large-scale models, resulting in high misjudgment or misjudgment rates and an increase in hardware costs.
Using a RAG-based method, the user's question vector is vectorized and stored in the vector database through the data preparation stage. Vector search and large-model quadratic intent recognition are used to solve the problem of context semantics understanding and reduce the consumption of computing resources.
It improves the accuracy and efficiency of work order processing, reduces misjudgment and misjudgment, reduces computing resource consumption, and improves system performance.
Smart Images

Figure CN119762185A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of intelligent processing of work orders, and in particular relates to an intelligent processing method for express work orders based on RAG. Background Art
[0002] In the express delivery business, after an e-commerce merchant mails a package, the package needs to be intercepted and processed because of changes in the buyer's needs (change of delivery address / return of order). Faced with the huge volume of express packages and a large group of merchants, and considering the quality of user service, many express delivery companies have launched conversational chat-style customer service work order processing IT systems. There are currently two common methods for identifying user question intentions: keyword matching and keyword matching based on large models.
[0003] For the keyword matching solution, the coverage of preset keywords is insufficient and the context semantics cannot be understood. For keyword matching based on large models, the high requirements of large models for computing resources will lead to an increase in hardware costs. Both have certain disadvantages. Therefore, the following solutions are proposed to address the above problems. Summary of the invention
[0004] The purpose of the present invention is to provide an intelligent processing method for express work orders based on RAG, which replaces keyword matching by RAG, thereby solving the problems of context semantic understanding and misjudgment or missed judgment in existing keyword matching.
[0005] To solve the above technical problems, the present invention is achieved through the following technical solutions:
[0006] The present invention is a RAG-based express work order intelligent processing method, the processing method comprising:
[0007] Step S1, data preparation;
[0008] Step S2, user question processing;
[0009] The process of processing the user's question in step S2 is as follows:
[0010] Step S21, user question formatting: When a user asks a new question, the system first identifies the waybill number part of the question, replaces the waybill number with the unified waybill number used in the data preparation stage, and obtains the formatted question;
[0011] Step S22, vector search: vectorize the formatted user question to obtain a vector representation, conduct a search operation in the vector database, and calculate the similarity between the user question vector and the vector stored in the database;
[0012] Step S23, determine the similarity of the search results: suppose that the similarity value of the data with the greatest similarity is greater than or equal to the threshold value, and the user's question is likely to be intended to perform operations related to order number interception, and enter the next step of large model secondary intention recognition. Suppose that the similarity value of the data with the greatest similarity is lower than the threshold value. After vectorized search, the similarity with the vector in the database is very low. At this time, it is determined that the user's question does not involve any work order processing logic, and the process ends;
[0013] Step S24, performing secondary intent recognition of a large model when the vector search hits;
[0014] Step S25: interception processing.
[0015] Furthermore, in the step S22, vector search, the specific formula for text vectorization is as follows:
[0016] Suppose there are two texts C0 and C1. First, we need to convert them into vector representations. Let the vocabulary be K = {ε1,ε2,…,ε n}, where ε i Represents the i-th word in the vocabulary. For text C0, its vector is represented as where a i Represents the word ε i The number of times text C1 appears in text C0 is represented by the vector where b i Represents the word ε i The number of times it appears in text C1.
[0017] Furthermore, in the step S22, vector search, the specific formula for calculating the similarity between the user question vector and the vector stored in the database is as follows:
[0018] Two vectors and The similarity cos(α) is: in, is a vector and The inner product of is calculated as: and They are and The modulus is calculated as: The final calculated cos(α) value is the similarity between texts C0 and C1, and its value range is between [0, 1]. When cos(α) = 1, it means that the two texts are completely similar. When cos(α) = 0, it means that the two texts have no obvious similarity. The closer the cos(α) value is to 1, the higher the text similarity is, and the closer the cos(α) value is to 0, the lower the similarity is.
[0019] Furthermore, the specific process of step S1, data preparation is as follows:
[0020] Step S11, collecting and arranging historical data: obtaining previous user question records from the express delivery service system, the records cover various issues related to express delivery work orders, and classifying and arranging these historical data according to different business types;
[0021] Step S12: uniformly formatting the waybill number: for all collected questions containing waybill numbers, the waybill numbers therein are uniformly replaced with a hypothetical waybill number. This step is used to eliminate the differences in semantic understanding that may be caused by different actual waybill numbers;
[0022] Step S13, training the Word2Vec model: a large amount of text data related to express delivery services is collected as a corpus, and the open source Word2Vec tool is used for training. Relevant parameters are set during the training process. After the training is completed, a Word2Vec model containing words related to express delivery services and their corresponding word vectors is obtained, and each word is mapped to a 200-dimensional vector;
[0023] Step S14, text vectorization processing: for each question sentence that has been uniformly formatted with the waybill number, a vectorization operation is performed, and finally a text vector with the same dimension of 200 is obtained as the vector representation of the question sentence, which is used for subsequent storage and similarity calculation operations;
[0024] Step S15, data storage into vector database: the vectorized results are stored together with the corresponding operation types and classification labels into the vector database. Thus, a series of vector data with semantic information and business type identifiers are stored in the vector database, providing a data basis for subsequent user question processing.
[0025] Furthermore, the specific process of step S24, performing large model secondary intent recognition when the vector search hits, is as follows:
[0026] Step S241, select a suitable large model and design a callback function. The specific process is as follows:
[0027] Identify user's question intention → change recipient information → return the package to the original address → consult marketing activities → cancel package interception;
[0028] Submit the user's question content with the defined function to the big model;
[0029] Step S242: Analyze the results returned by the large model.
[0030] Furthermore, the specific process of step S25, interception processing, is as follows:
[0031] When the large model's secondary intention recognition successfully determines the interception intention, the system obtains the relevant interception information, calls the downstream system interface, and passes the interception information to the corresponding express processing system module. The system will perform corresponding interception operations on the express package according to the instructions, thereby completing the user's interception express request.
[0032] Furthermore, the specific process of step S242, analyzing the results returned by the large model, is as follows:
[0033] When only one of the result parameters returned by the large model is True and the others are False, it indicates that the intent recognition is successful. The downstream system interface can be called to perform corresponding operations based on the user's intent. When multiple parameter results are True in the returned results, it indicates that the recognition has failed and the recognition process ends. The user can be prompted to confirm the result again through a pop-up selection box or a text reply.
[0034] The present invention has the following beneficial effects:
[0035] 1. The present invention uses the rag method to replace keyword matching, which solves the problems of contextual semantic understanding and misjudgment or missed judgment in keyword matching. Specifically, when preparing data, common user questions are vectorized and stored to build a semantic information library. When processing user questions, the order number is first formatted to focus on the intention, and then vector search is performed based on semantic similarity. Finally, the large model is analyzed again. This method overcomes the limitation that keyword matching relies only on preset words, and can understand contextual semantics. For example, various related expressions of "intercept order number" can also be accurately judged, and misjudgment and missed judgment caused by inappropriate keyword range are avoided, greatly improving the accuracy and efficiency of work order processing.
[0036] 2. The present invention uses a vector database for semantic search, avoiding the problem of excessive consumption of computing resources caused by directly using a large model. Specifically, in the data preparation stage, various formatted user questions are vectorized and stored in the vector database. When processing new user questions, they are first vectorized and then searched in the vector database. This process uses the cosine similarity between vectors to quickly locate similar questions, such as quickly finding vectors related to the "interception order number". Compared with directly using a large model to process all questions, the amount of calculation is greatly reduced, the problem of excessive resource consumption is avoided, and the system can efficiently process work orders, while ensuring accuracy and improving overall performance.
[0037] Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0039] Figure 1 A schematic diagram of a flow chart of an intelligent processing method for express work orders based on RAG of the present invention;
[0040] Figure 2 A schematic diagram of the user's question execution flow of the present invention;
[0041] Figure 3 This is a schematic diagram of the large model secondary intention recognition process of the present invention. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] See also Figure 1-3 As shown, the present invention is a method for intelligently processing express work orders based on RAG, comprising:
[0044] Step S1: Data preparation:
[0045] Step S11, collecting and arranging historical data: obtaining previous user question records from the express delivery service system, which covers various issues related to express delivery work orders, such as interception number questions (including questions with different intentions such as return and redirection), track query, customer complaints, etc. For example, the collected questions include "YT1234567 interception", "intercept YT1234567", "YT1234567 address changed to No. XX, Qingpu District, Shanghai", "check the status of YT1234567", "YT1234567 recipient said it was damaged and compensation is required", etc. These historical data are classified and sorted, and they are classified according to different business types, such as questions involving interception of order numbers and the intention of return are classified as "package interception-return" category, questions involving address modification are classified as "package interception-redirection" category, inquiries about order number status are classified as "track query" category, complaints are classified as "customer complaints", etc.;
[0046] Step S12: Unified formatting of waybill numbers: For all collected questions containing waybill numbers, the waybill numbers are uniformly replaced with a hypothetical waybill number (e.g., YT1234567). The purpose of this step is to eliminate the differences in semantic understanding that may be caused by different actual waybill numbers, so that subsequent vectorization and semantic analysis can focus more on the core intent of the question rather than being disturbed by different waybill numbers.
[0047] Step S13, training Word2Vec model: collect a large amount of text data related to express delivery service (including various user question records, express delivery service descriptions, etc.) as a corpus, and use the open source Word2Vec tool (such as the Word2Vec implementation provided by the gens im library in Python) for training. During the training process, set relevant parameters, such as word vector dimension (usually can be set to 100-300 dimensions, etc., here it is assumed to be set to 200 dimensions), window size (indicating the maximum distance between the current word and the predicted word in the sentence, for example, set to 5), minimum word frequency (filter out words that appear too low in the corpus, for example, set to 5 times), etc. After completing the training, a Word2Vec model containing words related to express delivery service and their corresponding word vectors is obtained, and each word is mapped to a 200-dimensional vector;
[0048] Step S14, text vectorization processing: For each user question sentence to be vectorized after the unified formatting of the waybill number (for example, "YT1234567 intercept"), perform simple text cleaning, remove punctuation marks, special characters, etc. (if any), segment the text by word, and obtain a word list, such as ["YT1234567", "carry out", "intercept"], traverse the segmented word list, input each word into the pre-trained Word2Vec model, and obtain its corresponding word vector. For example, the word vector corresponding to the word "carry out" may be a 20 0-dimensional vector, in the form of [0.12, -0.34, 0.56, …, 0.89], is performed for each word in the sentence. The average pooling method is used to combine these word vectors to obtain the vector representation of the text, that is, the values of the corresponding dimensions of the word vectors of all words are averaged. For example, the values of each dimension of the word vector of "YT1234567" are added to the corresponding dimension values of the word vectors of "conduct" and "intercept" and then divided by the number of words (here is 3 words). Finally, a text vector of the same 200 dimensions is obtained as the vector representation of the question sentence, which is used for subsequent storage and similarity calculation operations;
[0049] Step S15, storing data in a vector database: storing the vectorized result together with the corresponding operation type (such as "return", "address change", etc.) and classification label (such as "package interception - return", etc.) in the vector database. In this way, a series of vector data with semantic information and business type identification is stored in the vector database, providing a data basis for subsequent user question processing;
[0050] Step S2: User question processing:
[0051] Step S21, user question formatting: When the user asks a new question, such as "I want to intercept wanted YT2193847", the system first identifies the waybill number part (YT2193847), replaces the waybill number with the unified waybill number used in the data preparation stage (YT1234567), and obtains the formatted question "I want to intercept wanted YT1234567". This step ensures that the user's question is consistent with the previously prepared data in terms of the waybill number, reducing the semantic understanding deviation that may be caused by the difference in the waybill number;
[0052] Step S22, vector search: perform text vectorization on the formatted user question "I want to intercept wanted YT1234567" (also use the Word2Vec model as described above to obtain the vector representation), obtain a vector representation, perform a search operation in the vector database, and calculate the similarity between the user question vector and the vector stored in the database, specifically:
[0053] Assume that the user's question text vector is A text vector in the vector database is Then the two vectors and The similarity is in, is a vector and The inner product of and They are and The modulus of cos(α), the closer the value is to 1, the higher the text similarity is, and the closer it is to 0, the lower the similarity is;
[0054] For example, if there are multiple text vectors in the vector database, the user's question text vector needs to calculate similarity with multiple text vectors in the database respectively, obtain multiple calculation results, and then return several calculation result data, including the similarity value between each data and the user's question;
[0055] Step S23, determine the similarity in the search results: if the calculated similarity value of the data with the largest similarity is greater than or equal to 0.3 (the threshold value can be adjusted according to the actual data quality), it is considered that the user's question is likely to be intended to perform operations related to the order number interception, and enter the next step of large model secondary intention recognition. For example, if the returned data is "YT1234567 for interception", its similarity reaches 0.4, which meets the conditions. If the similarity value of the data with the largest similarity is lower than 0.3, for example, the user asks "How is the weather today?" After vectorized search, the similarity with the vectors in the database is very low, such as the highest similarity is 0.2. At this time, it is determined that the user's question does not involve any work order processing logic, and the process ends;
[0056] Step S24: Perform secondary intent recognition with a large model when the vector search hits:
[0057] Step S241, select a suitable large model and design a callback function. The specific process is as follows:
[0058] Identify user's question intention → change recipient information → return the package to the original address → consult marketing activities → cancel package interception;
[0059] Submit the user's question (such as "I want to intercept the wanted YT1234567") with the defined function to the big model;
[0060] Step S242: Analyze the results returned by the large model:
[0061] If only one of the result parameters returned by the large model is True and the others are False, it indicates that the intention recognition is successful and the user intends to return the package to the original address. The downstream system interface can be called based on this result to perform corresponding interception operations;
[0062] If multiple parameters in the returned result are True, it indicates that the recognition has failed (the intent cannot be accurately recognized), and the recognition process ends. The user can be prompted to confirm the result again through a pop-up selection box (e.g., a box containing possible intent options pops up on the interface of the customer service ticket processing system to let the user select the correct intent) or a text reply (e.g., informing the user that the system cannot accurately understand their intent and asks them to restate it or select a relevant option);
[0063] Step S25, interception processing (when the large model secondary intention recognition is successful and determined to be an interception intention):
[0064] When the large model's secondary intention recognition successfully determines the interception intention, the system obtains relevant interception information, such as the order number, interception type (return or change of address, etc.), calls the downstream system interface, and passes the interception information to the corresponding express processing system module. For example, the order number and the "return" instruction are sent to the express package interception system. The system will perform corresponding interception operations on the express package according to the instructions, such as notifying the courier to stop delivery and arrange for the package to be returned to the sending address or change the receiving address, etc., thereby completing the user's interception express request.
[0065] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0066] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A RAG-based express work order intelligent processing method, characterized by: The processing method comprises: Step S1, data preparation; Step S2: User question processing. The specific steps are as follows: Step S21, user question formatting: When a user asks a new question, the system first identifies the waybill number part of the question, replaces the waybill number with the unified waybill number used in the data preparation stage, and obtains the formatted question; Step S22, vector search: vectorize the formatted user question to obtain a vector representation, conduct a search operation in the vector database, and calculate the similarity between the user question vector and the vector stored in the database; Step S23, determine the similarity in the search results: suppose the similarity value of the data with the greatest similarity is greater than or equal to the threshold value, and the user's question this time is to perform operations related to order number interception, and enter the next step of large model secondary intention recognition. Suppose the similarity value of the data with the greatest similarity is lower than the threshold value. After vectorized search, the similarity with the vector in the database is low. At this time, it is determined that the user's question does not involve any work order processing logic, and the process ends; Step S24, performing secondary intent recognition of a large model when the vector search hits; Step S25: interception processing.
2. According to claim 1, a RAG-based express work order intelligent processing method is characterized in that: In the step S22, vector search, the specific formula for calculating the similarity between the user question vector and the vector stored in the database is as follows: Two vectors and The similarity cos(α) is: in, is a vector and The inner product of is calculated as: and They are and The modulus is calculated as: The final calculated cos(α) value is the similarity between texts C0 and C1.
3. According to claim 1, a RAG-based express work order intelligent processing method is characterized in that: The specific process of step S1, data preparation is as follows: Step S11, collecting and organizing historical data: obtaining previous user question records from the express delivery service system, the records cover the problems of express delivery work orders, classifying and organizing the historical records, and classifying them according to different business types; Step S12, unified formatting of waybill numbers: for all collected questions containing waybill numbers, the waybill numbers therein are uniformly replaced with a hypothetical waybill number; Step S13, training the Word2Vec model: collecting text data related to express delivery services as a corpus, using the open source Word2Vec tool for training, setting relevant parameters during the training process, and after the training is completed, obtaining a Word2Vec model containing express delivery service-related words and their corresponding word vectors, where each word is mapped to a 200-dimensional vector; Step S14, text vectorization processing: for each question sentence that has been uniformly formatted with the waybill number, a vectorization operation is performed, and finally a text vector with the same dimension of 200 is obtained as the vector representation of the question sentence; Step S15, storing data in a vector database: storing the vectorized result together with the operation type and the classification label in the vector database.
4. According to the RAG-based express work order intelligent processing method of claim 1, it is characterized in that: The specific process of step S24, performing large model secondary intent recognition when the vector search hits, is as follows: Step S241, select a suitable large model and design a callback function. The specific process is as follows: Identify user's question intention → change recipient information → return the package to the original address → consult marketing activities → cancel package interception; Submit the user's question content with the defined function to the big model; Step S242: Analyze the results returned by the large model.
5. According to the RAG-based express work order intelligent processing method of claim 1, it is characterized in that: The specific process of step S25, interception processing is as follows: When the large model's secondary intention recognition successfully determines the interception intention, the system obtains the relevant interception information, calls the downstream system interface, and passes the interception information to the express processing system module. The system performs corresponding interception operations on the express package according to the instructions to complete the user's interception express request.
6. According to claim 5, a RAG-based express work order intelligent processing method is characterized in that: The specific process of step S242, analyzing the results returned by the large model, is as follows: When only one of the result parameters returned by the large model is True and the others are False, it indicates that the intent recognition is successful. The downstream system interface is called according to the user's intent. When multiple parameter results in the returned result are True, it indicates that the recognition has failed and the recognition process ends. The user is prompted to confirm the result again through a pop-up selection box or text reply.
Citation Information
Cited By
BERT order dispatching model training method and device based on multi-factor decision, and medium
CN122264352A
BERT-based order assignment model training method and device based on multi-factor decision and medium
CN122264352B