An agent-based knowledge question answering system

By using an agent-based knowledge question-answering system, relevant API description texts are filtered using intent tags and semantic feature vectors, which solves the problems of information redundancy and interference in existing technologies and improves the accuracy and interpretability of the answer text.

CN121029951BActive Publication Date: 2026-02-06MOBILE TECH COMPANY CHINA TRAVELSKY HLDG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511546895.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-28
Publication Date
2026-02-06
Estimated Expiration
2045-10-28

AI Technical Summary

Technical Problem

Existing knowledge-based question-answering systems suffer from reduced accuracy in answer text due to information redundancy and interference from irrelevant or low-relevance API description text when processing a large number of APIs, exceeding the input length limit of large language models.

Method used

An agent-based knowledge question answering system is adopted. Through API knowledge base, vector library and agent, relevant API description text is filtered by intention tags and semantic feature vectors, API prompt text is constructed and sent to the large language model in the agent to generate the answer.

Benefits of technology

Effectively control the length of API prompt text, eliminate irrelevant interference, improve the accuracy and interpretability of answer text, and avoid the risk of logical contradictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121029951B_ABST
    Figure CN121029951B_ABST
Patent Text Reader

Abstract

The application provides an agent-based knowledge question answering system, and relates to the technical field of knowledge question answering, which determines a target intent label from a plurality of preset intent labels based on received question text; takes the semantic feature vector in the API vector sub-library corresponding to the preset intent label consistent with the target intent label as an API comparison vector, and determines a plurality of API description texts strongly related to the question text based on the semantic feature vector of the question text and the API comparison vector; sends the API prompt text obtained by splicing the plurality of API description texts to the agent together with the question text to obtain an answer text corresponding to the question text; effectively controls the length of the API prompt text, excludes the interference of irrelevant or low-relevance API description texts, significantly reduces the risk that the content generated by the large language model does not match the facts or is logically self-contradictory, and improves the accuracy of the generated answer text.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of knowledge question answering, and in particular to a knowledge question answering system based on an agent. BACKGROUND

[0002] The existing knowledge question answering system usually relies on a large language model; in some complex business scenarios, for example, the civil aviation scenario, the knowledge question answering system usually splices the description text of all APIs related to the target object with the question text input by the user to construct a prompt text, and inputs the prompt text into the large language model, so that the large language model generates the answer text of the question text; wherein the target object can be understood as the overall category of civil aviation business. However, with the rapid growth of the number of APIs related to the target object, when the number of APIs related to the target object is large, directly splicing the description text of all APIs related to the target object will result in a prompt text that is too long, exceeding the model input length limit, causing information redundancy; and a large amount of irrelevant or low-relevant API description texts will interfere with the judgment of the large language model, significantly increasing the risk of the generated content being inconsistent with the facts or logically self-contradictory, thereby seriously affecting the accuracy of the generated answer text. SUMMARY

[0003] In view of the above technical problems, the technical scheme adopted by the present application is as follows:

[0004] A knowledge question answering system based on an agent, the knowledge question answering system comprising: an API knowledge base, a vector library and an agent; the API knowledge base comprising API description texts of each API corresponding to a target object; each API description text corresponding to a preset intent label; the vector library comprising a plurality of API vector sub-libraries corresponding to the API knowledge base; each API vector sub-library corresponding to a preset intent label; the API vector sub-library comprising semantic feature vectors of each API description text corresponding to the preset intent label corresponding to the API vector sub-library; the knowledge question answering system being configured to perform the following steps:

[0005] S1, determining a target intent label B corresponding to a question text A received from a plurality of preset intent labels.

[0006] S2, storing the semantic feature vectors stored in the API vector sub-library corresponding to the preset intent label consistent with B as API comparison vectors corresponding to A.

[0007] S3, obtaining an API similarity list C corresponding to A, the C comprising a plurality of API similarities corresponding to A and the plurality of API similarities being sorted in descending order; the API similarity being a vector similarity between the semantic feature vector of A and the API comparison vector corresponding to A.

[0008] S4. Concatenate the API description texts corresponding to the first n API similarities in C to form the API hint text T corresponding to the large language model M in the agent; n is the preset number of retrieval returns corresponding to the API knowledge base.

