User question answering method and apparatus, device, and medium

By constructing inductive and practical prompt documents and rewriting user questions using a large language model to recall relevant answer knowledge fragments, the problems of prompt length exceeding the limit and poor semantic matching in multi-turn dialogues of e-commerce platform customer service robots are solved, and more accurate multi-turn dialogue responses are achieved.

CN117251547BActive Publication Date: 2025-12-19BUSINESS LINE COMMERCIAL PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311280817.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-12-19
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

Existing multi-turn dialogue technologies based on large language models have problems in e-commerce platform customer service robots, such as prompt length exceeding the system's preset limit and poor semantic matching, resulting in an inability to effectively answer user questions.

Method used

By constructing a prompt document, using a large language model to rewrite the user's latest question to generate a semantically complete and standardized question, and recalling the answer knowledge fragments that match the initial response text, a practical prompt document is constructed, and finally, an accurate and practical response text is generated.

Benefits of technology

It effectively solves the problem of input length limitation of large language models in multi-turn dialogues, ensuring that customer service robots can accurately answer user questions, maintain the coherence of dialogue context, and improve the accuracy and efficiency of responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117251547B_ABST
    Figure CN117251547B_ABST
Patent Text Reader

Abstract

The application relates to a user question answering method and device, equipment and medium, the method comprising: constructing an induction prompt document based on the historical chat record between the current user and the customer service robot and the user's latest question; calling a large language model, inputting the induction prompt document, and obtaining a user standard question and a preliminary reply text which restate the user's latest question and make the semantics complete and self-consistent; recalling a plurality of answer knowledge segments matched in semantics according to the preliminary reply text, and constructing a practical prompt document in combination with the user standard question; calling the large language model, inputting the practical prompt document, and obtaining a practical reply text for answering. The application utilizes the semantic correlation between the historical chat record in the multi-round dialogue and the original user's latest question, more accurately hits the answer knowledge segment related to the semantic of the user's latest question, and helps the large language model to efficiently generate an accurate practical reply text to complete the customer service answering.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of e-commerce information, in particular to a user question answering method and device, equipment and medium. BACKGROUND

[0002] An e-commerce platform usually has a corresponding customer service support system for providing customer service robots to answer user questions through the customer service robots. A document question answering system is a kind of customer service support system, which is a kind of artificial intelligence system based on a large language model (LLM, Large Language Model) and can give an answer to a question in natural language according to a given document and question.

[0003] The document question answering system based on the large language model mainly adopts a two-stage form for reasoning:

[0004] 1. Recall: Given a user question (query), a vector encoding model is called to generate a semantic vector, and then a plurality of relevant passages are retrieved from a document library through vector similarity matching;

[0005] 2. Machine reading comprehension (MRC): According to a prompt template, a plurality of document passages obtained by recalling are combined with a user question (query) to generate a prompt, which is input into a large language model to obtain a model output as an answer (answer).

[0006] On this basis, if a multi-round dialogue is to be implemented, an obvious idea is to directly splice the historical dialogue record in this session together and attach the latest round of prompts to input the LLM again to obtain an answer, so that the LLM can understand the current user question in combination with the historical dialogue. One problem of this scheme is that in actual application, in order to fully utilize the capability of the LLM and answer the user question as much as possible, the actual length of the prompt is relatively long and exceeds the constraint condition of the large language model, which compresses the capability of the large language model to output an effective answer.

[0007] An improved way is to truncate the historical dialogue record to compress the length of the prompt. Although this scheme is feasible, it still has problems, which are:

[0008] 1. The user question is generally short, while the answer, although not as long as the prompt, may still occupy a large length. After a multi-round dialogue, the final generated prompt almost always exceeds the maximum length of the system preset prompt, and has to be truncated on the left side, resulting in that part of the historical dialogue is not visible, which is not a qualified "multi-round dialogue" and is likely to cause the large language model to be unable to give an effective answer.

[0009] 2. Directly generating a vector using a user question to match the similarity with the vector of a document segment, which is not good, because there is a semantic gap - the user question and the document segment that may have an answer are not necessarily similar in semantics, which affects the accuracy of the answer corresponding to the user question.

[0010] Therefore, due to the limitation of the processing capacity of the large language model itself, the traditional multi-round dialogue technology is difficult to maintain the effectiveness of the response in a long conversation, and needs to be improved accordingly. SUMMARY

[0011] The purpose of the present application is to provide a user question answering method and its corresponding device, equipment, and non-volatile readable storage medium.

[0012] According to one aspect of the present application, a user question answering method is provided, comprising the following steps:

[0013] Based on the historical chat record between the current user and the customer service robot and the user's latest question of the current user, an induced prompt document is constructed;

[0014] A large language model is called to input the induced prompt document, obtain a user standard question that re-expresses the user's latest question to make its semantics complete and self-consistent, and a preliminary reply text corresponding to the user standard question;

[0015] According to the preliminary reply text, a plurality of answer knowledge segments that match the semantics of the preliminary reply text are recalled, and a practical prompt document is constructed in combination with the user standard question;

[0016] A large language model is called to input the practical prompt document to obtain a practical reply text to answer the user's latest question.

[0017] According to another aspect of the present application, a user question answering device is provided, comprising:

[0018] An induced construction module is configured to construct an induced prompt document based on the historical chat record between the current user and the customer service robot and the user's latest question of the current user;

[0019] An induced output module is configured to call a large language model to input the induced prompt document, obtain a user standard question that re-expresses the user's latest question to make its semantics complete and self-consistent, and a preliminary reply text corresponding to the user standard question;

[0020] A practical construction module is configured to recall a plurality of answer knowledge segments that match the semantics of the preliminary reply text according to the preliminary reply text, and construct a practical prompt document in combination with the user standard question;

[0021] The utility output module is configured to call the large language model, input the utility prompt document, and obtain a utility reply text to answer the latest question of the user.

[0022] According to another aspect of the present application, a user question answering device is provided, comprising a central processing unit and a memory, the central processing unit being configured to call a computer program stored in the memory to execute the steps of the user question answering method described in the present application.

[0023] According to another aspect of the present application, a non-volatile readable storage medium is provided, which stores a computer program implemented according to the user question answering method described in the present application in the form of computer readable instructions, and when the computer program is called and run by a computer, the steps included in the method are executed.

[0024] Compared with the prior art, the present application has the following beneficial effects:

[0025] Firstly, in the environment of the current user and the customer service robot conducting multi-round dialogue, the user latest question and the historical chat record of the current user are used to construct an induction prompt document, and then the large language model is used to restate the user latest question based on the historical chat record in the induction prompt document, so as to ensure that the user standard question with complete and self-consistent semantics and the preliminary reply text corresponding to the user standard question are obtained. In this process, the induction prompt document does not need to provide a long prompt due to the help of the historical chat record, so it can accommodate more rounds of historical dialogue corresponding to the chat record, has a very small truncation risk, so that the large language model can determine the user standard question and the preliminary reply text based on more complete chat records.

[0026] Further, the present application recalls a plurality of answer knowledge segments based on the semantic matching of the preliminary reply text. Although the preliminary reply text is generated by the large language model according to the historical chat record and is not directly derived from the answer knowledge segment, the historical chat record is generated according to the answer knowledge segment and contains part of the content of the answer knowledge segment, and there is a certain logical association between the original user latest question and the historical chat record. Therefore, the preliminary reply text is actually more likely to inherit the semantics of the answer knowledge segment through the historical chat record from a broader perspective, that is, the preliminary reply text obtained by the large language model is actually more likely to have semantic relevance with the utility reply text expected by the present application, such as consistency in domain or content. Therefore, the preliminary reply text is used to realize the recall of the answer knowledge segment, and the recalled answer knowledge segment has a smaller semantic gap with the original user latest question and is more likely to comprehensively cover the semantics implied by the user latest question.

