Customer service question and answer processing method and device
By building a customer service Q&A knowledge graph that includes entity, entity description and relationship description, combined with a hybrid search mechanism and a large language model, the problems of reply accuracy and completeness in the customer service Q&A scenario are solved, and absolute correlation and efficient response to the content of the source document are achieved.
Patent Information
- Application Number
- CN202510820526.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-07-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing customer service Q&A handling methods cannot meet the accuracy and completeness requirements of reply in strong structured and binding customer service Q&A scenarios, especially the answer content based on rules and regulations, user manuals and other documents cannot maintain a high degree of consistency with the source document, and cannot fully cover all operation steps.
Build a customer service question-and-answer knowledge graph, including entity, entity description, relationship and relationship description. The entity description adopts original text paragraphs, and the relationship reflects the document level. The target knowledge is retrieved from the knowledge graph through a hybrid search mechanism, and the answer is generated using a large language model.
It significantly improves the accuracy and completeness of the response of customer service Q&A scenarios, ensures the absolute correlation between the answer and the content of the source document, reduces the information redundancy and inference consumption of the answer generation model, and improves the response speed.
Smart Images

Figure CN120353902A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of knowledge graphs, and in particular, to a customer service question-answering processing method and device. Background Art
[0002] With the rapid development of AI (Artificial Intelligence) technology, especially LLM (Large Language Model), AI applications have emerged and been implemented in various fields. Among them, the AI customer service system is one of the important application directions. Compared with traditional human customer service, the AI customer service system has the advantages of 7×24-hour online service, support for multi-round conversations, effective reduction of labor costs, and significant improvement of service efficiency. It has been widely used in various scenarios such as e-commerce, banking and finance, healthcare, and enterprise internal support. The AI customer service system is an intelligent interaction system based on LLM, which can automatically handle user inquiries, provide after-sales support, and guide the completion of business processes. It uses the powerful capabilities of LLM to understand user intentions and generate accurate responses, and usually combines a knowledge base and retrieval-augmented generation techniques (including standard RAG technology and native GraphRAG technology) to achieve more efficient and accurate responses.
[0003] In the actual application of the AI customer service system, there is a specific type of customer service question-answering scenario, that is, the customer service question-answering scenario based on strongly structured and strongly constrained customer service question-answering knowledge documents (such as rules and regulations, user manuals, policy terms, etc.). Such documents usually have authority, and the generated response content should not be divergently expanded and must be highly consistent with the source document to meet the "accuracy" requirement and the "completeness" requirement. For example, for the user rights and interests document of a certain video website, when a user asks "how to withdraw cash", the system's answer should be strictly based on the clear regulations on the cash withdrawal operation steps in the user rights and interests document. The response content must be consistent with the relevant content of the document to avoid misleading the user, which is the "accuracy" requirement. At the same time, if there are multiple ways to withdraw cash and different ways correspond to different operation steps, the response needs to comprehensively cover all ways and their corresponding steps, which is the "completeness" requirement.
[0004] However, the existing customer service question-answering processing methods implemented by combining a knowledge base and retrieval-augmented generation techniques (including standard RAG technology and native GraphRAG technology) cannot meet the "accuracy" requirement and the "completeness" requirement when applied to the above specific type of customer service question-answering scenario.
[0005] Therefore, how to provide a customer service question-answering processing method to improve the response accuracy and completeness of a specific type of customer service question-answering scenario has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention
[0006] In view of the above problems, the present application provides a customer service question and answer processing method and device to achieve the purpose of improving the accuracy and integrity of responses in specific types of customer service question and answer scenarios. The specific solution is as follows:
[0007] In a first aspect of the present application, a customer service question and answer processing method is provided, including:
[0008] Obtain the user's question and a customer service question and answer knowledge graph, where the customer service question and answer knowledge graph contains multiple pieces of knowledge corresponding to customer service question and answer knowledge documents, and each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description; the entity is used to indicate a title in the customer service question and answer knowledge document, the entity description is used to indicate the original text paragraph content under the title, the relationship is used to indicate the hierarchical title subordination relationship path of the title, and the relationship description is used to indicate the explanation of the hierarchical title subordination relationship path of the title in natural language;
[0009] Retrieve the target knowledge corresponding to the question from the customer service question and answer knowledge graph;
[0010] Based on the question and the target knowledge, call an answer generation model to generate a final answer corresponding to the question, and the answer generation model is a large language model with text summarization ability obtained through training.
[0011] In a possible implementation, the construction method of the customer service question and answer knowledge graph includes:
[0012] Perform formatting processing on the customer service question and answer knowledge document to obtain a formatted customer service question and answer knowledge document;
[0013] Extract entities, entity descriptions, and relationships from the formatted customer service question and answer knowledge document according to the formatting information of the formatted customer service question and answer knowledge document, and generate relationship descriptions;
[0014] Construct the customer service question and answer knowledge graph based on the entities, the entity descriptions, the relationships, and the relationship descriptions.
[0015] In a possible implementation, the performing formatting processing on the customer service question and answer knowledge document to obtain a formatted customer service question and answer knowledge document includes:
[0016] Perform hierarchical title marking on the customer service question and answer knowledge document;
[0017] Based on the hierarchical title marking, determine the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title;
[0018] Format the customer service Q&A knowledge document based on the hierarchical tags corresponding to the headings of each paragraph and the hierarchical heading subordination relationship path of the corresponding headings, to obtain the formatted customer service Q&A knowledge document.
[0019] In a possible implementation, extracting entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generating relationship descriptions includes:
[0020] Obtain a preset extraction prompt word, which is used to instruct a large language model to extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generate relationship descriptions using its own natural language understanding and generation capabilities;
[0021] Input the preset extraction prompt word into the large language model to obtain the entities, the entity descriptions, the relationships, and the relationship descriptions output by the large language model.
[0022] In a possible implementation, the preset extraction prompt word is specifically used to instruct the large language model to extract each level of heading as an entity name, directly use the original text content under the corresponding heading as the entity description of the entity, extract relationships according to the hierarchical relationship between headings, and generate relationship descriptions using natural language understanding and generation capabilities.
[0023] In a possible implementation, retrieving the target knowledge corresponding to the question from the customer service Q&A knowledge graph includes:
[0024] Adopt a hybrid retrieval mechanism to retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph, and the hybrid retrieval mechanism includes vector retrieval and string matching retrieval.
[0025] A second aspect of the present application provides a customer service Q&A processing device, including:
[0026] An acquisition unit, configured to acquire a user's question and a customer service Q&A knowledge graph, where the customer service Q&A knowledge graph contains multiple knowledges corresponding to the customer service Q&A knowledge document, and each knowledge includes an entity, an entity description, a relationship, and a relationship description; the entity is used to indicate a heading in the customer service Q&A knowledge document, the entity description is used to indicate the original text paragraph content under the heading, the relationship is used to indicate the hierarchical heading subordination relationship path of the heading, and the relationship description is used to indicate an explanation of the hierarchical heading subordination relationship path of the heading in natural language;
[0027] A retrieval unit, configured to retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph;
[0028] An answer generation unit, configured to call an answer generation model based on the question and the target knowledge, and generate a final answer corresponding to the question, where the answer generation model is a large language model with text summarization ability obtained through training.
[0029] In a possible implementation, the apparatus further includes: a customer service Q&A knowledge graph construction unit;
[0030] The customer service Q&A knowledge graph construction unit includes:
[0031] A formatting processing unit, configured to perform formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document;
[0032] An extraction unit, configured to extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generate relationship descriptions;
[0033] A construction unit, configured to construct the customer service Q&A knowledge graph based on the entities, the entity descriptions, the relationships, and the relationship descriptions.
[0034] In a possible implementation, the formatting processing unit is specifically configured to:
[0035] Perform hierarchical heading marking on the customer service Q&A knowledge document;
[0036] Based on the hierarchical heading marking, determine the hierarchical marking of the corresponding headings of each paragraph and the hierarchical heading subordination relationship path of the corresponding headings;
[0037] Based on the hierarchical marking of the corresponding headings of each paragraph and the hierarchical heading subordination relationship path of the corresponding headings, perform formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document.
[0038] In a possible implementation, the extraction unit is specifically configured to:
[0039] Obtain a preset extraction prompt, where the preset extraction prompt is used to instruct a large language model to extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generate relationship descriptions by using its own natural language understanding and generation capabilities;
[0040] Input the preset extraction prompt into the large language model to obtain the entities, the entity descriptions, the relationships, and the relationship descriptions output by the large language model.
[0041] In a possible implementation, the preset extraction prompt words are specifically used to instruct the large language model to extract headings at all levels as entity names, directly use the original text content under the corresponding headings as the entity description of the entity, extract relationships according to the hierarchical relationships between the headings, and generate relationship descriptions by using natural language understanding and generation capabilities.
[0042] In a possible implementation, the retrieval unit is specifically used for:
[0043] Retrieving target knowledge corresponding to the question from the customer service Q&A knowledge graph by adopting a hybrid retrieval mechanism, where the hybrid retrieval mechanism includes vector retrieval and string matching retrieval.
[0044] The third aspect of the present application provides a computer program product, including computer-readable instructions, which, when running on an electronic device, enable the electronic device to implement the customer service Q&A processing method in the first aspect or any implementation manner of the first aspect.
[0045] The fourth aspect of the present application provides an electronic device, including at least one processor and a memory connected to the processor, where:
[0046] The memory is used to store a computer program;
[0047] The processor is used to execute the computer program so that the electronic device can implement the customer service Q&A processing method in the first aspect or any implementation manner of the first aspect.
[0048] The fifth aspect of the present application provides a computer-readable storage medium, which carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the customer service Q&A processing method in the first aspect or any implementation manner of the first aspect.
[0049] With the above technical solutions, a customer service question and answer processing method and device provided by this application pre-construct a customer service question and answer knowledge graph. The customer service question and answer knowledge graph contains multiple pieces of knowledge corresponding to customer service question and answer knowledge documents. Each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description. The entity is used to indicate a title in the customer service question and answer knowledge document. The entity description is used to indicate the original text paragraph content under the title. The relationship is used to indicate the hierarchical title subordination relationship path of the title. The relationship description is used to indicate the explanation of the hierarchical title subordination relationship path of the title in natural language. In this customer service question and answer knowledge graph, the entity description directly uses the original text paragraph, and the relationship reflects the true hierarchy of the document. Therefore, the constructed knowledge graph is more accurate and more in line with the actual application scenario. Therefore, after obtaining the user's question, all context information related to the user's question can be retrieved more accurately from this knowledge graph, thereby ensuring the absolute relevance of the final answer to the content of the source document and covering all aspects involved in the question, thus significantly improving the accuracy and integrity of the reply in specific types of customer service question and answer scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent. Throughout the accompanying drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and that the original elements and elements are not necessarily drawn to scale.
[0051] Figure 1 It is a schematic flowchart of a customer service question and answer processing method provided by an embodiment of this application;
[0052] Figure 2 It is a schematic structural diagram of a customer service question and answer processing device provided by an embodiment of this application;
[0053] Figure 3 It is a schematic structural diagram of an electronic device provided by an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0054] To facilitate the understanding of this application, the relevant technical terms of this application are first explained as follows:
[0055] LLM (Large Language Model): It refers to a natural language processing model based on deep learning technology and trained using large-scale corpus data. Such models can understand and generate natural language text by modeling the probability relationships between words, sentences, and contexts.
[0056] NLU (Natural Language Understanding): An important branch of Natural Language Processing (NLP), focusing on enabling computers to understand the meaning of human language. It involves analyzing the grammar, semantics, intent, and context of text and is a key technology for applications such as intelligent question answering, sentiment analysis, and machine translation. In this application, it refers to the ability of the LLM to analyze text and extract its deep meaning (such as entities, relationships, intent).
[0057] Standard RAG (Retrieval-Augmented Generation): A method that combines information retrieval and generative AI, aiming to improve the answer accuracy and knowledge coverage of the LLM. It enhances the model's answer ability by retrieving external data sources, avoiding the model relying solely on training data for answers, and is particularly suitable for scenarios with real-time updated knowledge or specific domain question answering.
[0058] Native GraphRAG: An optimized implementation framework based on the standard RAG technology, which introduces a Knowledge Graph to further improve the performance of RAG. Its core idea is to build a Knowledge Graph to better organize and understand the complex relationships in private data, so as to obtain more comprehensive and relevant context information in the retrieval stage, and ultimately improve the accuracy, comprehensiveness, and interpretability of the generated answers. Aimed at combining RAG and the Knowledge Graph to improve the performance of the LLM in handling complex question answering tasks, especially when dealing with private or unseen datasets. Traditional RAG methods may perform poorly when answering questions that require integrating multiple information fragments. To address this issue, Native GraphRAG uses the LLM to create a Knowledge Graph from the input corpus and combines the output of community summaries and graph machine learning to enhance the prompt during query, thus showing significant improvement in answering complex questions.
[0059] Knowledge Graph: A structured method of representing knowledge using "points" and "lines", where "points" are called entities, representing things (such as people, companies, products), and "lines" are called relationships, representing the connections between them (such as "Zhang San is Li Si's classmate"). It is like a huge "relationship network" that can help AI better understand and organize information and is widely used in search engines, question answering systems, and recommendation algorithms. In Native GraphRAG, the Knowledge Graph is used to organize complex text information, enabling AI to find relevant content more accurately and provide more comprehensive answers.
[0060] The embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application. The terms used in the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0061] The embodiments of the present application will be described below with reference to the accompanying drawings. Those of ordinary skill in the art will know that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
[0062] The terms "first", "second", etc. in the specification, claims and above-mentioned drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances, which is only a way of distinguishing objects with the same attributes when describing the embodiments of the present application. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product or device comprising a series of units does not have to be limited to those units, but may include other units not clearly listed or inherent to these processes, methods, products or devices.
[0063] With the rapid development of AI (Artificial Intelligence) technology, especially LLM (Large Language Model), AI applications have emerged and been implemented in various fields. Among them, the AI customer service system is one of the important application directions. Compared with traditional human customer service, the AI customer service system has the advantages of 7×24-hour online service, support for multi-round conversations, effective reduction of labor costs, and significant improvement of service efficiency, and has been widely used in various scenarios such as e-commerce, banking and finance, healthcare, and enterprise internal support. The AI customer service system is an intelligent interaction system based on LLM, which can automatically process user inquiries, provide after-sales support, and guide the completion of business processes. It uses the powerful capabilities of LLM to understand user intentions and generate accurate responses, and usually combines knowledge bases and retrieval-augmented generation technologies (including standard RAG technology and native GraphRAG technology) to achieve more efficient and accurate responses.
[0064] Among them, the process of the customer service question and answer processing method combining the knowledge base and RAG technology is roughly as follows:
[0065] Knowledge base construction stage:
[0066] Chunk the enterprise's private documents (such as product manuals, FAQs, policy documents, etc.), then convert these text chunks into vector representations, and store them in a vector database.
[0067] Question and answer processing stage:
[0068] When the user asks a question, the user's question is also converted into a vector representation and similarity retrieval (usually semantic similarity retrieval) is performed in the vector database to find the document chunks most relevant to the question. Subsequently, the retrieved relevant document chunks are used as context information (Context), which is combined with the user's original question to form a prompt and submitted to the LLM. The LLM utilizes its powerful natural language understanding (NLU) and generation capabilities to generate an answer to the user's question based on the provided context information.
[0069] The process flow of the customer service Q&A processing method combining the knowledge base and the native GraphRAG technology is roughly as follows:
[0070] Knowledge base construction phase:
[0071] Similarly, the private documents are chunked. Then, the LLM is used to analyze each document chunk to automatically extract the key entities (Entities) and the relationships (Relations) between them. Based on these extracted entities and relationships, a knowledge graph is constructed. Finally, the entity information is associated with the original document chunks, and this information (which may include text chunks, entity information, relationship information, and their vector representations) is stored in a specific storage system (the native GraphRAG may use a graph-structured storage such as LanceDB).
[0072] Q&A processing phase:
[0073] After the user asks a question, vector retrieval is also performed first to find the initially relevant document chunks. Then, the knowledge graph is used for extended retrieval: through the entities associated with the initial document chunks, other relevant entities and document chunks are searched along the relationship paths in the graph. This can discover more potentially relevant context information. Finally, all the retrieved relevant document chunks (possibly after screening and sorting) are used as context, which is combined with the user's question and submitted to the LLM for understanding, summarization, and answer generation.
[0074] In the actual application of an AI customer service system, there is a specific type of customer service Q&A scenario, namely, the customer service Q&A scenario based on highly structured and strongly restrictive customer service Q&A knowledge documents (such as regulations, user manuals, policy terms, etc.). Such documents usually have authority, and the response content generated based on them should not be divergently expanded and must be highly consistent with the source document to meet the requirements of "accuracy" and "completeness". For example, for the user rights and interests document of a certain video website, when a user asks "how to withdraw cash", the system's answer should be strictly based on the clear regulations on the cash withdrawal operation steps in the user rights and interests document. The response content must be consistent with the relevant content of the document to avoid misleading the user, which is the requirement of "accuracy". At the same time, if there are multiple ways to withdraw cash and different ways correspond to different operation steps, the response needs to comprehensively cover all ways and their corresponding steps, which is the requirement of "completeness".
[0075] However, the existing customer service Q&A processing methods implemented by combining knowledge bases and retrieval-augmented generation technologies (including standard RAG technology and native GraphRAG technology) cannot meet the requirements of "accuracy" and "completeness" when applied to the above specific type of customer service Q&A scenario. The specific reasons are as follows:
[0076] Standard RAG mainly relies on the semantic similarity between the user's question and the document chunks for retrieval. However, the expression of the user's question may not fully cover all the necessary information points related to its query intention. For example, when a user asks "I want to cancel my account", standard RAG may only retrieve the document fragment that directly describes the "cancellation operation steps". However, according to relevant regulations, a complete response may also need to inform the user of the conditions required to cancel the account, the irreversible consequences after cancellation, and potential legal risks, etc. Since these associated information may not be directly strongly related semantically to "how to cancel", relying solely on semantic retrieval may not guarantee the recall of all these necessary context information. As a result, although the response content addresses the user's question itself, it may lack the necessary associated information and is insufficient in terms of completeness.
[0077] When constructing a knowledge graph, native GraphRAG relies on the NLU ability of the LLM to freely extract entities and relationships from the text. Although this is an advantage when dealing with unstructured text, when dealing with highly structured and strongly restrictive documents (such as regulations, user manuals, policy terms, etc.), the free understanding of the LLM may generate unnecessary or inaccurate fine-grained entity relationships.
[0078] Taking the "Account Cancellation Rules" document as an example, it may contain clauses such as: "The account has no disputes: including disputes such as complaints, reports, being complained about, investigations, arbitrations, and litigations." This passage is essentially part of the "Cancellation Conditions". When the native GraphRAG processes it, it may use the NLU ability of the LLM to extract "disputes", "complaints", "being complained about", "investigations", etc. as independent entities and establish relationships such as "Complaints are a type of disputes". For the customer service Q&A scenario, this overly detailed and potentially structure-meaning-separated entity relationship division is not only unnecessary but may even introduce noise in the subsequent graph retrieval process. When the query involves "Cancellation Conditions", these fine-grained entity relationships with weak relevance to the core information may instead interfere with the retrieval process, resulting in inaccurate or incomplete retrieved context. This leads to a mismatch between the constructed knowledge graph and the actual application requirements of the document in the customer service scenario, affecting the accuracy of associated document retrieval during querying, being vulnerable to the "hallucinations" or understanding biases of the LLM itself, and thus affecting the accuracy and integrity of the final response.
[0079] It can be seen that the native GraphRAG framework performs poorly in processing such customer service Q&A scenarios. The main reason is that its design is more suitable for processing unstructured texts (such as novels, conversation records, etc.) that require strong semantic divergence and context reasoning capabilities. However, such customer service Q&A scenarios are usually based on highly structured and restrictive documents (such as regulations, operation manuals, etc.). The core requirements of such documents are high information consistency and comprehensive content coverage, and do not allow the "hallucinations" or information biases common in generative content.
[0080] To solve the above problems, the embodiments of the present application provide a customer service Q&A processing method. The customer service Q&A processing method of the embodiments of the present application will be introduced in detail below with reference to the accompanying drawings.
[0081] Refer to Figure 1 , Figure 1 which is a schematic flowchart of a customer service Q&A processing method provided by the embodiments of the present application. As Figure 1 shown, a customer service Q&A processing method provided by the embodiments of the present application may include the following steps, and these steps will be described in detail below.
[0082] S101: Obtain the user's question and the customer service Q&A knowledge graph. The customer service Q&A knowledge graph contains multiple pieces of knowledge corresponding to customer service Q&A knowledge documents. Each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description. The entity is used to indicate a title in the customer service Q&A knowledge document. The entity description is used to indicate the original text paragraph content under the title. The relationship is used to indicate the hierarchical title subordination relationship path of the title. The relationship description is used to indicate the explanation of the hierarchical title subordination relationship path of the title in natural language.
[0083] In the existing customer service Q&A knowledge graph, the entity, entity description, relationship, and relationship description are all obtained based on the natural language understanding ability of the LLM. Inevitably, due to the possible understanding deviation or hallucination of the LLM, there may be a deviation between the knowledge and the original document structure. In the customer service Q&A knowledge graph of this application, the entity description directly uses the original text paragraph, and the relationship reflects the true hierarchy of the document. Therefore, the constructed knowledge graph is more accurate and more suitable for the actual application scenario, so that all relevant context information related to the user's question can be retrieved more accurately during retrieval, thereby ensuring the absolute relevance of the final answer to the source document content and covering all aspects involved in the question, thus significantly improving the accuracy and integrity of the final Q&A response.
[0084] S102: Retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph.
[0085] S103: Based on the question and the target knowledge, call an answer generation model to generate a final answer corresponding to the question. The answer generation model is a large language model with text summarization ability obtained through training.
[0086] Considering that the entity description in the target knowledge is already equivalent to the original text paragraph, in this application, there is no need to separately collect and submit the original text paragraph, reducing the information redundancy submitted to the answer generation model, effectively reducing the Token consumption required for the answer generation model to reason, and improving the overall response speed of customer service Q&A processing.
[0087] A customer service question - answering processing method provided in this embodiment pre - constructs a customer service question - answering knowledge graph. The customer service question - answering knowledge graph contains multiple pieces of knowledge corresponding to customer service question - answering knowledge documents. Each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description. The entity is used to indicate a title in the customer service question - answering knowledge document. The entity description is used to indicate the original text paragraph content under the title. The relationship is used to indicate the hierarchical title subordination relationship path of the title. The relationship description is used to indicate the explanation of the hierarchical title subordination relationship path of the title in natural language. In this customer service question - answering knowledge graph, the entity description directly uses the original text paragraph, and the relationship reflects the true hierarchy of the document. Therefore, the constructed knowledge graph is more accurate and more in line with the actual application scenario. Thus, after obtaining the user's question, all context information related to the user's question can be retrieved more accurately from this knowledge graph, thereby ensuring the absolute relevance of the final answer to the content of the source document and covering all aspects involved in the question, and thus significantly improving the accuracy and integrity of the reply in specific types of customer service question - answering scenarios.
[0088] In another embodiment of the present application, the construction method of the customer service question - answering knowledge graph is introduced, which specifically includes the following steps:
[0089] S201: Perform formatting processing on the customer service question - answering knowledge document to obtain a formatted customer service question - answering knowledge document;
[0090] In the present application, the customer service question - answering knowledge document includes various knowledge documents (such as rules and regulations, user manuals, policy terms in Word, PDF, HTML formats, etc.) in the current customer service question - answering scenario, and this application does not make any limitations on this.
[0091] In a possible implementation, the formatted customer service question - answering knowledge document contains multiple data units. Each data unit contains a data unit identifier and text content. The data unit identifier contains the hierarchical mark of the corresponding title and the hierarchical title subordination relationship path of the corresponding title. The text content is the same as the original text content in the customer service question - answering knowledge document.
[0092] This step is the basis of the entire optimization. Subsequent entity - relationship extraction will mainly rely on the formatted information in the formatted customer service question - answering knowledge document rather than completely relying on the semantic understanding of the LLM. This significantly reduces the risk of extraction errors caused by LLM semantic understanding deviation or "hallucination", ensures a high degree of consistency between the extraction result and the original structure of the document, is particularly suitable for customer service question - answering knowledge documents with a rigorous structure, and makes the construction of the customer service question - answering knowledge graph more accurate, stable, and controllable.
[0093] S202: Extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generate relationship descriptions.
[0094] S203: Based on the entities, the entity descriptions, the relationships, and the relationship descriptions, construct the customer service Q&A knowledge graph.
[0095] In a possible implementation, the formatting the customer service Q&A knowledge document to obtain the formatted customer service Q&A knowledge document includes:
[0096] S2011: Perform hierarchical title marking on the customer service Q&A knowledge document;
[0097] Exemplarily, when performing hierarchical title marking on the customer service Q&A knowledge document, the " #" in the Markdown style can be used to mark the first-level main title, and " ## " to mark the second-level sub-title, and so on, to clarify the title hierarchical structure of the customer service Q&A knowledge document. It should be noted that the above " #" marking is only an example, and the specific marking form can be adjusted according to the actual situation.
[0098] S2012: Based on the hierarchical title marking, determine the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title;
[0099] Exemplarily, when determining the hierarchical title subordination relationship path of the corresponding title of each paragraph, for a certain paragraph, if its title is subordinate to a certain superior title, then in the identifier (or metadata) of this paragraph, use a specific delimiter (such as "|") to establish the subordination relationship path between its title and the corresponding superior title. For example, if the title of a certain paragraph belongs to the sub-chapter of "User Personal Information Transfer" under "Privacy Policy", the hierarchical title subordination relationship path of its corresponding title can be recorded as "Privacy Policy|User Personal Information Transfer". The source title and the target title can be respectively before and after the delimiter in the hierarchical title subordination relationship path, and the target title is subordinate to the source title.
[0100] It should be noted that the above specific delimiter (such as "|") is only an example, and the specific marking form can be adjusted according to the actual situation.
[0101] S2013: Based on the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title, format the customer service Q&A knowledge document to obtain the formatted customer service Q&A knowledge document.
[0102] In this application, each paragraph belonging to the same title can be merged into one data unit, and thus the formatted customer service Q&A knowledge document can be obtained.
[0103] For ease of understanding, an example of the original customer service Q&A knowledge document is provided in the embodiments of this application as follows:
[0104] Video Account Cancellation Agreement
[0105] Dear user, before you officially proceed with the next steps regarding the video account cancellation process, we would like to make the following special note for you: After canceling this video account, except as otherwise provided by laws and regulations, your personal information under this account will be deleted or anonymized, and the relevant products and services that were previously associated with this video account will no longer be associated. Once this video account is successfully canceled, it cannot be restored. Please operate with caution.
[0106] If you still decide to cancel this account after careful consideration, please be sure to first carefully read and fully understand this "Video Account Cancellation Agreement" ("this Agreement") and agree to all the contents of this Agreement. If you start the cancellation process according to our cancellation operation process, or if you check this cancellation agreement and start the next step of operation, it will be regarded as your agreement and compliance with all the contents of this Agreement.
[0107] If you need to use our services again after cancellation, you are welcome to register and log in again.
[0108] I. Consequences of Cancellation
[0109] You acknowledge and agree that after your video account is canceled, the following results (which may) occur, including but not limited to, and you need to bear them yourself:
[0110] 1. ×××××
[0111] 2. ×××××
[0112] 3. ×××××
[0113] II. Cancellation Conditions
[0114] Before you apply to us / continue to apply for canceling your account, to ensure the security of your account and related rights and interests, you need to first check and ensure that the account you apply to cancel has simultaneously met the following conditions, including but not limited to:
[0115] 1. ×××××
[0116] 2. ×××××
[0117] For the above issues, you can first try to handle them by yourself. If you are unable to handle them or have any doubts during the handling process, you can contact the customer service for assistance.
[0118] III. How to Cancel a Video Account?
[0119] 1. ×××××
[0120] 2.×××××
[0121] If there are reasonable grounds to suspect or discover that the same account has or may have repeatedly registered or cancelled accounts to obtain illegal benefits in marketing activities, or other illegal and irregular activities, we have the right to limit the frequency of cancellation applications for the account.
[0122] IV. Others
[0123] This Agreement is an integral part of the User Agreement. Any matters not covered in this Agreement shall be subject to the User Agreement. In the event of any inconsistency between this Agreement and the User Agreement, this Agreement shall prevail. At the same time, you acknowledge and agree that: Even if your video account is cancelled, it does not reduce or exempt you from the relevant responsibilities that you may need to bear in accordance with relevant laws and regulations, relevant agreements, rules, etc.
[0124] If you encounter any problems that you cannot handle during the account cancellation process or have any questions during the process, you can contact customer service for assistance. You can also send your questions to the email address (×××). We will review the issues involved as soon as possible and respond after verifying your user identity.
[0125] The formatted customer service question and answer knowledge document example obtained after formatting the above original customer service question and answer knowledge document example is as follows:
[0126] # Video Account Cancellation Protocol: Protocol for canceling video accounts
[0127] ## Introduction|Video Account Cancellation Agreement
[0128] Dear user, before you officially start the next step of the video account cancellation process, we first make the following special instructions for you: After canceling this video account, unless otherwise provided by laws and regulations, your personal information under the account will be deleted or anonymized, and the related products and services previously associated with the video account will no longer be associated. Once the video account is cancelled, it cannot be restored, so please operate with caution.
[0129] If you decide to cancel your account after careful consideration, please read and fully understand this "Video Account Cancellation Agreement" ("this Agreement") and agree to all the contents of this Agreement. If you start the cancellation process according to our cancellation operation process, or if you check this cancellation agreement and start the next step, you will be deemed to have agreed and complied with all the contents of this Agreement.
[0130] If you need to use our services again after logging out, you are welcome to register and log in again.
[0131] ## Cancellation Consequences|Video Account Cancellation Agreement
[0132] You acknowledge and agree that after the cancellation of your video account, the following consequences (which may include but are not limited to) will occur and you shall bear them by yourself:
[0133] 1. ×××××
[0134] 2. ×××××
[0135] 3. ×××××
[0136] ## Cancellation Conditions | Video Account Cancellation Agreement
[0137] Before you apply / continue to apply for the cancellation of your account, to ensure the security of your account and your relevant rights and interests, you need to first check and ensure that the account you apply for cancellation meets the following conditions simultaneously, which may include but are not limited to:
[0138] 1. ×××××
[0139] 2. ×××××
[0140] For the above problems, you can first try to handle them by yourself. If you are unable to handle them or have any doubts during the handling process, you can contact the customer service for assistance.
[0141] ## How to Cancel Video Account | Video Account Cancellation Agreement
[0142] 1. ×××××
[0143] 2. ×××××
[0144] If there are reasonable grounds to suspect or discover that the same account has or may have engaged in illegal and irregular activities such as repeated registration and cancellation to obtain illegal benefits in marketing activities, we have the right to restrict the frequency of cancellation applications for such account.
[0145] ## Others | Video Account Cancellation Agreement
[0146] This agreement is an integral part of the user agreement. Matters not covered by this agreement shall be governed by the user agreement. In case of any inconsistency between this agreement and the user agreement, this agreement shall prevail. At the same time, you acknowledge and agree that even if your video account is cancelled, it does not relieve or exempt you from the relevant responsibilities that you may need to bear in accordance with relevant laws, regulations, relevant agreements, rules, etc.
[0147] If you are unable to handle any problems during the account cancellation process or have any doubts during the handling process, you can contact the customer service for assistance. You can also send your questions to the email address (×××). We will review the issues involved as soon as possible and reply after verifying your user identity.
[0148] Among them, after formatting, the following content obtained from the customer service Q&A knowledge document example is a data unit:
[0149] "## Cancellation Consequences | Video Account Cancellation Agreement
[0150] You acknowledge and agree that: after your video account is cancelled, the following consequences (which may occur) will arise and you shall bear them on your own:
[0151] 1. ×××××
[0152] 2. ×××××
[0153] 3. ×××××";
[0154] Among them, "## Cancellation Consequences | Video Account Cancellation Agreement" is the data unit identifier, "## " is the hierarchical marker of the corresponding title, and "Cancellation Consequences | Video Account Cancellation Agreement" is the hierarchical title subordination path of the corresponding title. "You acknowledge and agree that: after your video account is cancelled, the following consequences (which may occur) will arise and you shall bear them on your own:
[0155] 1. ×××××
[0156] 2. ×××××
[0157] 3. ×××××" is the text content, which is consistent with the corresponding text content in the original customer service Q&A knowledge document without any deletion, modification or summary.
[0158] In a possible implementation, extracting entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document and generating relationship descriptions includes:
[0159] S2021: Obtain a preset extraction prompt word, which is used to instruct the LLM to extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generate relationship descriptions using its own natural language understanding and generation capabilities;
[0160] When initializing, native GraphRAG will generate a configuration file for calling the LLM for entity relationship extraction, which contains a system prompt. In this application, the system prompt of native GraphRAG can be obtained and modified to obtain the preset extraction prompt word. Among them, the core modification idea for modifying the system prompt of native GraphRAG is: instructing the LLM not to analyze and extract entities and relationships based on the free semantic understanding of the text content, but to strictly extract entities and relationships according to the formatting information of the formatted customer service Q&A knowledge document.
[0161] In a possible implementation, the preset extraction prompt words are specifically used to instruct the LLM to extract each level of headings as entity names, directly use the original text content under the corresponding headings as the entity descriptions of these entities, extract relationships based on the hierarchical relationships between the headings, and generate relationship descriptions by utilizing natural language understanding and generation capabilities.
[0162] In a possible implementation, the preset extraction prompt words may include the following rules:
[0163] Entity extraction rule: Instruct the LLM to extract each level of headings (such as the headings "Video Account Cancellation Agreement" and "Introduction" in the above example of the formatted customer service Q&A knowledge document) as entity names (Entity name);
[0164] Entity description extraction rule: Instruct the LLM to directly use the original text content under the corresponding headings as the entity descriptions (Entity Description) of these entities.
[0165] Relationship extraction rule: Instruct the LLM to extract relationships (Relation) based on the hierarchical relationships between the headings. For example, if "Introduction" is a sub-heading of "Video Account Cancellation Agreement", then extract the relationship where "Introduction" points to "Video Account Cancellation Agreement".
[0166] Relationship description generation: Retain and utilize the natural language understanding and generation capabilities of the LLM. After extracting the structure-based relationships, instruct the LLM to summarize and generate a natural language description (Relation Description) of this relationship based on the relevant text content (i.e., the descriptions of the parent entity and the child entity). For example, the relationship description where "Introduction" points to "Video Account Cancellation Agreement" is "The introduction is an overview of the Sohu Video account cancellation agreement".
[0167] For ease of understanding, the embodiments of this application disclose an example of preset extraction prompt words, which is specifically as follows:
[0168] "- Target -
[0169] Extract the entity and relationship lists of each knowledge point according to the given knowledge point document and entity and relationship definitions.
[0170] "- Steps -
[0171] 1. The given document has a unified format. Identify and extract each knowledge point as an entity and its relationships according to the corresponding format. The specific format is as follows
[0172] """
[0173] # $Knowledge point subject:$Subject description
[0174] ## $Knowledge Point Name|$Related Subject Name
[0175] $Knowledge Point Description
[0176] """
[0177] Format Instructions:
[0178] # As the subject identifier, followed by the name and description of a subject. The subject may not exist.
[0179] ## As the knowledge point identifier, followed by the knowledge points under this subject. The entire paragraph below ## is used as the description of this knowledge point and does not need to be segmented.
[0180] 2. Identify each entity and extract the following attributes for each identified entity:
[0181] - entity_name: The name of the entity. For an entity of type knowledge point, the name is the subject#knowledge point name of this knowledge point
[0182] - entity_type: The type of the entity
[0183] - entity_description: The description of the entity
[0184] Format each entity as ("entity"{tuple_delimiter}<entity_name>{tuple_delimiter}<entity_type>{tuple_delimiter}<entity_description>)
[0185] 3. Identify each pair of relationships and extract the following attributes for each identified relationship:
[0186] - source_entity: The name of the source entity, entity_name in Step 2
[0187] - target_entity: The name of the target entity, entity_name in Step 2
[0188] - relationship_description: Explain why you think the source entity and the target entity are related to each other.
[0189] - relationship_strength: A number indicating the strength of the relationship between the source entity and the target entity.
[0190] Format each pair of relationships into ("relationship"{tuple_delimiter}<source_entity>{tuple_delimiter}<target_entity>{tuple_delimiter}<relationship_description>{tuple_delimiter}<relationship_strength>)
[0191] 4. Strictly extract entities and relationships according to the given document, paying attention to distinguishing by identifiers, and do not generate entities and relationships that do not exist in the document (note that there may be cases where there is no subject, and in this case, do not generate a subject). As a single list of all entities and relationships identified in steps 2 and 3. Use {record_delimiter} as the list separator.
[0192] 5. Output to {completion_delimiter}
[0193] -Example-
[0194] Example 1: ××××
[0195] Example 2: ××××”.
[0196] In this application, when using the LLM for entity and relationship extraction, through this customized prompt, it mainly identifies and extracts entities and relationships based on the preset data format (rather than relying on its free natural language understanding ability). However, at the same time, the link of using the natural language ability of the LLM to generate descriptions of the extracted "relationships" is retained. It ensures that the extraction of entities, entity descriptions, and relationships themselves is based on clear format rules, guaranteeing its accuracy and controllability. At the same time, using the LLM to generate relationship descriptions retains the language ability advantages of the LLM, making the relationships easier to understand.
[0197] S2022: Input the preset extraction prompt into the LLM to obtain the entities, the entity descriptions, the relationships, and the relationship descriptions output by the LLM.
[0198] In one possible implementation, the retrieving the target knowledge corresponding to the question from the customer service Q&A knowledge graph includes:
[0199] Adopt a hybrid retrieval mechanism to retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph, and the hybrid retrieval mechanism includes vector retrieval and string matching retrieval.
[0200] The default storage backend of the native GraphRAG uses a vector database such as LanceDB, which only supports vector retrieval. In this application, the default storage backend can be replaced with a storage system that supports hybrid retrieval (such as Elasticsearch, or a solution that combines a vector database and a traditional retrieval engine) by modifying the GraphRAG source code or using the storage abstraction interface provided by it.
[0201] When storing data, not only the vector representation of the text (for semantic retrieval) is stored, but also keyword indexes are established (for string matching retrieval), especially indexing entity names (i.e., titles). And the retrieval logic is modified to execute a hybrid retrieval mechanism when receiving a user question.
[0202] In this application, the hybrid retrieval mechanism includes vector retrieval and string matching retrieval. Among them, vector retrieval refers to converting the user question into a vector and finding semantically similar entity descriptions or text segments in the storage. String match search refers to performing exact or fuzzy string matching on fields such as entity names (titles) using the keywords (or the entire question) in the user question.
[0203] Using the hybrid retrieval mechanism to retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph can be to merge the retrieval results of the above two retrieval methods, perform sorting and screening, and obtain the final target knowledge.
[0204] In this application, the hybrid retrieval mechanism can combine the advantages of semantic similarity and keyword exact matching. Vector retrieval is good at capturing semantic-level associations, while string matching is effective in scenarios such as title keywords, technical terms, and specific function names. For example, when a user asks "how to close an account", even if the document is expressed as "account cancellation", string matching can hit through the title, thereby improving the recall rate. This step can effectively expand the recall range of the retrieval and further improve the comprehensiveness and accuracy of the retrieval results.
[0205] The above introduced a customer service Q&A processing method provided by the embodiments of this application. Next, a device for executing the above customer service Q&A processing method will be introduced.
[0206] Please refer to Figure 2 , Figure 2 which is a schematic structural diagram of a customer service Q&A processing device provided by the embodiments of this application. As Figure 2 shown, the customer service Q&A processing device includes:
[0207] An acquisition unit 11 for acquiring a user's question and a customer service Q&A knowledge graph, where the customer service Q&A knowledge graph contains multiple pieces of knowledge corresponding to customer service Q&A knowledge documents, and each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description; the entity is used to indicate a title in the customer service Q&A knowledge document, the entity description is used to indicate the original text paragraph content under the title, the relationship is used to indicate the hierarchical title subordination relationship path of the title, and the relationship description is used to indicate an explanation of the hierarchical title subordination relationship path of the title in natural language.
[0208] A retrieval unit 12 for retrieving target knowledge corresponding to the question from the customer service Q&A knowledge graph.
[0209] An answer generation unit 13 for generating a final answer corresponding to the question based on the question and the target knowledge by invoking an answer generation model, where the answer generation model is a large language model with text summarization ability obtained through training.
[0210] In a possible implementation, the device further includes: a customer service Q&A knowledge graph construction unit;
[0211] The customer service Q&A knowledge graph construction unit includes:
[0212] A formatting processing unit for performing formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document;
[0213] An extraction unit for extracting entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generating relationship descriptions;
[0214] A construction unit for constructing the customer service Q&A knowledge graph based on the entity, the entity description, the relationship, and the relationship description.
[0215] In a possible implementation, the formatting processing unit is specifically used for:
[0216] Performing hierarchical title marking on the customer service Q&A knowledge document;
[0217] Based on the hierarchical title marking, determining the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title;
[0218] Based on the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title, performing formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document.
[0219] In a possible implementation, the extraction unit is specifically configured to:
[0220] Obtain a preset extraction prompt word, which is used to instruct the large language model to extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and generate relationship descriptions using its own natural language understanding and generation capabilities;
[0221] Input the preset extraction prompt word into the large language model to obtain the entities, the entity descriptions, the relationships, and the relationship descriptions output by the large language model.
[0222] In a possible implementation, the preset extraction prompt word is specifically used to instruct the large language model to extract the headings at all levels as entity names, directly use the original text content under the corresponding headings as the entity descriptions of the entities, extract relationships according to the hierarchical relationships between the headings, and generate relationship descriptions using natural language understanding and generation capabilities.
[0223] In a possible implementation, the retrieval unit is specifically configured to:
[0224] Adopt a hybrid retrieval mechanism to retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph, and the hybrid retrieval mechanism includes vector retrieval and string matching retrieval.
[0225] An electronic device is also provided in an embodiment of the present application. Refer to Figure 3 As shown, it shows a schematic structural diagram of an electronic device suitable for implementing the electronic device in an embodiment of the present application. The electronic device in an embodiment of the present application may include, but is not limited to, fixed terminals such as mobile phones, laptop computers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), desktop computers, and the like. Figure 3 The electronic device shown is only an example and should not bring any limitations to the functions and usage scopes of the embodiments of the present application.
[0226] As Figure 3 shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 into the random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0227] Typically, the following devices can be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 can allow the electronic device to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 3 an electronic device with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices can be implemented or had.
[0228] An embodiment of the present application also provides a computer program product including computer-readable instructions, which, when running on an electronic device, enable the electronic device to implement any one of the customer service question-and-answer processing methods provided by the embodiments of the present application.
[0229] An embodiment of the present application also provides a computer-readable storage medium carrying one or more computer programs, which, when executed by an electronic device, can enable the electronic device to implement any one of the customer service question-and-answer processing methods provided by the embodiments of the present application.
[0230] In addition, it should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that they have a communication connection, which can be specifically implemented as one or more communication buses or signal lines.
[0231] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions accomplished by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be various, such as analog circuits, digital circuits or dedicated circuits, etc. However, for the present application, in more cases, software program implementation is a better embodiment. Based on such understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a readable storage medium, such as a floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disc of a computer, etc., and includes several instructions for causing a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in various embodiments of the present application.
[0232] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0233] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general computer, a dedicated computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center to another website, a computer, a training device or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device or a data center that includes one or more integrated available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
Claims
1. A customer service question and answer processing method, characterized in that, Including: Obtain the user's question and the customer service Q&A knowledge graph. The customer service Q&A knowledge graph contains multiple pieces of knowledge corresponding to the customer service Q&A knowledge documents. Each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description. The entity is used to indicate a title in the customer service Q&A knowledge document. The entity description is used to indicate the original text paragraph content under the title. The relationship is used to indicate the hierarchical title subordination relationship path of the title. The relationship description is used to indicate the explanation of the hierarchical title subordination relationship path of the title in natural language. Retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph. Based on the question and the target knowledge, call an answer generation model to generate the final answer corresponding to the question. The answer generation model is a large language model with text summarization ability obtained through training.
2. The method according to claim 1, wherein The construction method of the customer service Q&A knowledge graph includes: Perform formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document. According to the formatting information of the formatted customer service Q&A knowledge document, extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document, and generate relationship descriptions. Based on the entity, the entity description, the relationship, and the relationship description, construct the customer service Q&A knowledge graph.
3. The method according to claim 2, characterized in that, The performing formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document includes: Perform hierarchical title marking on the customer service Q&A knowledge document. Based on the hierarchical title marking, determine the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title. Based on the hierarchical marking of the corresponding title of each paragraph and the hierarchical title subordination relationship path of the corresponding title, perform formatting processing on the customer service Q&A knowledge document to obtain a formatted customer service Q&A knowledge document.
4. The method according to claim 2, wherein The extracting entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document and generating relationship descriptions includes: Obtain a preset extraction prompt. The preset extraction prompt is used to instruct the large language model to extract entities, entity descriptions, and relationships from the formatted customer service Q&A knowledge document according to the formatting information of the formatted customer service Q&A knowledge document, and use its natural language understanding and generation ability to generate relationship descriptions. Input the preset extraction prompt into the large language model to obtain the entities, the entity descriptions, the relationships, and the relationship descriptions output by the large language model.
5. The method according to claim 4, characterized in that The preset extraction prompt is specifically used to instruct the large language model to extract each level of title as the entity name, directly use the original text content under the corresponding title as the entity description of the entity, extract relationships according to the hierarchical relationship between titles, and use natural language understanding and generation ability to generate relationship descriptions.
6. The method according to claim 1, wherein The retrieving the target knowledge corresponding to the question from the customer service Q&A knowledge graph includes: Retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph by using a hybrid retrieval mechanism, where the hybrid retrieval mechanism includes vector retrieval and string matching retrieval.
7. A customer service question and answer processing device, characterized in that, Comprising: An acquisition unit, configured to acquire a user's question and a customer service Q&A knowledge graph, where the customer service Q&A knowledge graph contains multiple pieces of knowledge corresponding to customer service Q&A knowledge documents, and each piece of knowledge includes an entity, an entity description, a relationship, and a relationship description; the entity is used to indicate a title in the customer service Q&A knowledge document, the entity description is used to indicate the original text paragraph content under the title, the relationship is used to indicate the hierarchical title subordination relationship path of the title, and the relationship description is used to indicate the explanation of the hierarchical title subordination relationship path of the title in natural language; A retrieval unit, configured to retrieve the target knowledge corresponding to the question from the customer service Q&A knowledge graph; An answer generation unit, configured to, based on the question and the target knowledge, call an answer generation model to generate a final answer corresponding to the question, where the answer generation model is a large language model with text summarization ability obtained through training.
8. A computer program product, characterized in that, Comprising computer-readable instructions, when the computer-readable instructions run on an electronic device, enabling the electronic device to implement the customer service Q&A processing method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, Comprising at least one processor and a memory connected to the processor, where: The memory is used to store a computer program; The processor is configured to execute the computer program so that the electronic device can implement the customer service Q&A processing method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can be enabled to implement the customer service Q&A processing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Construction method, system and equipment of power dispatching knowledge question-answering system and storage medium
CN119311826A
Knowledge graph open domain construction and RAG question and answer method and device and storage medium
CN119416882A
Multi-document question and answer method and device based on multi-head self-attention and hierarchical enhancement
CN119537559A
Aviation standard question and answer optimization method and system based on atlas and document data
CN119621894A
Vertical domain question answering system and method based on knowledge graph and large language model
CN119646129A
Cited By
Method and device for generating contract knowledge graph
CN121119095A