[0009] S5. Send A and T to the agent so that M can obtain the answer text corresponding to A based on A and T.

[0010] The present invention has at least the following beneficial effects:

[0011] This invention provides a knowledge question-answering system based on an intelligent agent. The system includes an API knowledge base, a vector library, and an intelligent agent. The API knowledge base includes API description text for each API corresponding to the target object; each API description text corresponds to a preset intent tag. The vector library includes several API vector sub-libraries corresponding to the API knowledge base; each API vector sub-library corresponds to a preset intent tag; each API vector sub-library includes semantic feature vectors for each API description text corresponding to its preset intent tag. Based on the received question text, the system determines the target intent tag from several preset intent tags; the semantic feature vectors stored in the API vector sub-libraries corresponding to the preset intent tags that match the target intent tag are used as the API comparison vectors corresponding to the question text; an API similarity list is constructed based on the vector similarity between the semantic feature vectors of the question text and the API comparison vectors corresponding to the question text, and the API description texts corresponding to the first n API similarities are concatenated to form the API prompt text corresponding to the large language model in the intelligent agent; the question text and the API prompt text are sent to the intelligent agent so that the large language model in the intelligent agent can obtain the answer text based on the question text and the API prompt text. As can be seen, this invention achieves precise filtering of relevant APIs by introducing intent tags, enhanced retrieval generation, and an intelligent agent. It uses only the semantic feature vectors from the API vector sub-library corresponding to preset intent tags that match the target intent tag as the API comparison vectors corresponding to the question text. Based on the semantic feature vectors of the question text and the corresponding API comparison vectors, it determines n API description texts strongly related to the question text. The API prompt text obtained by concatenating these n API description texts and the question text are sent to the intelligent agent, enabling the large language model in the agent to obtain the answer text based on the question text and API prompt text. This effectively controls the length of the API prompt text, avoiding exceeding the input length limit of the large language model. Furthermore, it eliminates interference from irrelevant or low-relevance API description texts, significantly reducing the risk of the large language model generating content that is inconsistent with the facts or logically contradictory, thus improving the accuracy of the generated answer text. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart illustrating the steps performed by an agent-based knowledge question-answering system according to an embodiment of the present invention. Detailed Implementation

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar tasks and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0016] Embodiments of the present invention provide a knowledge question-answering system based on an intelligent agent. The knowledge question-answering system includes: an API knowledge base, a vector library, and an intelligent agent; the API knowledge base includes API description text for each API corresponding to the target object; each API description text corresponds to a preset intent tag; the vector library includes several API vector sub-libraries corresponding to the API knowledge base; each API vector sub-library corresponds to a preset intent tag; the API vector sub-library includes semantic feature vectors of each API description text corresponding to its preset intent tag; the knowledge question-answering system is used to perform the following steps, such as... Figure 1 As shown:

[0017] S1. Based on the received question text A, determine the target intent tag B corresponding to A from several preset intent tags.

[0018] Specifically, the question text is input into the knowledge question-and-answer system by the target user, where the target user is a user of the knowledge question-and-answer system.

[0019] In one specific embodiment, the target object is the overall scope of civil aviation business, including operations control, passenger services, ground operations, flight management and other businesses.

[0020] Specifically, the API corresponding to the target object can be understood as the API that serves the target object, and the API is an application programming interface.

[0021] Specifically, API description text is text used to describe relevant information about the API, including but not limited to: API name, API function, API input parameters, and API output parameters.

[0022] Specifically, in step S1, A is input into the intent recognition model to obtain B.

[0023] Furthermore, the intent recognition model is used to receive question text and classify it based on several preset intent tags to output a target intent tag; wherein, when the confidence level of a preset intent tag is higher than a preset threshold, the preset intent tag is determined as the target intent tag.

[0024] Specifically, the preset intent tags are classification tags that are pre-set by those skilled in the art based on actual needs and can reflect the semantic intent of the question; for example: API call; flight status query; flight order query; and so on.