[0027] Moreover, since the original user latest question is transformed into a user standard question by the large language model in advance before being used to generate practical reply text by the large language model, the user standard question can make its semantics more complete and its logic more self-consistent with the help of the large language model's technical capabilities such as reference resolution and omission completion, so when it is input into the large language model again together with the recalled multiple answer knowledge segments to construct a practical prompt document, more accurate practical reply text can be obtained. Among them, no matter how many rounds of dialogue exist in the historical chat record, each answer knowledge segment cited in the practical prompt document can comprehensively reflect the semantic relevance between the user latest question, so the length of the document is always controllable as a single round of dialogue, which can effectively solve the problem of multi-round dialogue scheme being limited by the maximum input length preset by the large language model, without losing the historical dialogue context, thereby ensuring that the customer service robot answers the user's latest question with more accurate practical reply text. BRIEF DESCRIPTION OF DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0029] Figure 1 A network architecture schematic diagram of an exemplary e-commerce platform of the present application;

[0030] Figure 2 A flowchart of an embodiment of the user question answering method of the present application;

[0031] Figure 3 A flowchart of constructing an induced prompt document in an embodiment of the present application;

[0032] Figure 4 A flowchart of filtering historical chat records in an embodiment of the present application;

[0033] Figure 5 A flowchart of constructing a question and answer knowledge base in an embodiment of the present application;

[0034] Figure 6 A principle block diagram of the user question answering device of the present application;

[0035] Figure 7 A structural schematic diagram of a user question answering equipment adopted by the present application. DETAILED DESCRIPTION

[0036] As Figure 1In the illustrated network architecture, the e-commerce platform 82 is deployed in the Internet to provide corresponding services to its users, and the devices 80 of the merchant users and the devices 81 of the consumer users of the e-commerce platform 82 are also connected to the Internet to use the services provided by the e-commerce platform. For example, the e-commerce platform can configure a customer service support system to open a customer service robot-based question and answer service for the merchant users of each online store in the e-commerce platform, and the consumer user can submit his latest question as a current user to the customer service robot, and the customer service robot outputs the corresponding practical reply text to answer the user's latest question, so as to ensure the service satisfaction of the online store.

[0037] An exemplary e-commerce platform 82 provides product and / or service supply and demand matching to the public through the Internet infrastructure. In the e-commerce platform 82, products and / or services are provided as commodity information. For simplicity of description, the concepts of commodity, product, etc. are used in the present application to refer to products and / or services in the e-commerce platform 82, which can be physical products, digital products, tickets, service subscriptions, other offline services, etc.

[0038] In reality, various entities can access the e-commerce platform 82 as users to use various online services provided by the e-commerce platform 82 to achieve the purpose of participating in the business activities implemented by the e-commerce platform 82. These entities can be natural persons, legal persons or social organizations, etc. Corresponding to the two types of entities of merchants and consumers in the business activities, the e-commerce platform 82 correspondingly has two types of users, merchant users and consumer users. The entities in the product circulation chain in the business activities, including manufacturers, sellers, retailers, logistics providers, etc., can use online services in the e-commerce platform 82 as merchant users, while consumers in the business activities, including real or potential consumers, can use online services in the e-commerce platform 82 as their corresponding consumer users. In actual business activities, the same entity can act as a merchant user and also as a consumer user, and this should be understood flexibly.

[0039] The infrastructure for deploying the e-commerce platform 82 mainly includes a back-end architecture and front-end devices. The back-end architecture runs various online services through a service cluster, including middleware or front-end services for platform parties, consumer-oriented services, merchant-oriented services, etc., to enrich and perfect its service functions. The front-end devices mainly cover terminal devices used by users as clients to access the e-commerce platform 82, including but not limited to various mobile terminals, personal computers, point-of-sale devices, etc. For example, a merchant user can use his terminal device 80 to input product information for his online store, or use the interface provided by the e-commerce platform to generate product information. A consumer user can access the web page of an online store implemented by the e-commerce platform 82 through his terminal device 81, trigger a shopping process through a shopping button provided on the web page, and call various online services provided by the e-commerce platform 82 in the shopping process, so as to achieve the purpose of shopping and ordering.

[0040] In some embodiments, the e-commerce platform 82 can be implemented through a processing facility including a processor and a memory, which stores a set of instructions that, when executed, cause the e-commerce platform 82 to perform the e-commerce and support functions involved in this application. The processing facility can be part of a server, a client, a network infrastructure, a mobile computing platform, a cloud computing platform, a fixed computing platform, or other computing platforms, and provides electronic components of the e-commerce platform 82, merchant devices, payment gateways, application developers, marketing channels, transportation providers, customer devices, point-of-sale devices, etc.

[0041] The e-commerce platform 82 can be implemented as a cloud computing service, software as a service (SaaS), infrastructure as a service (IaaS), platform as a service (PaaS), desktop as a service (DaaS), hosted software as a service, mobile backend as a service (MBaaS), information technology management as a service (ITMaaS), etc. Online services. In some embodiments, various functional components of the e-commerce platform 82 can be implemented to be suitable for operation on various platforms and operating systems, for example, for an online store, its administrator user enjoys the same or similar functions in various embodiments such as iOS, Android, HomonyOS, or web page, etc.

[0042] The e-commerce platform 82 can implement respective independent stations for each merchant to run their respective online stores, provide respective instances of the commerce management engine for the merchants to establish, maintain, and run their one or more online stores in one or more independent stations. The instance of the commerce management engine can be used for content management, task automation, and data management of one or more online stores, and can configure various specific business processes of the online stores through interfaces or built-in components to support the implementation of business activities. The independent station is the infrastructure of the e-commerce platform 82 with cross-border service functions, and the merchant can maintain its online store based on the independent station in a relatively centralized and autonomous manner. The independent station usually has a domain name and storage space dedicated to the merchant, and the independent stations are relatively independent. The e-commerce platform 82 can provide standardized or personalized technical support for a large number of independent stations, so that the merchant user can customize a commerce management engine instance suitable for itself, and use this commerce management engine instance to maintain one or more online stores owned by the merchant.

[0043] The online store can be configured and maintained by the merchant user logging in as an administrator to its commerce management engine instance. With the support of various online services provided by the infrastructure of the e-commerce platform 82, the merchant user can configure various functions in its online store and review various data as an administrator, for example, the merchant user can manage various aspects of its online store, such as viewing recent activities of the online store, updating product catalog of the online store, managing orders, recent visit activities, total order activities, etc. The merchant user can also view more detailed information about the business and visitors to the merchant's online store by obtaining reports or metrics, such as displaying sales summary of the merchant's overall business, specific sales and engagement data of the activity sales marketing channel, etc.

[0044] The e-commerce platform 82 can provide communication facilities and associated merchant interfaces for providing electronic communications and marketing, such as using an electronic message aggregation facility to collect and analyze communication interactions between merchants, consumers, merchant devices, customer devices, point-of-sale devices, etc., aggregate and analyze communications, such as for increasing the potential for providing product sales, etc. For example, a consumer can have a question about a product that can generate a conversation between the consumer and the merchant (or an automated processor-based agent on behalf of the merchant), where the communication facility is responsible for the interaction and provides the merchant with analysis on how to improve the probability of a sale.

[0045] In some embodiments, an application suitable for installation on a terminal device can be provided to serve the access needs of different users, so as to enable various users to access the e-commerce platform 82, such as the merchant back-end module of an online store in the e-commerce platform 82, etc., in the terminal device by running the application. In the process of implementing business activities through these functions, the e-commerce platform 82 can implement various functions related to the implementation of business activities as middleware or online services and open corresponding interfaces, and then implant the interface access function into the application to realize function extension and task implementation. The business management engine can include a series of basic functions, and expose these functions to online services and / or application calls through APIs. Online services and applications use corresponding functions by remotely calling corresponding APIs.