[0025] In one specific embodiment, the intent recognition model is a model obtained by supervising the training of a deep learning model using a training sample set, for example: supervising the training of a BERT model using a training sample set to obtain the intent recognition model.

[0026] Furthermore, the training sample set includes several training samples, each training sample including a preset question text and a target intent tag corresponding to the preset question text. The preset question text is a question text pre-determined by those skilled in the art based on actual needs, and the target intent tag corresponding to the preset question text is determined manually from several preset intent tags.

[0027] S2. Use the semantic feature vector stored in the API vector sub-library corresponding to the preset intent label that is consistent with B as the API comparison vector corresponding to A.

[0028] In a specific embodiment, if the number of target intent tags is greater than 1, then for each target intent tag, the semantic feature vector stored in the API vector sub-library corresponding to the preset intent tag that is consistent with the target intent tag is used as the API comparison vector corresponding to A.

[0029] In a specific embodiment, if the target intent label cannot be obtained, it can be understood that if the output of the intent recognition model is NULL, then for each API vector sub-library, the semantic feature vector stored in the API vector sub-library is used as the API comparison vector corresponding to A.

[0030] Through the above steps, when the target intent tag can be obtained, only the semantic feature vectors in the API vector sub-library corresponding to the preset intent tag that matches the target intent tag are used as the API comparison vectors corresponding to the question text. Based on the semantic feature vectors of the question text and the API comparison vectors corresponding to the question text, n API description texts that are strongly related to the question text are determined. It is not necessary to obtain the similarity between the semantic feature vectors of the question text and the semantic feature vectors in each API vector sub-library, which reduces the amount of data processing and improves the data processing efficiency. Furthermore, even if the target intent tag cannot be obtained, the API comparison vectors corresponding to the question text can still be obtained. Thus, based on the semantic feature vectors of the question text and the API comparison vectors corresponding to the question text, n API description texts that are strongly related to the question text are determined. The API prompt text obtained by concatenating the n API description texts and the question text are sent to the agent so that the large language model in the agent can obtain the answer text based on the question text and the API prompt text. It can effectively control the length of the API prompt text and avoid exceeding the input length limit of the large language model. It can also eliminate the interference of irrelevant or low-relevance API description texts, significantly reduce the risk that the content generated by the large language model is inconsistent with the facts or logically contradictory, and improve the accuracy of the generated answer text.

[0031] In a specific embodiment, for each API description text, the API description text is processed to obtain structured data corresponding to the API description text; the structured data is input into the target embedding model to obtain the semantic feature vector corresponding to the API description text; the target embedding model is obtained by performing domain fine-tuning on a general embedding model based on target object-related corpus; for example, it is obtained by performing domain fine-tuning on BGE-M3 based on target object-related corpus.

[0032] S3. Obtain the API similarity list C corresponding to A. C includes several API similarities corresponding to A and the several API similarities are sorted in descending order. The API similarity is the vector similarity between the semantic feature vector of A and the API comparison vector corresponding to A.

[0033] Specifically, the higher the API similarity, the more similar the semantic feature vector of A is to the API comparison vector corresponding to the API similarity.

[0034] In one specific embodiment, the vector distance between the semantic feature vector of A and the API comparison vector corresponding to A is converted into a value between 0 and 1, and the value is used as the API similarity corresponding to A. The smaller the vector distance between the semantic feature vector of A and the API comparison vector corresponding to A, the closer the value between 0 and 1 converted from the vector distance is to 1; the larger the vector distance between the semantic feature vector of A and the API comparison vector corresponding to A, the closer the value between 0 and 1 converted from the vector distance is to 0. This ensures that the higher the API similarity, the more similar the semantic feature vector of A is to the API comparison vector corresponding to the API similarity. Any existing method for converting vector distance into a value between 0 and 1, such that the smaller the vector distance, the closer the value between 0 and 1 converted from the vector distance is to 1, and the larger the vector distance, the closer the value between 0 and 1 converted from the vector distance is to 0, falls within the protection scope of this invention and will not be elaborated further here.

[0035] S4. Concatenate the API description texts corresponding to the first n API similarities in C to form the API hint text T corresponding to the large language model M in the agent; n is the preset number of retrieval returns corresponding to the API knowledge base.