[0046] With the support of various components of the business management engine instance, the e-commerce platform 82 can provide online shopping functions, enabling merchants to establish contact with customers in a flexible and transparent manner, and enabling consumer users to select and purchase goods online, create a product order, provide a delivery address for the goods in the product order, and complete payment confirmation of the product order. Then, the merchant can review and complete or cancel the order. The review component carried by the business management engine instance can implement the compliant use of the business process to ensure that the order is suitable for fulfillment before actual fulfillment. The order may also be fraudulent at times and needs to be verified (e.g., identity check), there is a payment method that requires the merchant to wait to ensure that the funds are received, which can act as a safeguard against such risks, and the like. Order risk can be generated by fraud detection tools submitted by third parties through an order risk API, etc. Before fulfillment, the merchant can obtain payment information or wait to receive payment information in order to mark the order as paid, and only then can the merchant prepare to deliver the product. Similar situations can be subject to corresponding review. The review process can be implemented by the fulfillment component. The merchant can review, adjust work, and trigger related fulfillment services with the help of the fulfillment component, such as: manual fulfillment services, which are used when the merchant selects and packages the product in a box, purchases a shipping label and enters its tracking number, or simply marks the item as fulfilled; custom fulfillment services, which can define sending an email for notification; API fulfillment services, which can trigger third-party applications to create a fulfillment record at a third party; legacy fulfillment services, which can trigger custom API calls from the business management engine to a third party; gift card fulfillment services. A number can be generated and a gift card can be activated. The merchant can use an order printer application to print a shipping label. The fulfillment process can be performed when the item is packaged in a box and ready for shipping, tracking, delivery, consumer receipt verification, etc.

[0047] It can be seen that the e-commerce platform provides answers for consumer users through customer service robots, which plays an important role in maintaining the healthy operation of online stores. Therefore, high-quality response technology will help save resource overhead of online stores and even the entire e-commerce platform, improve their total merchandise transaction volume, and bring a series of good benefits.

[0048] Please refer to Figure 2 According to the user question answering method provided in the present application, in the embodiments thereof, the following steps are included:

[0049] Step S5100, based on the historical chat record between the current user and the customer service robot and the user's latest question of the current user, a prompting document is constructed;

[0050] The online store in the e-commerce platform can configure the customer service support system provided by the e-commerce platform as the customer service interface of the online store in advance. When the user calls the customer service interface, the corresponding chat interface is performed, and the chat with the customer service robot implemented by the customer service support system is started. The dialogue based on the chat interface is usually in the form of one question and one answer. The user can input a statement in the chat interface to express a certain meaning. The customer service robot can regard the user's input statement as a query question, regardless of whether the actual content expressed by the query question contains the meaning of a question. Then, the customer service robot answers according to the query question and outputs the corresponding reply text to the chat interface. The one-way dialogue between the user and the customer service robot constitutes a single dialogue, and the corresponding query question and reply text constitute the dialogue question and answer text of this dialogue. Storing each dialogue reply text in the customer service support system constitutes the corresponding historical chat record.

[0051] The query question given by the user is usually regarded as the user's question. Among them, the query question input by the user waiting for the reply of the customer service robot is regarded as the latest question of the user. The customer service robot needs to provide the corresponding reply text for the latest question of the user. The reply text is the reply text actually applied to the chat interface, and is regarded as the practical reply text.

[0052] The customer service robot can call the response interface provided by the customer service support system, which can realize the determination of the corresponding practical reply text according to the latest user question, and of course also includes the implementation of the intermediate process of how to determine the practical reply text according to the latest user question. For example, in this application, the intermediate process will involve two calls to a pre-set large language model, and a corresponding prompt document is constructed respectively, including an induction prompt document and a practical prompt document, wherein the induction prompt document is used to instruct the large language model to optimize the user's latest question to obtain the user's standard question, and to generate the corresponding reply text as a preliminary reply text; the practical prompt document is used to instruct the large language model to provide a practical reply text according to the user's standard question and the answer knowledge fragment related to the semantic of the preliminary reply text.

[0053] The large language model (LLM) of the present application belongs to the generation model, which refers to those language models trained on large-scale text corpus and containing a large number of parameters. It is a series of artificial intelligence models designed to understand and generate human language. They are trained on a large amount of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, etc. The characteristic of LLM is large scale, which can contain tens of billions of parameters to help them learn complex patterns in language data. These models are usually based on deep learning architectures such as Transformers, which help them achieve impressive performance on various NLP (Natural Language Processing) tasks. Current large language models (such as GPT and BERT) use similar Transformer architecture and pre-training objectives (such as Language Modeling) as small models, the main difference between small models is the increase in model size, training data and computing resources. Take GPT for example, GPT has appeared several generations, GPT-3 has 45TB of training data, which is huge.

[0054] Various mature large language models on the market can be used by the present application, and typical ones such as ChatGPT series can be directly called by the present application. It should be understood that any large language model that has been trained to obtain the required functions of the present application belongs to the scope of the definition of large language model by the present application.

[0055] Although the large language model has strong reasoning ability, in order to obtain effective reply text, it is usually necessary to provide it with effective prompts and, if necessary, provide it with the materials needed to help it understand and reason. The present application provides corresponding materials and prompts through induction prompt documents and practical prompt documents to guide the large language model to work correctly in order to drive the large language model to output effective result data.

[0056] The induction prompt document of the present application contains historical chat records, user latest questions, and two task prompts. Among them: the user latest question refers to the query question sentence that the user has just input and completed submission from the chat interface. The historical chat record is extracted from the dialogue data formed after the current user and the customer service robot chat, and belongs to the dialogue question and answer text of multiple dialogues before the user latest question. In some embodiments, the historical chat record can be filtered in advance to filter out dialogue question and answer texts that are not relevant in theme and / or logic to the user latest question, in order to highlight the semantic relevance of the historical chat record to the user latest question; in some embodiments, the historical chat record can be arranged in chronological order of chat time. Among the two task prompts, the first task prompt indicates that the user latest question in the induction prompt document is restated according to the historical chat record in the induction prompt document to obtain a semantically complete and self-consistent user specification question, and the second task prompt indicates that a preliminary reply text corresponding to the user specification question is generated. The first task prompt and the second task prompt can be expressed in natural language, and the following gives exemplary examples of the first task prompt and the second task prompt:

[0057] First task prompt: Please rewrite the user latest question in the latter sentence according to the historical chat record part in the former text, supplement the omitted key information, so that the rewritten question is semantically complete, and anyone can understand it completely and accurately without the historical chat record;

[0058] Second task prompt: Answer the rewritten question according to the historical chat record and common sense.

[0059] As can be seen from the above examples, since the historical chat record and the user latest question have been included in the induction prompt document as the material for the large language model to reason upon, the task prompt itself can be described in a more concise text, naturally occupying less character length.

[0060] In some embodiments, the induction prompt document can also contain specification instructions for layout constraints on the result data output by the large language model, which can be implemented as needed.

[0061] In some embodiments, an induction prompt template can be implemented in advance to adapt to the need to construct the induction prompt document, in which the format of various materials and task prompts is specified. When constructing the induction prompt document based on the historical chat record and the user latest question, the corresponding historical chat record and user latest question can be fitted into the induction prompt template to obtain the induction prompt document.

[0062] In some embodiments, considering that large language models generally have a constraint on the maximum input length of input content, the number of dialogue data in the historical chat record used to construct the induced prompt document can be controlled in advance according to the maximum input length, so that the final generated induced prompt document has a character length that does not exceed the maximum input length constrained by the large language model. In this case, although the character length of the historical chat record is actually controlled, since the historical chat record contains the context associated with the user's latest question, it can still ensure that the induced prompt document has enough material to guide the large language model to perform the corresponding task.

[0063] Step S5200, calling the large language model, inputting the induced prompt document, obtaining the user standard question that re-expresses the user's latest question and makes the semantics complete and self-consistent, and the preliminary reply text corresponding to the user standard question;

[0064] After the induced prompt document is prepared, the large language model can be called. The induced prompt document is input into the large language model, and the large language model can understand and reason the induced prompt document according to the reasoning ability learned by itself, and generate corresponding result data according to each task prompt therein. According to the two task prompts contained in the induced prompt document of the present application, the large language model will re-express the user's latest question under the control of the two task prompts, so as to obtain the corresponding user standard question, and then generate the corresponding preliminary reply text according to the historical chat record and the user standard question. Therefore, the large language model will finally output the user standard question and the corresponding preliminary reply text.

[0065] The user standard question reasoned by the large language model is obtained by rewriting the user's latest question according to the semantics provided by the historical chat record. The large language model can perform one or more natural language processing operations on the user's latest question, but will finally ensure that the obtained user standard question is semantically complete and logically self-consistent. For example, the large language model can perform formatting processing on the user's latest question to remove redundant characters, invalid characters, etc., or perform anaphora resolution on the reference information therein according to the context semantics provided by the historical chat record, or perform completion on the omitted content therein according to the context semantics in the historical chat record, etc. Any one or more processing, thereby obtaining a user standard question that is more complete and self-consistent in semantics.

[0066] It is not difficult to understand that the induction prompt document of the application can be used to control the large language model to rewrite the current user's latest question and generate preliminary reply text, and the material relied on by the large language model reasoning is mainly derived from the historical chat records of the current user and the common sense knowledge learned by the large language model in the training process. Although the historical chat records are not dedicated customer service guide documents, because there is often a content-related correlation between multiple rounds of user dialogue during the same session, the large language model can rewrite the user's latest question according to the historical chat records in the induction prompt document and the common sense knowledge learned by itself to obtain the user's standard question, and according to the user's standard question, the corresponding preliminary reply text can be obtained, and the preliminary reply text maintains a certain semantic correlation with the user's latest question and historical chat records.

[0067] Step S5300, recalling a plurality of answer knowledge segments matched with the preliminary reply text according to the preliminary reply text, and constructing a practical prompt document combined with the user's standard question;

[0068] The preliminary reply text is obtained by the large language model reasoning according to the historical chat records, and is not given according to the content in the dedicated customer service guide document, so if it is directly used to reply to the user's latest question, its accuracy may be low. However, the preliminary reply text has undoubtedly inherited part of the relevant semantics from the user's standard question and historical chat records, so more professional answer knowledge segments can be recalled from the preset question and answer knowledge base according to this, so as to guide the large language model to generate the practical reply text corresponding to the user's standard question by using the recalled answer knowledge segments, and to reply to the user's latest question.

[0069] The application can prepare a question and answer knowledge base in advance, which stores various answer knowledge segments related to the goods and services of online stores, usually mainly containing various answer knowledge segments related to the transaction process of the order, and the vector representation of each answer knowledge segment is obtained by means of a preset text feature extraction model. The corresponding segment features are obtained, and the answer knowledge segments and their corresponding segment features are stored in the question and answer knowledge base for calling.

[0070] To recall multiple pieces of answer knowledge from the question and answer knowledge base that are semantically relevant to the preliminary reply text, the text feature extraction model can be used to vectorize the preliminary reply text and obtain the corresponding text features. Then, the data distance between the text features and the piece features of each piece of answer knowledge in the question and answer knowledge base is calculated, the data distance is converted into semantic similarity, and multiple pieces of answer knowledge with high semantic relevance are selected according to the semantic similarity to realize matching and recall. It is not difficult to understand that the multiple pieces of answer knowledge recalled are semantically relevant to the preliminary reply text, and are also semantically relevant to the user's standard question. This realizes the recall of the answer knowledge in the question and answer knowledge base.

[0071] The pieces of answer knowledge recalled from the question and answer knowledge base are the materials for the reply text that provides the corresponding semantics for the user's standard question, so the multiple pieces of answer knowledge recalled can be combined with the user's standard question that is semantically complete and self-consistent to form a practical prompt document. The practical prompt document can be used to drive the large language model to generate the reply text corresponding to the user's standard question according to the multiple pieces of answer knowledge, as a practical reply text, to answer the original user's latest question.

[0072] In the practical prompt document of the present application, in addition to the multiple pieces of answer knowledge recalled according to the preliminary reply text, the user's standard question generated by the large language model is also included, and in addition, a task prompt can be added, which can be used to instruct the large language model to generate the practical reply text corresponding to the given user's standard question according to the given multiple pieces of answer knowledge. In some embodiments, the practical prompt document can also include a format specification for constraining the result data output by the large language model, so that it outputs the corresponding practical reply text in the desired format. In some other embodiments, the multiple pieces of answer knowledge and the user's standard question in the practical prompt document can be typeset according to the pre-set format specification, for example, the multiple pieces of answer knowledge are placed in front, the user's standard question is placed at the back, and then the task prompt is added at the end, so that the practical prompt document is more logically standardized and convenient for the large language model to perform efficient reasoning.

[0073] Similarly, in some embodiments, a practical prompt template can be implemented in advance to adapt to the needs of constructing the practical prompt document according to the present application, in which the format of various materials and task prompts is specified. When it is necessary to construct a practical prompt document, the corresponding multiple pieces of answer knowledge and user's standard question can be fitted into the practical prompt template to obtain the practical prompt document.

[0074] In some embodiments, considering that large language models generally have a constraint on the maximum input length of input content, the number of answer knowledge segments used to construct the practical prompt document can be controlled in advance according to the maximum input length, so that the final generated practical prompt document has a character length that does not exceed the maximum input length constrained by the large language model. In this case, although the overall character length of the multiple answer knowledge segments is actually controlled, since these answer knowledge segments are obtained according to the initial reply text and have semantic relevance with the user's standard question, they are relatively accurate materials, so the large language model can still infer the corresponding practical reply text for the user's standard question.

[0075] Step S5400, calling the large language model, inputting the practical prompt document, obtaining the practical reply text answering the user's latest question.

[0076] After determining the practical prompt document, the practical prompt document can be input into the large language model again, and the large language model can infer the user's standard question according to the task prompt in the practical prompt document and the multiple answer knowledge segments therein to deduce the corresponding reply text as the practical reply text.

[0077] The large language model itself has strong natural language reasoning ability, and each input answer knowledge segment provides rich answer knowledge, and these answer knowledge is directly or indirectly related to the user's standard question in semantics. Therefore, only the user's standard question corresponding to the user's latest question of the current user and the multiple answer knowledge segments recalled according to the above process are needed to accurately infer the corresponding practical reply text.

[0078] As can be seen, although the large language model is called twice from the current user submitting the user's latest question to obtaining the practical reply text, each call does not need to provide an independent corresponding prompt for each round of dialogue data, but a more concise prompt can be provided. Therefore, the number of historical chat records can be controlled in the first call, and the number of answer knowledge segments can be controlled in the second call, that is, the character length of the induced prompt document or the practical prompt document is controllable, which can effectively ensure that the large language model can provide corresponding reply text based on the semantics of the multiple rounds of dialogue between the current user and the customer service robot for each submitted user's latest question, so that the entire conversation process can always be associated with the chat context, and the effect of intelligent multi-round interaction can be truly achieved.

[0079] At this point, combining the above embodiments, it can be known that the present application has the following beneficial effects:

[0080] Firstly, in the environment that the current user has a multi-round conversation with the customer service robot, the user's latest question and historical chat records are used to construct an induction prompt document, and then the large language model is used to restate the user's latest question based on the historical chat records in the induction prompt document, so as to ensure that the user's standard question is complete and self-consistent in semantics, and the preliminary reply text corresponding to the user's standard question is obtained. In this process, the induction prompt document does not need to provide a long prompt with the help of the historical chat records, so it can accommodate more rounds of historical conversation corresponding to the chat records, has a small risk of truncation, so that the large language model can determine the user's standard question and the preliminary reply text based on more complete chat records.

[0081] Further, the application recalls multiple answer knowledge segments based on the preliminary reply text. Although the preliminary reply text is generated by the large language model based on the historical chat records, and is not directly derived from the answer knowledge segments, the historical chat records are generated based on the answer knowledge segments and contain part of the content of the answer knowledge segments. There is also a certain logical association between the original user's latest question and the historical chat records. Therefore, the preliminary reply text is actually more likely to inherit the semantics of the answer knowledge segments through the historical chat records in a broader perspective. That is, the preliminary reply text obtained by the large language model is more likely to have semantic relevance with the practical reply text expected by the application, such as consistency in domain or content. Therefore, using the preliminary reply text to recall the answer knowledge segments makes the recalled answer knowledge segments have a smaller semantic gap with the original user's latest question, and more easily cover the semantics implied by the user's latest question.

[0082] In addition, since the original user's latest question is rephrased by the large language model into a user's standard question before being used to generate a practical reply text by the large language model, the user's standard question has a more complete semantics and a more self-consistent logic with the help of the large language model's technical capabilities such as anaphora resolution and ellipsis completion. Therefore, when the user's standard question and the recalled multiple answer knowledge segments are jointly constructed into a practical prompt document and input into the large language model again, a more accurate practical reply text can be obtained. Regardless of the number of rounds of conversation in the historical chat records, each answer knowledge segment cited in the practical prompt document can comprehensively reflect the semantic relevance between the user's latest question and the answer knowledge segment. Therefore, the length of the practical prompt document is always controllable like a single round of conversation, which can effectively solve the problem of the multi-round conversation scheme being limited by the maximum input length preset by the large language model, without losing the context of the historical conversation, thereby ensuring that the customer service robot answers the user's latest question with a more accurate practical reply text.