[0036] Specifically, the preset number of retrieval returns for the API knowledge base is a number that is pre-set by those skilled in the art according to actual needs, such as 3, 4, 5, or 6, which will not be elaborated here.

[0037] Specifically, the API prompt text is used to provide M with information about the API related to the question text, so that M can make its own decision on whether to initiate an API call and which API calls to initiate based on the question text and the relevant information about the APIs related to the question text.

[0038] S5. Send A and T to the agent so that M can obtain the answer text corresponding to A based on A and T.

[0039] Specifically, an intelligent agent is a software module that integrates a large language model, several external API interfaces, and several callable functions.

[0040] Through the above steps, based on the received question text, a target intent tag is determined from several preset intent tags; the semantic feature vector stored in the API vector sub-library corresponding to the preset intent tag that matches the target intent tag is used as the API comparison vector corresponding to the question text; an API similarity list is constructed based on the vector similarity between the semantic feature vector of the question text and the API comparison vector corresponding to the question text, and the API description text corresponding to the top n API similarities is concatenated to form the API prompt text corresponding to the large language model in the agent; the question text and API prompt text are sent to the agent so that the large language model in the agent can obtain the answer text based on the question text and API prompt text. This approach introduces intent tags, enhanced retrieval generation, and an agent, achieving accurate filtering of relevant APIs; effectively controlling the length of the API prompt text to avoid exceeding the input length limit of the large language model; and eliminating interference from irrelevant or low-relevance API description text, significantly reducing the risk of the large language model generating content that is inconsistent with the facts or logically contradictory, thus improving the accuracy of the generated answer text.

[0041] Specifically, the knowledge question-answering system also includes a document knowledge base and a wide table knowledge base; the document knowledge base includes several documents describing information related to the target object, each document includes several text blocks, and each text block corresponds to a first preset intent tag; the wide table knowledge base includes wide table description text for each data wide table related to the target object; each wide table description text corresponds to a preset intent tag.

[0042] Specifically, the document describing the relevant information of the target object can be understood as textual material containing knowledge of the domain to which the target object belongs, used for knowledge question answering; the document can be obtained by crawling the web and then organizing it, or by long-term accumulation of business data.

[0043] Furthermore, the documents describing information related to the target object are cleaned and segmented to obtain text blocks corresponding to the documents; the text blocks are then input into the target embedding model to obtain semantic feature vectors corresponding to the text blocks.

[0044] Specifically, the wide table description text is a text that provides a detailed description of a wide data table containing multi-dimensional information, including but not limited to the overall structure of the wide data table, the meaning of its fields, the data source, the update logic, and the use cases.

[0045] Furthermore, the wide table description text is input into the target embedding model to obtain the semantic feature vector corresponding to the wide table description text.

[0046] Furthermore, the vector library also includes several document vector sub-libraries corresponding to the document knowledge base and several wide table vector sub-libraries corresponding to the wide table knowledge base; each document vector sub-library corresponds to a preset intent tag; the first document vector sub-library includes the semantic feature vector of each text block corresponding to its preset intent tag; each wide table vector sub-library corresponds to a preset intent tag; the wide table vector sub-library includes the semantic feature vector of each wide table description text corresponding to its preset intent tag.

[0047] Specifically, the following steps are included before step S5:

[0048] S10. Use the semantic feature vector stored in the document vector sub-library corresponding to the preset intent tag that is consistent with B as the document comparison vector corresponding to A.

[0049] In a specific embodiment, if the number of target intent tags is greater than 1, then for each target intent tag, the semantic feature vector stored in the document vector sub-library corresponding to the preset intent tag that is consistent with the target intent tag is used as the document comparison vector corresponding to A.

[0050] In a specific embodiment, if the target intent tag cannot be obtained, then for each document vector sub-library, the semantic feature vector stored in the document vector sub-library is used as the document comparison vector corresponding to A.

[0051] S20. Obtain the document similarity list D corresponding to A. D includes several document similarities corresponding to A and the several document similarities are sorted in descending order. The document similarity is the vector similarity between the semantic feature vector of A and the document comparison vector corresponding to A.