[0083] On the basis of any embodiment of the method of the present application, please refer to Figure 3 , based on the historical chat record between the current user and the customer service robot and the user latest question of the current user, constructing an induced prompt document, comprising:

[0084] Step S5110, in response to the question submission event triggered by the current user, obtaining the user latest question corresponding to the question submission event and the historical chat record before the user latest question, the character length of the historical chat record being less than a preset character length threshold;

[0085] In the environment of the customer service chat interface, after the current user inputs the text content in the input box and presses the send control, the corresponding question submission event is triggered, and the text content input by the current user is taken as the user latest question and is contained in the question submission event, which is submitted to the customer service robot for response processing, so as to return the corresponding practical reply text by the customer robot.

[0086] After the customer service robot receives the question submission event, it responds to it, which can specifically analyze the question submission event to obtain the user latest question therein, and then submit it to a preset response interface for intermediate processing by the response interface to finally obtain the practical reply text.

[0087] The response interface first reads the historical chat record before the user latest question, which is composed of multiple dialogue question and answer texts generated by multiple rounds of dialogue of the user. As for how many rounds of dialogue question and answer texts are needed, it can be determined according to a preset number or subject to the maximum input length of the large language model, for example, the maximum input length of 50% is taken as the preset character length threshold to collect multiple rounds of dialogue question and answer texts, so that the total character length of the collected multiple rounds of dialogue question and answer texts is not greater than the character length threshold.

[0088] In some embodiments, the historical chat records can also be optimized beforehand or at this step, for example, according to the theme relevance and / or logical relevance between the dialogue question and answer texts of each round in the historical chat record and the user latest question, to determine a number of dialogue question and answer texts most relevant to the user latest question, and remove other dialogue question and answer texts least relevant, thereby improving the semantic matching degree between the historical chat record and the user latest question.

[0089] Step S5120, obtaining an induced prompt template, the induced prompt template containing format specifications indicating the layout of the historical chat record and the user latest question to be fitted and multiple task prompts, wherein the first task prompt indicates that the user latest question fitted with the historical chat record is restated to obtain a semantically complete and self-consistent user standard question, and the second task prompt indicates that a preliminary reply text corresponding to the user standard question is generated;

[0090] The present application is provided with an induction prompt template in which the format specification for typesetting the historical chat record to be fitted in and the user's latest question is defined in advance, and is accompanied by a plurality of task prompts, including a first task prompt and a second task prompt, which are respectively set for generating user standard questions and preliminary reply texts.

[0091] In one embodiment, the format specification in the induction prompt template can be to sequentially arrange the dialogue question and answer texts in the historical chat record in the order of one question and one answer, and in the time sequence actually occurring during chatting, then append the user's latest question thereto, and then set the task prompts thereafter. If necessary, the induction prompt template can also include format conditions for standardizing the result data output by the large language model, which can be flexibly set as needed.

[0092] Step S5130, fitting the historical chat record and the user's latest question into the induction prompt template according to the format specification of the induction prompt template, to obtain an induction prompt document with a character length less than the maximum input length constrained by the large language model.

[0093] The response interface then fits the historical chat record and the user's latest question determined in step S5110 into the induction prompt template, thereby deriving an induction prompt document based on the induction prompt template, which contains task prompts and other related information in addition to the historical chat record and the user's latest prompt.

[0094] Since the character length of the induction prompt document needs to be adapted to the maximum input length of the large language model, the number of dialogue question and answer texts of the historical chat record can be controlled in advance according to the embodiments disclosed in the foregoing of the present application, or it can be adjusted in this step, and the historical chat record at an earlier time can be appropriately truncated, so that the character length of the entire induction prompt document is less than the maximum input length constrained by the large language model.

[0095] In the above embodiments, by realizing an induction prompt template in advance, the induction prompt template can be quickly called when the user submits his latest question in the process of multiple rounds of dialogue between the user and the customer service robot, the historical chat record and the user's latest question are fitted into the induction prompt template to quickly generate an induction prompt document, the generation efficiency of the induction prompt document is improved, and the processing speed of the final result is also improved.

[0096] On the basis of any embodiment of the method of the present application, please refer to Figure 4, before constructing the inducing prompt document based on the historical chat record between the current user and the customer service robot and the user latest question of the current user, or after obtaining the historical chat record in step S5110 of the previous embodiment, the historical chat record can be filtered, and the specific process includes:

[0097] Step S4100, determining the topic relevance between each single dialogue question and answer text contained in the historical chat record and the user latest question of the current user;

[0098] The historical chat record generated during the chat between the current user and the customer service robot contains multiple rounds of dialogue question and answer texts, and the topics involved in each round of dialogue question and answer text may not necessarily be completely consistent. Similarly, the topic relevance between the topic to which the user latest question belongs and the topics of each round of dialogue question and answer text may also differ. In this case, a preset topic classification model can be used to determine the topic relevance between the user latest question and each round of dialogue question and answer text, so as to quantify the relevance between the user latest question and each round of dialogue question and answer text.

[0099] In an embodiment, a corresponding training sample pair can be used to train a topic classification model, so that the topic classification model can extract feature vectors corresponding to two training samples according to the given two training samples, fuse the two feature vectors into a same comprehensive feature vector, and then predict the classification probability of mapping to similar and dissimilar categories corresponding to the comprehensive feature vector. Then, the classification probability of the similar category is taken as the topic relevance between the two training samples.

[0100] In another embodiment, the topic classification model can also be implemented by using a large language model. Based on the innate ability of the large language model, as long as the corresponding round of dialogue question and answer text and the user latest question are submitted to the large language model and inquired accordingly, the expected topic relevance can be directly obtained.

[0101] When using the topic classification model, each single dialogue question and answer text in the historical chat record is input as one way, and the user latest question is input as the other way, so as to determine the topic relevance corresponding to the two inputs, which is used to measure the topic relevance between the dialogue question and answer text and the user latest question. Similarly, the topic relevance between each single dialogue question and answer text in the historical chat record and the user latest question is determined.

[0102] Step S4200, determining the logical relevance between each single dialogue question and answer text contained in the historical chat record and the user latest question of the current user;

[0103] In addition to measuring the topic relevance between each single dialogue question and answer text and the user's latest question, the logical relevance between the two can also be further measured. The logical relevance is mainly used to measure whether the user's latest question and the dialogue question and answer text have logical succession in semantics, so a logical judgment model suitable for determining the logical relationship between the two sentences can be used to implement it. The logical judgment model takes the text information formed by splicing the dialogue question and answer text and the user's latest question as the basis, first extracts the deep semantic features in the text information, and then determines the two categories corresponding to whether there is a logical succession relationship between the two through a classifier to obtain the corresponding classification probability. The classification probability corresponding to the category representing the existence of the logical succession relationship is taken as the logical relevance. Of course, the logical judgment model first uses the corresponding training samples to implement classification training. When it is necessary to determine the logical relevance between each single dialogue question and answer text and the user's latest question of the current user, the logical judgment model can be input by splicing each single dialogue question and answer text and the user's latest question to obtain the corresponding logical relevance. In this way, the logical relevance corresponding to each single dialogue question and answer text in the historical chat record can be obtained.

[0104] In another embodiment, the logical judgment model can also be implemented by using a large language model. Based on the innate ability of the large language model, as long as the corresponding round dialogue question and answer text and the user's latest question are submitted to the large language model and inquired accordingly, the expected logical relevance can be directly determined.

[0105] Step S4300, determining the overall relevance between each single dialogue question and answer text and the user's latest question according to the topic relevance and the logical relevance;

[0106] To facilitate the overall understanding of the overall relevance between each dialogue question and answer text and the user's latest question in the historical chat record, the topic relevance and the logical relevance of each dialogue question and answer text can be weighted and fused or averaged, and the obtained result is taken as the overall relevance. The overall relevance jointly scores the relevance between each dialogue question and answer text and the user's latest question from the aspects of topic relevance and logical relevance, which is more helpful for filtering the historical chat record.