[0052] Specifically, the higher the document similarity, the more similar the semantic feature vector of A is to the document comparison vector corresponding to the document similarity. The method of obtaining the vector similarity between the semantic feature vector of A and the document comparison vector corresponding to A is the same as the method of obtaining the vector similarity between the semantic feature vector of A and the API comparison vector corresponding to A, and will not be repeated here.

[0053] S30. Concatenate the text blocks corresponding to the similarity of the first m documents in D to form the contextual hint text T corresponding to M. 0 and T 0 Send to the agent; m is the preset number of documents returned by the document knowledge base.

[0054] Specifically, the preset number of results returned by the document knowledge base is a number that is pre-set by those skilled in the art according to actual needs, such as 3, 4, 5, or 6, which will not be elaborated here.

[0055] Specifically, contextual hint text is used to provide M with contextual information related to the question text.

[0056] Through the above steps, the semantic feature vectors stored in the document vector sub-library corresponding to the preset intent tag that matches the target intent tag are used as the document comparison vectors corresponding to the question text. Based on the vector similarity between the semantic feature vectors corresponding to the question text and the document comparison vectors corresponding to the question text, m text blocks that are strongly related to the question text are determined. The m text blocks are concatenated into contextual prompt text, and the contextual prompt text is sent to the agent. This effectively controls the length of the contextual prompt text, avoiding exceeding the input length limit of the large language model. Furthermore, it provides the large language model with contextual information that is strongly related to the question text, which can effectively improve the accuracy, credibility, and interpretability of the answer text generated by the large language model.

[0057] Specifically, the following steps are included before step S5:

[0058] S100. Use the semantic feature vector stored in the wide table vector sub-library corresponding to the preset intent label that is consistent with B as the data table comparison vector corresponding to A.

[0059] In a specific embodiment, if the number of target intent tags is greater than 1, then for each target intent tag, the semantic feature vector stored in the wide table vector sub-library corresponding to the preset intent tag that is consistent with the target intent tag is used as the data table comparison vector corresponding to A.

[0060] In a specific embodiment, if the target intent label cannot be obtained, then for each wide table vector sub-library, the semantic feature vector stored in the wide table vector sub-library is used as the data table comparison vector corresponding to A.

[0061] S200. Obtain the data table similarity list E corresponding to A. E includes several data table similarities corresponding to A, and the data table similarities are sorted in descending order. The data table similarity is the vector similarity between the semantic feature vector corresponding to A and the comparison vector of the data table corresponding to A.

[0062] Specifically, the higher the data table similarity, the more similar the semantic feature vector of A is to the data table comparison vector corresponding to the data table similarity. The method of obtaining the vector similarity between the semantic feature vector of A and the data table comparison vector of A is the same as the method of obtaining the vector similarity between the semantic feature vector of A and the API comparison vector of A, and will not be repeated here.

[0063] S300. Concatenate the wide table description text corresponding to the similarity of the first f data tables in E into the data table hint text T corresponding to M. 1 and T 1Send to the agent; f is the preset number of retrieval results corresponding to the wide table knowledge base.

[0064] Specifically, the preset number of search results returned by the wide table knowledge base is a number that is preset by those skilled in the art according to actual needs, such as 3, 4, 5, or 6, which will not be elaborated here.

[0065] Specifically, the data table hint text is used to provide M with relevant information about the wide data table related to the question text.

[0066] Through the above steps, the semantic feature vectors stored in the wide table vector sub-library corresponding to the preset intent tag that matches the target intent tag are used as the data table comparison vectors corresponding to the question text. Based on the vector similarity between the semantic feature vectors corresponding to the question text and the data table comparison vectors corresponding to the question text, f wide table description texts that are strongly related to the question text are determined. The f wide table description texts are concatenated into a data table prompt text, and the data table prompt text is sent to the agent. This effectively controls the length of the data table prompt text, avoiding exceeding the input length limit of the large language model. Furthermore, it provides the large language model with relevant information about the wide table that is strongly related to the question text, which can effectively improve the accuracy, credibility, and interpretability of the answer text generated by the large language model.

[0067] Specifically, step S5 includes the following steps:

[0068] S51, Send A and T to the intelligent agent.

[0069] S52, the agent will use A, T, T 0 and T 1 Concatenate them to form the data query text G corresponding to A.

[0070] S53. The agent sends G to M so that M can generate the answer text corresponding to A based on G.

[0071] Through the above steps, the question text, API hint text, context hint text, and data table hint text are concatenated into the data query text corresponding to the question text. The data query text is then sent to the large language model corresponding to the agent, enabling the large language model to generate the answer text corresponding to the question text based on the data query text. This achieves the collaborative utilization of multi-source heterogeneous knowledge, enhances the semantic understanding ability of the large language model, and allows the large language model to generate accurate, reliable, and interpretable answer text based on a full understanding of APIs, text blocks, and wide data tables strongly related to the question text.

[0072] Specifically, after step S52 and before step S53, the following steps are also included:

[0073] S521. If the amount of data in G is less than the preset amount of data, then each API similarity from the (n+1)th API similarity in C to the last API similarity in C, each document similarity from the (m+1)th document similarity in D to the last document similarity in D, and each data table similarity from the (f+1)th data table similarity in E to the last data table similarity in E are all used as candidate similarities for A to obtain a candidate similarity list F=(F1, F2, ..., F...). g F h ), F g Let F be the g-th candidate similarity corresponding to A, 1≤g≤h, where h is the number of candidate similarities corresponding to A; where F g ≥F g+1 F g+1 Let g be the (g+1)th candidate similarity for A.

[0074] Specifically, the preset data volume is the data volume that those skilled in the art set in advance according to actual needs, such as 50 kilobytes, 100 kilobytes, or 150 kilobytes, which will not be elaborated here.

[0075] Specifically, step S521 also includes: if the amount of data in G is not less than the preset amount of data, then proceed to step S53.

[0076] S522, when F g When it falls under API similarity, F g The corresponding API description text is as F g Corresponding candidate text F 1 g When F g When it falls under document similarity, F g The corresponding text block is F 1 g When F g When it belongs to the similarity of data tables, F g The corresponding wide table description text is as F 1 g .

[0077] S523, when ∑ g a=1 F 0 a ≤G 0 And ∑ g a=1 F 0 a +F 0 g+1 >G 0 When, if F 1 a If it belongs to the API documentation text, then F1 a Concatenate it into T so that T can be updated; if F 1 a If it belongs to a text block, then F 1 a spliced ​​to T 0 In order to make T 0 Update; if F 1 a If it belongs to the wide table description text, then F 1 a spliced ​​to T 1 In order to make T 1 Update; among them, F 0 a For F 1 a Data volume, F 1 a For F a The corresponding candidate text is 1≤a≤g; F 0 g+1 For F 1 g+1 Data volume, F 1 g+1 For F g+1 Corresponding candidate text; G 0 The difference is obtained by subtracting the data volume G from the preset data volume.

[0078] S524, based on T after all updates are completed. 0 and T 1 Update G.

[0079] Specifically, after the G update is complete, proceed to step S53.

[0080] Through the above steps, if the data volume of the query text is less than the preset data volume, it indicates that the current query text is too short and may not be able to provide sufficient knowledge support for the large language model. In this case, the remaining unselected API similarity, document similarity, and data table similarity are used as candidate similarities and sorted in descending order to construct a candidate similarity list. The candidate similarity list is considered complete when the sum of the data volumes of the candidate texts corresponding to the first g candidate similarities in the candidate similarity list is not greater than the difference between the preset data volume and G, and the sum of the data volumes of the candidate texts corresponding to the first g+1 candidate similarities in the candidate similarity list is greater than the preset data volume. When subtracting the data volume G to obtain the difference, the candidate texts corresponding to the top g candidate similarity scores in the candidate similarity list are concatenated to their corresponding API hint text, context hint text, or data table hint text, respectively. This updates the API hint text, context hint text, or data table hint text. The data query text is then updated based on the updated API hint text, context hint text, or data table hint text. Under the premise of not exceeding the preset data volume, highly relevant supplementary knowledge is introduced into the data query text as much as possible to enhance the completeness and richness of the input information, thereby improving the comprehensiveness and accuracy of the answer text generated by the large language model.