[0107] Step S4400, filtering out the dialogue question and answer text in the historical chat record whose overall relevance is lower than the preset threshold, and retaining other dialogue question and answer texts.

[0108] Finally, it is not difficult to understand that if the overall relevance of the dialogue question and answer text of a certain session is low, it indicates that the semantic information corresponding to the user's latest question contained therein is less, and the semantic matching of the two is lower. Accordingly, a preset threshold can be used to decide how to filter the dialogue question and answer text in the historical chat record. Specifically, when the overall relevance of the dialogue question and answer text of a certain session in the historical chat record is lower than the preset threshold, it can be deleted from the historical chat record and not used as material for generating the induced prompt document in subsequent use. For the dialogue question and answer text of other sessions whose overall relevance is not lower than the preset threshold, it can be retained for use in generating the induced prompt document by fitting into the induced prompt template.

[0109] According to the above embodiments, before fitting the historical chat record into the induced prompt template to generate the induced prompt document, the overall relevance of the dialogue question and answer text of each session in the historical chat record can be determined according to its relevance in terms of theme and logic with the user's latest question. Then, by using the overall relevance, relatively high-quality dialogue question and answer text can be selected, and some dialogue question and answer text that is not very relevant in terms of semantics to the user's latest question can be discarded. This makes the semantics of the final obtained historical chat record more easily correspond to the semantics of the user's latest question, which helps to reduce the size of the induced prompt document, reduce the running overhead of the large language model, improve its response speed, and be more efficient.

[0110] On the basis of any embodiment of the method of the present application, recalling a plurality of answer knowledge segments that are semantically matched with the preliminary reply text according to the preliminary reply text comprises:

[0111] Step S5310, calculating the semantic similarity between the vector representation of the preliminary reply text and the vector representation of each answer knowledge segment in the preset question and answer knowledge base;

[0112] As mentioned earlier, the present application can be prepared with a question and answer knowledge base, and a large number of answer knowledge segments and vector representations of each answer knowledge segment are pre-stored therein. Accordingly, the semantic similarity between the feature vector of each answer knowledge segment and the feature vector of the preliminary reply text can be calculated based on cosine similarity, Euclidean distance, Pearson correlation coefficient, and Jaccard coefficient, etc. data distance algorithm, so as to measure the similarity between the answer knowledge segment and the preliminary reply text.

[0113] Step S5320, according to the semantic similarity corresponding obtained by each answer knowledge segment, subject to the maximum input length of the large language model, filtering and recalling a plurality of answer knowledge segments whose semantic similarity satisfies the preset condition.

[0114] On the basis that each answer knowledge segment in the question and answer knowledge base obtains the semantic similarity of the corresponding initial reply text, the plurality of answer knowledge segments can be selected from the question and answer knowledge base according to the preset conditions corresponding to the semantic similarity and under the condition of being subject to the maximum input length of the large language model, according to the needs of constructing the induced prompt document, to construct the induced prompt document.

[0115] To this end, the preset semantic threshold value greater than the preset semantic threshold value can be used as the preset condition under which the corresponding answer knowledge segment can be recalled, and when the semantic similarity of an answer knowledge segment reaches the preset semantic threshold value, the preset condition is considered to be met, and the answer knowledge segment can be used as a candidate segment for constructing the induced prompt document.

[0116] At the same time, considering that the overall character length of the induced prompt document should not exceed the maximum input length set by the large language model, a part of the candidate segments with relatively large semantic similarity are selected from the determined candidate segments to actually construct the induced prompt document. Of course, after the selected part of the candidate segments are inserted into the induced prompt template to obtain the induced prompt document, the overall character length of the induced prompt document should be ensured to not exceed the maximum input length preset by the large language model, otherwise, the selected answer knowledge segments should be appropriately reduced.

[0117] After the above screening process, in the case that the initial reply text has inherited the semantics of the historical chat record, the search for the answer knowledge segments in the question and answer knowledge base can be performed according to the corresponding semantics, the plurality of answer knowledge segments related to the semantics of the initial reply text can be searched in the maximum range, and the relatively optimal part of the answer knowledge segments can be selected to generate the induced prompt document according to the input parameter constraint condition of the large language model, so that the material quality of the induced prompt document is optimized, and the precision of generating the practical prompt document can be further improved.

[0118] On the basis of any embodiment of the method of the present application, the practical prompt document is constructed in combination with the user specification question, including:

[0119] Step S5330, an practical prompt template is obtained, the practical prompt template includes format specifications and task prompts for indicating the layout of the plurality of answer knowledge segments to be inserted and the user specification question, and the task prompts indicate that the user specification question corresponds to the practical reply text is generated according to the plurality of answer knowledge segments;

[0120] As mentioned above, the present application can pre-configure a practical prompt template for quickly generating a practical prompt document. The practical prompt template contains format specifications and task prompts for indicating the layout of the multiple answer knowledge segments and the user standard question to be fitted, and the task prompts play a role in instructing the large language model to generate the practical reply text corresponding to the user standard question according to the multiple answer knowledge segments.

[0121] In some embodiments, the format specifications in the practical prompt template can list each answer knowledge segment in the front and list the user standard question in the back, and add the corresponding task prompt at the end. An exemplary task prompt can be expressed as: please generate the reply text corresponding to the user standard question indicated by the last sentence according to the above provided segments. As can be seen, the task prompt here can still be expressed in a concise natural language, occupying a smaller scale, and the indication is clear.

[0122] Step S5340, fitting the multiple answer knowledge segments and the user standard question into the practical prompt template according to the format specifications of the practical prompt template, to obtain a practical prompt document with a character length less than the maximum input length constrained by the large language model.

[0123] Finally, according to the format specifications of the practical prompt template, each recalled answer knowledge segment and user standard question is fitted into the corresponding position, i.e. a practical prompt document can be derived based on the practical prompt template. Of course, as in the inductive prompt template, the control of the dialogue and question and answer text in the historical chat record, in this embodiment, the maximum input length of the large language model can also be subject to the maximum input length of the large language model, and the selected answer knowledge segments with high semantic similarity are selected, and the total character length of the practical prompt document generated therefrom is ensured to be less than the maximum input length of the large language model. When the maximum input length is exceeded, one or more answer knowledge segments with the lowest semantic similarity can be deleted appropriately.

[0124] According to the above embodiments, by pre-implementing a practical prompt template, it is helpful to quickly generate a corresponding practical prompt document by fitting the template, which can improve the efficiency of obtaining practical reply text.

[0125] On the basis of any embodiment of the method of the present application, after obtaining the practical reply text to answer the user's latest question, it includes:

[0126] Step S5500, storing and appending the user's latest question and its corresponding practical reply text to the historical chat record;

[0127] The above embodiments of the present application mainly explain the case that the current user proposes the latest query question at a time, but it is not difficult to understand that in the multi-round conversation between the current user and the customer service robot, each round can apply the processing process of the above embodiments of the present application to implement.

[0128] Therefore, in the present embodiment, after the answering interface obtains the practical reply text corresponding to the latest query question of the user through the large language model, the customer service robot outputs the practical reply text to the chat interface where the current user is located, so that the current user obtains the corresponding reply, and in the background, the latest query question of the current user and the practical reply text are stored into the historical chat record in the background as the single-round conversation question and answer text corresponding to one question and one answer, for calling in the next round of conversation, to continuously support multi-round conversation, so that the latest conversation question and answer text is used to construct the induced prompt document in each round of conversation.

[0129] Step S5600, in response to the problem submission event triggered by the current user again, the step of constructing the induced prompt document based on the historical chat record between the current user and the customer service robot and the latest query question of the current user continues iteration.

[0130] When the user obtains the practical reply text of the last round of conversation, the user can continue to input a new query question as a new latest query question, thereby returning to step S5100 of the present application to continue cyclic iteration, so as to continue to determine the practical reply text corresponding to the new latest query question, and so on. Therefore, the method of the present application can be applied to determine the practical reply text corresponding to the query question in each round of conversation between the user and the customer service robot, to improve the accuracy of the customer service robot in replying to the latest query question of the user.

[0131] According to the above embodiments, by applying the method of the present application to each round of conversation between the user and the customer service robot, it can be ensured that the effective practical reply text can be determined for the query question of the user in the multi-round conversation, and the practical reply text can be determined in association with the previous multi-round conversation at all times, fully considering the chat context of the entire chat session, improving the degree of personification of the customer service robot in the answering process, and making the communication between the two parties more natural, smooth and accurate.

[0132] On the basis of any embodiment of the method of the present application, please refer to Figure 5 , before constructing the induced prompt document based on the historical chat record between the current user and the customer service robot and the latest query question of the current user, comprising:

[0133] Step S3100, obtaining the customer service guidance document of the online store, and segmenting the customer service guidance document into multiple knowledge segments, each knowledge segment being used to explain at least one knowledge point related to the transaction process of the online store;

[0134] In this embodiment, the characteristics of the online store of the e-commerce platform can be adapted, and the pre-customized customer service guidance document of the online store can be used to improve the knowledge of the question and answer knowledge base, thereby improving the effectiveness of the practical reply text generated by the large language model based on the answer knowledge fragments in the question and answer knowledge base.

[0135] The customer service guidance document can be various text storage formats, and the content therein is usually used to explain various knowledge points related to the transaction process of the online store. For example, in the goods delivery link, knowledge points about delivery time, logistics units, etc., for example, in the pre-sale link of goods, knowledge points related to the price and function of goods, etc., and for example, in the after-sale link of goods, knowledge points related to the maintenance of goods, etc. According to people's usual habits of expressing things, each knowledge point is usually described independently, so the customer service guidance document is generally structured.

[0136] Accordingly, the structured information of the customer service guidance document can be parsed, and then the customer service guidance document can be divided into multiple knowledge fragments according to the document structure represented by the structured information, so that each knowledge fragment can relatively completely describe one knowledge point, and each knowledge fragment can also involve other associated knowledge points. In this way, each knowledge point can be relatively independent.

[0137] Step S3200, formatting each knowledge fragment to convert each knowledge fragment into an answer knowledge fragment;

[0138] Since the customer service guidance document is usually a user-customized document, each knowledge fragment may have some format deficiencies, such as redundant characters, misspelled words, and incorrect sentences, which may affect the reasoning quality. Therefore, each knowledge fragment can be formatted according to a preset format, such as removing redundant characters, correcting misspelled words, or correcting incorrect sentences.

[0139] In one embodiment, a large language model can also be called to complete the formatting processing of each knowledge fragment. As long as the corresponding knowledge fragment is input into the task prompt of the large language model, the reasoning-corrected text thereof can be obtained, which can be used as the corresponding answer knowledge fragment.

[0140] Step S3300, converting the answer knowledge fragment into a vector representation and storing it in association with the answer knowledge fragment in the question and answer knowledge base.

[0141] Finally, adapting to the construction of the question and answer knowledge base is required, and according to the exemplary description of the question and answer knowledge base in the foregoing, with the help of the corresponding text feature extraction model, each answer knowledge fragment generated from the customer service guide document can be converted into a corresponding vector representation to obtain a feature vector, and then each answer knowledge fragment and its corresponding feature vector are stored in the question and answer knowledge base, which can serve the generation of practical reply text and provide the large language model with answer knowledge fragments matching the initial reply text to help the customer service robot generate accurate reply text.

[0142] As can be seen from the above embodiments, for online stores, as long as the customer service guide document is written in accordance with the natural language habit and the knowledge points of each link related to the transaction process of the online store are expressed therein, the document can be converted and stored in the question and answer knowledge base by means of the embodiments, and then in the process of multi-round conversation of the user using the customer service robot, the corresponding practical reply text can be generated for the latest user question through each related answer knowledge fragment in the question and answer knowledge base, thereby improving the intelligent degree of the customer service support system.

[0143] Please refer to Figure 6 According to an aspect of the present application, a user question and answer device is provided, which comprises an induction construction module 5100, an induction output module 5200, a practical construction module 5300, and a practical output module 5400. The induction construction module 5100 is configured to construct an induction prompt document based on the historical chat record between the current user and the customer service robot and the latest user question of the current user. The induction output module 5200 is configured to call a large language model, input the induction prompt document, obtain a user standard question that re-expresses the latest user question to make its semantics complete and self-consistent, and a preliminary reply text corresponding to the user standard question. The practical construction module 5300 is configured to recall a plurality of answer knowledge fragments that match the semantics of the preliminary reply text according to the preliminary reply text, and construct a practical prompt document in combination with the user standard question. The practical output module 5400 is configured to call a large language model, input the practical prompt document, and obtain a practical reply text to answer the latest user question.

[0144] On the basis of any embodiment of the device of the present application, the induction construction module 5100 comprises: a response execution unit configured to, in response to a current user triggering a question submission event, obtain a latest question of the user corresponding to the question submission event and a historical chat record before the latest question of the user, and the historical chat record has a character length less than a preset character length threshold; an induction template calling unit configured to obtain an induction prompt template, the induction prompt template comprising a format specification indicating typesetting of the historical chat record to be fitted in and the latest question of the user and a plurality of task prompts, wherein a first task prompt indicates that a user standard question with complete semantics and self-consistency is obtained by rephrasing the latest question of the user according to the fitted historical chat record, and a second task prompt indicates that a preliminary reply text corresponding to the user standard question is generated; and an induction template fitting unit configured to fit the historical chat record and the latest question of the user into the induction prompt template according to the format specification of the induction prompt template, to obtain an induction prompt document with a character length less than a maximum input length constrained by the large language model.

[0145] On the basis of any embodiment of the device of the present application, the user question answering device of the present application comprises: a topic quantification module configured to determine a topic relevance between each single dialogue question and answer text contained in the historical chat record and the latest question of the user; a logic quantification module configured to determine a logic relevance between each single dialogue question and answer text contained in the historical chat record and the latest question of the user; a comprehensive evaluation module configured to determine an overall relevance between each single dialogue question and answer text and the latest question of the user according to the topic relevance and the logic relevance; and a record optimization module configured to filter out dialogue question and answer texts in the historical chat record with an overall relevance lower than a preset threshold, and retain other dialogue question and answer texts.

[0146] On the basis of any embodiment of the device of the present application, the utility construction module 5300 comprises: a similarity operation unit configured to calculate semantic similarity between a vector representation of the preliminary reply text and vector representations of each answer knowledge segment in a preset question and answer knowledge base; and a screening and recalling unit configured to screen and recall a plurality of answer knowledge segments with a semantic similarity satisfying a preset condition, according to the semantic similarity obtained by each answer knowledge segment, subject to a maximum input length of the large language model.

[0147] On the basis of any embodiment of the device of the present application, the utility construction module 5300 comprises: a utility template calling module configured to obtain a utility prompt template, the utility prompt template containing format specifications and task prompts for indicating the typesetting of a plurality of answer knowledge segments and user standard questions to be fitted in, the task prompts indicating that a utility reply text corresponding to the user standard questions is generated according to the plurality of answer knowledge segments; and a utility template calling module configured to fit the plurality of answer knowledge segments and the user standard questions into the utility prompt template according to the format specifications of the utility prompt template, to obtain a utility prompt document with a character length less than the maximum input length constrained by the large language model.

[0148] On the basis of any embodiment of the device of the present application, the user question answering device of the present application comprises: a data appending module configured to store and append the user latest question and the utility reply text corresponding thereto into the historical chat record; and a response iteration module configured to, in response to a question submission event triggered again by the current user, return to the step of constructing the induced prompt document based on the historical chat record between the current user and the customer service robot and the user latest question of the current user, and continue iteration.

[0149] On the basis of any embodiment of the device of the present application, the user question answering device of the present application comprises: a document obtaining module configured to obtain a customer service guidance document of an online store, and split the customer service guidance document into a plurality of knowledge segments, each knowledge segment being used to explain at least one knowledge point related to a transaction process of the online store; a processing and converting module configured to perform format processing on each knowledge segment, and convert each knowledge segment into an answer knowledge segment; and a data storage module configured to convert the answer knowledge segment into a vector representation, and store the answer knowledge segment in association with the vector representation in a question and answer knowledge base.