[0081] Specifically, the unit of measurement for the data volume of G, the preset data volume, and the candidate text data volume is kilobytes.

[0082] Specifically, after step S5, the method further includes sending the answer text corresponding to A to the target user.

[0083] Specifically, when the knowledge-based question-answering system receives a new question text, it obtains the new API hint text, the new context hint text, and the new data table hint text corresponding to M based on the new question text.

[0084] This invention provides a knowledge question-answering system based on an intelligent agent. The system includes an API knowledge base, a vector library, and an intelligent agent. The API knowledge base includes API description text for each API corresponding to the target object; each API description text corresponds to a preset intent tag. The vector library includes several API vector sub-libraries corresponding to the API knowledge base; each API vector sub-library corresponds to a preset intent tag; each API vector sub-library includes semantic feature vectors for each API description text corresponding to its preset intent tag. Based on the received question text, the system determines the target intent tag from several preset intent tags; the semantic feature vectors stored in the API vector sub-libraries corresponding to the preset intent tags that match the target intent tag are used as the API comparison vectors corresponding to the question text; an API similarity list is constructed based on the vector similarity between the semantic feature vectors of the question text and the API comparison vectors corresponding to the question text, and the API description texts corresponding to the first n API similarities are concatenated to form the API prompt text corresponding to the large language model in the intelligent agent; the question text and the API prompt text are sent to the intelligent agent so that the large language model in the intelligent agent can obtain the answer text based on the question text and the API prompt text. As can be seen, this invention achieves precise filtering of relevant APIs by introducing intent tags, enhanced retrieval generation, and an intelligent agent. It uses only the semantic feature vectors from the API vector sub-library corresponding to preset intent tags that match the target intent tag as the API comparison vectors corresponding to the question text. Based on the semantic feature vectors of the question text and the corresponding API comparison vectors, it determines n API description texts strongly related to the question text. The API prompt text obtained by concatenating these n API description texts and the question text are sent to the intelligent agent, enabling the large language model in the agent to obtain the answer text based on the question text and API prompt text. This effectively controls the length of the API prompt text, avoiding exceeding the input length limit of the large language model. Furthermore, it eliminates interference from irrelevant or low-relevance API description texts, significantly reducing the risk of the large language model generating content that is inconsistent with the facts or logically contradictory, thus improving the accuracy of the generated answer text.

[0085] While specific embodiments of the invention have been described in detail by way of examples, those skilled in the art should understand that the examples are for illustrative purposes only and are not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention.

Claims

1. A knowledge question-answering system based on intelligent agents, characterized in that, The knowledge-based question-answering system includes: an API knowledge base, a vector library, and an agent; the API knowledge base includes API description text for each API corresponding to the target object; each API description text corresponds to a preset intent tag; the vector library includes several API vector sub-libraries corresponding to the API knowledge base; each API vector sub-library corresponds to a preset intent tag; the API vector sub-library includes the semantic feature vector of each API description text corresponding to its preset intent tag; the knowledge-based question-answering system is used to perform the following steps: S1. Based on the received question text A, determine the target intent tag B corresponding to A from several preset intent tags; S2. Use the semantic feature vector stored in the API vector sub-library corresponding to the preset intent label that is consistent with B as the API comparison vector corresponding to A; wherein, A is input into the intent recognition model to obtain B. If the output result of the intent recognition model is NULL, then use the semantic feature vectors stored in all API vector sub-libraries as the API comparison vector corresponding to A. S3. Obtain the API similarity list C corresponding to A. C includes several API similarities corresponding to A, and the several API similarities are sorted in descending order. The API similarity is the vector similarity between the semantic feature vector of A and the API comparison vector corresponding to A. S4. Concatenate the API description texts corresponding to the first n API similarities in C to form the API prompt text T corresponding to the large language model M in the agent; n is the preset number of retrieval returns corresponding to the API knowledge base. S5. Send A and T to the agent so that M can obtain the answer text corresponding to A based on A and T; wherein, the agent sends A, T, and T 0 and T 1 Concatenate the data query text G corresponding to A, and send G to M so that M can generate the answer text corresponding to A based on G; T 0 T is the contextual hint text obtained based on the document similarity list D corresponding to A; 1 This is the prompt text for the data table obtained based on the data table similarity list E corresponding to A; Before the agent sends G to M, if the amount of data in G is less than the preset amount of data, then each API similarity from the (n+1)th API similarity in C to the last API similarity in C, each document similarity from the (m+1)th document similarity in D to the last document similarity in D, and each data table similarity from the (f+1)th data table similarity in E to the last data table similarity in E are used as candidate similarities for A to obtain a candidate similarity list F for A. The g-th candidate similarity in F is not less than the g+1-th candidate similarity in F; 1≤g≤h, where h is the number of candidate similarities for A. When the sum of the data amounts of the candidate texts corresponding to the first g candidate similarities in F is not greater than the difference between the preset amount of data and the amount of data in G, and the sum of the data amounts of the candidate texts corresponding to the first g+1 candidate similarities in F is greater than the difference between the preset amount of data and the amount of data in G, then the candidate texts corresponding to the first g candidate similarities in F are concatenated to their corresponding T and T'. 0 or T 1 In this context, G is updated; m is the preset number of retrieval returns corresponding to the document knowledge base; and f is the preset number of retrieval returns corresponding to the wide table knowledge base.