[0150] Another embodiment of the present application also provides a user question answering device. As shown in Figure 7 The user question answering device comprises a processor, a computer readable storage medium, a memory and a network interface connected through a system bus. The computer readable non-volatile storage medium of the user question answering device stores an operating system, a database and computer readable instructions. The database can store information sequences. When the computer readable instructions are executed by the processor, the processor can implement a user question answering method.

[0151] The processor of the user question answering device is configured to provide computing and control capabilities to support the operation of the entire user question answering device. The memory of the user question answering device can store computer readable instructions which, when executed by the processor, cause the processor to perform the user question answering method of the present application. The network interface of the user question answering device is configured to communicate with the terminal.

[0152] Those skilled in the art can understand that, Figure 7 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the user question answering device to which the scheme of the present application is applied. A specific user question answering device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0153] The processor in the embodiment is configured to perform the specific functions of each module in Figure 6 The memory stores program codes and various data required for executing the above-mentioned modules or sub-modules. The network interface is configured to realize data transmission between the user terminal or the server. The non-volatile readable storage medium in the embodiment of the present application stores program codes and data required for executing all modules in the user question answering device of the present application. The server can call the program codes and data of the server to execute the functions of all modules.

[0154] The present application also provides a non-volatile readable storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the user question answering method of any embodiment of the present application.

[0155] The present application also provides a computer program product including computer programs / instructions which, when executed by one or more processors, implement the steps of the method described in any embodiment of the present application.

[0156] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the present application can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of each method. The storage medium can be a computer readable storage medium such as a magnetic disc, an optical disc, a read-only memory (ROM), or a random access memory (RAM).

[0157] In summary, the application can adapt to the characteristics of a large language model, utilize the semantic correlation between the historical chat records in the multi-turn dialogue and the original latest user question, more accurately hit the answer knowledge fragments related to the semantic of the latest user question, and help the large language model efficiently generate accurate and practical reply texts to complete the customer service response.

Claims

1. A user question and answer method, characterized in that, include: Based on the historical chat history between the current user and the customer service robot and the current user's latest questions, construct an inducement prompt document; Call the large language model, input the prompt document, and obtain the user's standard question that has been restated to make the latest user question semantically complete and self-consistent, as well as the preliminary response text corresponding to the user's standard question; Based on the preliminary response text, multiple answer knowledge fragments that semantically match the preliminary response text are recalled, and combined with the user's standardized questions, a practical prompt document is constructed. The large language model is invoked, and the aforementioned practical prompt document is input to obtain a practical response text to the user's latest question. The process of constructing an inductive prompt document based on the historical chat history between the current user and the customer service robot and the current user's latest questions includes: In response to a question submission event triggered by the current user, retrieve the user's latest question corresponding to the question submission event and the historical chat history before the user's latest question, wherein the character length of the historical chat history is less than a preset character length threshold; Obtain an inducement prompt template, which includes format specifications for formatting the historical chat records to be inserted and the latest user question, as well as multiple task prompts. The first task prompt indicates that the latest user question should be restated based on the historical chat records to be inserted to obtain a semantically complete and self-consistent user standard question. The second task prompt indicates that a preliminary response text corresponding to the user standard question should be generated. Following the format specifications of the aforementioned prompt template, the historical chat records and the user's latest question are fitted into the prompt template to obtain a prompt document with a character length less than the maximum input length constrained by the large language model.

2. The user question and answer method according to claim 1, characterized in that, Before constructing the inductive prompt document based on the historical chat history between the current user and the customer service robot and the current user's latest question, the following are included: Determine the topic relevance between each individual dialogue question and answer text contained in the historical chat history and the current user's latest question; Determine the logical relevance between each individual dialogue question and answer text contained in the historical chat history and the current user's latest question; The overall relevance between each individual dialogue question and answer text and the user's latest question is determined based on the topic relevance and logical relevance. Filter out dialogue texts in the historical chat history whose overall relevance is lower than a preset threshold, and retain other dialogue texts.

3. The user question and answer method according to claim 1, characterized in that, Based on the preliminary response text, multiple answer knowledge fragments that semantically match the preliminary response text are recalled, including: The semantic similarity is calculated between the vector representation of the initial response text and the vector representation of each answer knowledge fragment in the preset question-and-answer knowledge base. Based on the semantic similarity obtained for each answer knowledge fragment, multiple answer knowledge fragments whose semantic similarity meets the preset conditions are filtered and recalled, subject to the maximum input length of the large language model.

4. The user question and answer method according to claim 1, characterized in that, Based on the aforementioned user-defined question guidelines, a practical tips document is constructed, including: Obtain a practical prompt template, which includes format specifications and task prompts for arranging multiple answer knowledge fragments and user-standard questions to be applied. The task prompts indicate how to generate practical answer text corresponding to the user-standard questions based on the multiple answer knowledge fragments. Following the format specifications of the practical hint template, the multiple answer knowledge fragments and the user-defined questions are fitted into the practical hint template to obtain a practical hint document with a character length less than the maximum input length constrained by the large language model.

5. The user question and answer method according to any one of claims 1 to 4, characterized in that, After obtaining a practical text response to the user's latest question, including: The user's latest question and its corresponding practical answer text are stored and appended to the chat history; In response to the current user's re-submitted question event, the process returns to the step of constructing an inductive prompt document based on the historical chat history between the current user and the customer service robot and the current user's latest question, and continues to iterate.

6. The user question and answer method according to any one of claims 1 to 4, characterized in that, Before constructing the inductive prompt document based on the historical chat history between the current user and the customer service robot and the current user's latest question, the following are included: Obtain the customer service guidance document of the online store, and divide the customer service guidance document into multiple knowledge segments. Each knowledge segment is used to explain at least one knowledge point related to the transaction process of the online store. Each knowledge segment is formatted and converted into a solution knowledge segment; The answer knowledge fragment is converted into a vector representation and stored in the question-and-answer knowledge base in association with the answer knowledge fragment.

7. A user question and answer device, characterized in that, include: The inducement construction module is set to construct an inducement prompt document based on the historical chat history between the current user and the customer service robot and the latest questions asked by the current user. The induced output module is configured to call a large language model, input the induced prompt document, and obtain a user-standard question that has been restated to make the latest user question semantically complete and self-consistent, as well as a preliminary response text corresponding to the user-standard question. The practical construction module is configured to recall multiple answer knowledge fragments that semantically match the initial response text based on the initial response text, and construct a practical prompt document in conjunction with the user's standardized question. The practical output module is configured to call the large language model, input the practical prompt document, and obtain a practical reply text response to the user's latest question. The induced construction module includes: The response execution unit is configured to respond to a question submission event triggered by the current user, obtain the user's latest question corresponding to the question submission event and the historical chat history before the user's latest question, wherein the character length of the historical chat history is less than a preset character length threshold; The inducement template calling unit is set to obtain an inducement prompt template. The inducement prompt template includes a format specification that indicates the formatting of the historical chat records to be inserted and the latest user question, as well as multiple task prompts. The first task prompt indicates that the latest user question should be restated according to the historical chat records to be inserted to obtain a semantically complete and self-consistent user standard question. The second task prompt indicates that a preliminary answer text corresponding to the user standard question should be generated. The inducement template application unit is configured to apply the historical chat history and the user's latest question into the inducement prompt template according to the format specifications of the inducement prompt template, so as to obtain an inducement prompt document with a character length less than the maximum input length constrained by the large language model.

8. The user question and answer device according to claim 7, characterized in that, The practical construction module includes: The similarity operation unit is configured to calculate the semantic similarity between the vector representation of the preliminary response text and the vector representation of each answer knowledge fragment in the preset question-and-answer knowledge base; The filtering and recall unit is configured to filter and recall multiple answer knowledge fragments that meet the preset conditions based on the semantic similarity obtained for each answer knowledge fragment, subject to the maximum input length of the large language model.

9. A user query and response device, comprising a central processing unit and a memory, characterized in that, The central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method as described in any one of claims 1 to 6.

10. A non-volatile readable storage medium, characterized in that, It stores, in the form of computer-readable instructions, a computer program implemented according to any one of claims 1 to 6, which, when invoked by a computer, executes the steps included in the corresponding method.

Citation Information

Patent Citations

  • AI-driven project automation method and system based on stage retraining

    CN116468131A

  • Collaborative user support portal

    US20220261817A1