2. The agent-based knowledge question-answering system according to claim 1, characterized in that, The knowledge question-answering system also includes a document knowledge base and a wide table knowledge base; the document knowledge base includes several documents describing information related to the target object, each document includes several text blocks, and each text block corresponds to a first preset intent tag; the wide table knowledge base includes wide table description text for each data wide table related to the target object; each wide table description text corresponds to a preset intent tag.

3. The agent-based knowledge question-answering system according to claim 2, characterized in that, The vector library also includes several document vector sub-libraries corresponding to the document knowledge base and several wide table vector sub-libraries corresponding to the wide table knowledge base; each document vector sub-library corresponds to a preset intent tag; the first document vector sub-library includes the semantic feature vector of each text block corresponding to its preset intent tag; each wide table vector sub-library corresponds to a preset intent tag; the wide table vector sub-library includes the semantic feature vector of each wide table description text corresponding to its preset intent tag.

4. The agent-based knowledge question-answering system according to claim 3, characterized in that, The following steps are included before step S5: S10. Use the semantic feature vector stored in the document vector sub-library corresponding to the preset intent tag that is consistent with B as the document comparison vector corresponding to A. S20. Obtain D, which includes several document similarities corresponding to A and the document similarities are sorted in descending order. The document similarity is the vector similarity between the semantic feature vector of A and the document comparison vector corresponding to A. S30. Concatenate the text blocks corresponding to the similarity of the first m documents in D to form the contextual hint text T corresponding to M. 0 and T 0 Send to the intelligent agent.

5. The agent-based knowledge question-answering system according to claim 4, characterized in that, The following steps are included before step S5: S100. Use the semantic feature vector stored in the wide table vector sub-library corresponding to the preset intent label that is consistent with B as the data table comparison vector corresponding to A. S200. Obtain E, which includes the similarity of several data tables corresponding to A and the data table similarity is sorted in descending order. The data table similarity is the vector similarity between the semantic feature vector corresponding to A and the comparison vector of the data table corresponding to A. S300. Concatenate the wide table description text corresponding to the similarity of the first f data tables in E into the data table hint text T corresponding to M. 1 and T 1 Send to the intelligent agent.

6. The agent-based knowledge question-answering system according to claim 1, characterized in that, The units of measurement for the data volume of G, the preset data volume, and the candidate text data volume are all kilobytes.

7. The agent-based knowledge question-answering system according to claim 1, characterized in that, The higher the API similarity, the more similar the semantic feature vector of A is to the API comparison vector corresponding to the API similarity.

Citation Information

Patent Citations

  • Financial question and answer method, system and equipment based on multi-agent interaction and medium

    CN119539095A

  • Dynamic API Discovery System and Technique for Conversational Interfaces

    US20250110807A1