Question and answer information processing method and device, electronic equipment and storage medium
Through the question-answering information processing method that combines hierarchical indexing and large models, the efficiency and accuracy problems of large model and multi-index library question-answering solutions in resource-constrained environments are solved, and low-cost high-quality question-answering is achieved, which is suitable for resource-constrained environments.
Patent Information
- Application Number
- CN202510813556.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-16
AI Technical Summary
In resource-constrained environments, existing large-model and multi-index library question-answering solutions are difficult to run efficiently, require high computing resources, and have complex knowledge graph updates, making them difficult to adapt to various types of Chinese documents. This results in large delays in high-quality question-answering responses and makes them unsuitable for deployment on general hardware or resource-constrained scenarios.
A hierarchical indexing method is adopted to generate indexes by splitting documents into paragraphs, keywords and summaries, combining them with large models for cross-knowledge base retrieval, using paragraph indexes and structured information for efficient matching to generate target answer information, and guiding the large model to generate high-quality answers through compression rules and prompt text.
It reduces the computational resource overhead of cross-knowledge base retrieval, improves the accuracy and efficiency of answer generation, is suitable for resource-constrained environments, and provides a low-cost, high-quality question-answering solution.
Smart Images

Figure CN120653751A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of artificial intelligence technology, particularly large models, knowledge base retrieval, and intelligent agents, and is applicable to intelligent question-answering scenarios. More specifically, the present disclosure provides a question-answering information processing method, apparatus, intelligent agent, electronic device, and storage medium. Background Art
[0002] With the development of artificial intelligence technology, in order to accurately answer questions provided by users, large models or intelligent agents can search based on knowledge graphs or graph-structured data to determine the context of the question. Summary of the Invention
[0003] The present disclosure provides a question-and-answer information processing method, apparatus, device, and storage medium.
[0004] According to one aspect of the present disclosure, a method for processing question and answer information is provided, the method comprising: searching in a plurality of knowledge bases according to question information to be processed to obtain at least one target paragraph index for the question information to be processed, wherein the knowledge base comprises a plurality of initial documents, the initial document has at least one initial paragraph index, the initial paragraph index is generated according to the initial paragraph in the initial document, and the target paragraph index is an initial paragraph index having a first matching evaluation value with the question information to be processed greater than or equal to a first preset matching threshold; determining initial context data of the question information to be processed according to at least one first target document indicated by the at least one target paragraph index; and generating target answer information for the question information to be processed according to the initial context data.
[0005] According to another aspect of the present disclosure, a question and answer information processing device is provided, which includes: a retrieval module for searching in multiple knowledge bases according to the question information to be processed, and obtaining at least one target paragraph index for the question information to be processed, wherein the knowledge base includes multiple initial documents, the initial document has at least one initial paragraph index, the initial paragraph index is generated according to the initial paragraph in the initial document, and the target paragraph index is an initial paragraph index whose first matching evaluation value with the question information to be processed is greater than or equal to a first preset matching threshold; a determination module for determining the initial context data of the question information to be processed according to at least one first target document indicated by the at least one target paragraph index; and a generation module for generating target answer information for the question information to be processed based on the initial context data.
[0006] According to another aspect of the present disclosure, an intelligent agent is provided, including: an input module for receiving input information; a processing module for obtaining output information by calling a large model to execute the method provided in the present disclosure based on the input information received by the input module; and an output module for outputting the output information obtained by the processing module.
[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method provided according to the present disclosure.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided. The computer instructions are used to cause a computer to execute the method provided according to the present disclosure.
[0009] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the method provided according to the present disclosure when executed by a processor.
[0010] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0012] Figure 1 is a schematic diagram of an exemplary system architecture to which the question-answer information processing method and apparatus can be applied according to an embodiment of the present disclosure;
[0013] Figure 2 is a flowchart of a question-and-answer information processing method according to an embodiment of the present disclosure;
[0014] Figure 3 is a schematic diagram of structured information and paragraph index of a document according to an embodiment of the present disclosure;
[0015] Figure 4 is a block diagram of a question-and-answer information processing apparatus according to an embodiment of the present disclosure;
[0016] Figure 5 is a structural block diagram of an intelligent agent according to an embodiment of the present disclosure; and
[0017] Figure 6 4 is a block diagram of an electronic device to which a question-and-answer information processing method can be applied according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0019] Global question-answering solutions rely on large, resource-intensive models and multiple indexes. They struggle to operate efficiently in resource-constrained environments, such as local devices, mobile devices, or small servers. Furthermore, building and maintaining knowledge graphs for search requires significant human and computing resources. Knowledge graphs are complex to update, difficult to automate, and difficult to adapt to diverse Chinese documents.
[0020] Furthermore, multiple index libraries, including entity index libraries and relationship index libraries, are managed separately, resulting in complex structures and low maintenance and query efficiency. Furthermore, global question-answering solutions use large models with over 10 billion (10B) parameters, which can produce high-quality answers. However, these models require high computing resources and experience significant response latency, making them unsuitable for deployment on general-purpose hardware or in resource-constrained scenarios.
[0021] Therefore, in order to perform high-quality question and answer at a low cost, the present disclosure provides a question and answer information processing method, which will be described below.
[0022] Figure 1 This is a schematic diagram of an exemplary system architecture to which the question-answer information processing method and apparatus can be applied according to an embodiment of the present disclosure. It should be noted that: Figure 1 The examples shown are merely examples of system architectures to which the embodiments of the present disclosure may be applied, to help those skilled in the art understand the technical content of the present disclosure, but do not mean that the embodiments of the present disclosure may not be used in other devices, systems, environments or scenarios.
[0023] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0024] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices with display screens and support web browsing, including but not limited to smartphones, tablet computers, laptop computers, and desktop computers, etc.
[0025] Server 105 may be a server that provides various services, such as a background management server (for example only) that supports websites browsed by users using terminal devices 101, 102, and 103. The background management server may analyze and process received data such as user requests, and feed back processing results (e.g., web pages, information, or data obtained or generated based on user requests) to the terminal device.
[0026] It should be noted that the question-and-answer information processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the question-and-answer information processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The question-and-answer information processing method provided in the embodiment of the present disclosure can also be executed by the terminal devices 101, 102, and 103. Accordingly, the question-and-answer information processing device provided in the embodiment of the present disclosure can also be set in the terminal devices 101, 102, and 103. The question-and-answer information processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, and 103 and / or the server 105. Accordingly, the question-and-answer information processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, and 103 and / or the server 105.
[0027] It can be understood that the above describes the system architecture of the present disclosure, and the following will describe the method of the present disclosure.
[0028] Figure 2 4 is a flowchart of a method for processing question and answer information according to an embodiment of the present disclosure.
[0029] like Figure 2 As shown, the method 200 may include operations S210 to S230.
[0030] In operation S210 , a search is performed in multiple knowledge bases according to the question information to be processed to obtain at least one target paragraph index for the question information to be processed.
[0031] In the embodiment of the present disclosure, the question information to be processed may be a query provided by a user.
[0032] In an embodiment of the present disclosure, the knowledge base includes multiple initial documents. The initial document has at least one initial paragraph index. The initial paragraph index is generated based on the initial paragraph in the initial document. The target paragraph index is an initial paragraph index whose first matching evaluation value with the question information to be processed is greater than or equal to a first preset matching threshold. For example, the question information to be processed can be embedded to obtain a question embedding vector. The matching evaluation value between the question embedding vector and one or more initial paragraph indexes is determined. One or more initial paragraph indexes whose matching evaluation value with the question embedding vector is greater than or equal to the first preset matching threshold are used as one or more target paragraph indexes. In one example, the matching evaluation value can be determined based on the distance between the question embedding vector and the initial paragraph index. The smaller the distance, the higher the matching evaluation value. The initial paragraph index can be obtained by embedding one or more of the keywords, paragraph summaries, etc. of the initial paragraph.
[0033] In operation S220 , initial context data of the question information to be processed is determined according to at least one first target document indicated by at least one target paragraph index.
[0034] In the embodiment of the present disclosure, the target paragraph index may be an index of an initial paragraph in an initial document, and may indicate the initial paragraph. The initial document may serve as the first target document indicated by the target paragraph index.
[0035] In operation S230 , target answer information for the question information to be processed is generated according to the initial context data.
[0036] In the embodiment of the present disclosure, a large model can be used to generate target answer information for the question information to be processed based on the initial context data. The large model can be a large language model (LLM) or a multimodal large model.
[0037] Through the disclosed embodiments, matching paragraph indexes are determined based on question information, and then the corresponding documents are determined from the paragraph indexes. This enables cross-knowledge base retrieval based on a hierarchical index of documents, paragraphs, and paragraph indexes, effectively reducing the computational resource overhead of cross-knowledge base retrieval. Using the retrieved documents as context allows for comprehensive and closely related context to the question being processed, making the generated target answer more accurate and effectively improving the user experience.
[0038] It can be understood that the above describes the method of the present disclosure, and the following will describe the hierarchical index of the present disclosure.
[0039] Figure 3 Schematic diagram of structured information and paragraph index of a document according to an embodiment of the present disclosure.
[0040] In some embodiments, the initial paragraph index is generated based on a paragraph summary of the initial paragraph, at least one initial keyword of the initial paragraph, and at least one of a preset question-answer pair for the initial paragraph, the preset question-answer pair including preset question information for the initial paragraph and preset answer information for the preset question information.
[0041] like Figure 3 As shown, the initial document doc30 can be split to obtain multiple initial paragraphs of the initial document doc30. The multiple initial paragraphs may include initial paragraphs para31, ..., and initial paragraph para32. It will be appreciated that when splitting the initial document, the division can be based on the number of characters. The difference between the number of characters in each initial paragraph and a preset paragraph character number threshold is determined, and the difference is ensured to be less than or equal to the preset character difference threshold.
[0042] After obtaining multiple initial paragraphs of the initial document doc30, keyword extraction and paragraph summary generation can be performed on each initial paragraph to obtain at least one keyword for the initial paragraph para31, ..., at least one keyword for the initial paragraph para32, and a paragraph summary. Taking the initial paragraph prar31 as an example, the initial paragraph para31 can be segmented to obtain a segmentation result for the initial paragraph para31. Next, at least one initial keyword pkw31 in the segmentation result can be determined based on the macro model. Furthermore, the paragraph summary pabs31 for the initial paragraph para31 can be determined based on the macro model. In other examples, the macro model can be used to generate at least one preset question information based on the initial paragraph para31, and at least one preset answer information for the at least one preset question information, to obtain at least one preset question-answer pair. Next, the initial keywords, paragraph summaries, and preset question-answer pairs can be embedded to obtain an initial keyword embedding vector, a paragraph summary embedding vector, and a preset question-answer pair embedding vector. The initial keyword embedding vector, paragraph summary embedding vector, and preset question-answer pair embedding vector are concatenated to obtain an initial paragraph index. Through the embodiments of the present disclosure, an index of the initial paragraph is constructed based on the keywords, abstracts, and preset question-answer pairs of the paragraph, and the unified application of multiple different indexes is realized, which helps to improve the retrieval efficiency so as to quickly determine the context information of the question information to be processed.
[0043] It can be understood that the paragraph index of the present disclosure is described above, and the structured information of the present disclosure will be described below.
[0044] In some embodiments, the initial document has initial structured information. Figure 3 As shown, the large model can be used to determine the initial structured information cabs31 of the initial document doc30.
[0045] The initial structured information includes at least one of a plurality of initial attribute information of the initial document, where the plurality of initial attribute information includes first initial attribute information, second initial attribute information, and third initial attribute information.
[0046] The first initial attribute information includes at least one of the author, title, document creation time, and document language of the initial document. For example, the first initial attribute information represents the basic document attributes of the document. A large model can be used to extract all author and document titles from the document, or the document's timestamp can be used as the document creation time. The document language can be one or more of various languages, such as Chinese and English.
[0047] The second initial attribute information includes at least one of the document summary, document outline, document domain, at least one document keyword, and document style information of the initial document. For example, the second initial attribute information may represent the content understanding attribute of the document. The large model may be used to generate a document summary for the entire initial document and extract the document outline of the initial document. The domain of the document may also be classified by the large model, for example, it may be the legal field, the medical field, the educational field, etc. The document keywords may be extracted by the large model. The number of document keywords is less than or equal to the total number of initial keywords of all initial paragraphs in the document. The document style information may be a rigorous style, a conversational style, etc.
[0048] The third initial attribute information includes a sentiment analysis result of the initial document and at least one of at least one similar document to the initial document. For example, the third initial attribute information may represent an enhanced attribute of the document. A sentiment analysis may be performed on the initial document using a large model to obtain a sentiment analysis result. Semantic similarity between multiple initial documents in the knowledge base may also be determined. One or more second initial documents whose semantic similarity to the first initial document is greater than or equal to a preset semantic similarity threshold are identified as one or more similar documents to the first initial document.
[0049] In some embodiments, the structured information may further include fourth initial attribute information, the content of which may be configured by a user.
[0050] Through the embodiments of the present disclosure, attribute information of different dimensions of a document is obtained, so as to perform retrieval in multiple knowledge bases from multiple dimensions and more accurately determine the context data of the problem information to be processed.
[0051] It can be understood that the above describes the structured information and hierarchical index of the present disclosure, and the following will further describe the retrieval method of the present disclosure.
[0052] In some embodiments, in some implementations of the above-mentioned operation S210, searching multiple knowledge bases based on the pending question information to obtain at least one target paragraph index for the pending question information includes: searching multiple knowledge bases based on the pending question information to obtain at least one target paragraph index for the pending question information and at least one target structured information for the pending question information. The target structured information includes at least one target attribute information. The target attribute information is initial attribute information whose second matching evaluation value with the pending question information is greater than or equal to a second preset matching threshold. For example, the initial attribute information can be vectorized to obtain an initial attribute vector. A second matching evaluation value between the above-mentioned question embedding vector and one or more initial attribute vectors can be determined. One or more initial attribute vectors whose second matching evaluation value with the question embedding vector is greater than or equal to the second preset matching threshold are used as one or more target attribute vectors. Based on the one or more target attribute vectors, one or more target attribute information can be determined. Next, one or more initial structured information including the one or more target attribute information can be determined as the one or more target structured information. In one example, the second matching evaluation value can be determined based on the distance between the question embedding vector and the initial attribute vector. The smaller the distance, the higher the second matching evaluation value.
[0053] In some embodiments, in some implementations of the above operation S220, determining the initial context data of the question information to be processed based on at least one first target document indicated by at least one target paragraph index includes: determining the initial context data of the question information to be processed based on at least one first target document indicated by at least one target paragraph index and at least one second target document indicated by at least one target structured information. For example, the target structured information may be initial structured information of an initial document, which may indicate the initial document. The initial document may serve as the second target document indicated by the target structured information.
[0054] It is understood that duplicate documents may exist in the at least one first target document and the at least one second target document. The at least one first target document and the at least one second target document may be deduplicated to obtain one or more deduplicated target documents as initial context data. By using documents as retrieved results from multiple knowledge bases, the complete information in the documents can be effectively utilized, facilitating the provision of complete and logically consistent context data for generating answer information.
[0055] It can be understood that the above describes some ways of retrieving and determining contexts of the present disclosure, and the following describes some ways of generating answer information.
[0056] In some embodiments, in some implementations of the above-mentioned operation S230, in response to determining that the number of characters included in the initial context data is less than a first preset character threshold, the target answer information is generated based on the initial context data using the large model. For example, the first preset number of characters can be the maximum number of characters that the large model can process each time. The maximum number of characters is determined by the maximum number of tokens that the large model can process. The maximum number of tokens can be 120,000, and the corresponding maximum number of characters (taking Chinese characters as an example) is approximately 100,000 characters. In the case where the number of characters included in the initial context data is less than the first preset character threshold, the target answer information can be generated directly based on the initial context data using the large model.
[0057] It will be appreciated that the above description of the present disclosure uses the example of the case where the number of characters in the initial context data is less than the first preset character threshold. However, the present disclosure is not limited thereto. The following description uses the example of the case where the number of characters in the initial context data is greater than or equal to the first preset character threshold.
[0058] In some embodiments, in some implementations of the aforementioned operation S230, in response to determining that the number of characters included in the initial context data is greater than or equal to a first preset character threshold, the initial context data is compressed using the large model based on the first prompt data to obtain target context data. Based on the target context data, target answer information for the pending question information is generated. Through embodiments of the present disclosure, initial context data with a large number of characters can be compressed so that the large model can fully utilize the effective information in the context data, thereby improving the efficiency and accuracy of answer generation.
[0059] The first hint data can instruct the large model to compress the initial context data. For example, the initial context data can be divided into multiple initial context segments. In one example, if the initial context data contains 200,000 tokens, the initial context data can be split into two initial context segments, each containing 100,000 tokens. The first hint data is described below.
[0060] In some embodiments, the first prompt data may include at least one of a compressed task prompt text and at least one compressed rule prompt text.
[0061] The compressed task prompt text is used to instruct the large model to extract at least one valid information sub-segment associated with the problem information to be processed in the initial context segment of the initial context data based on the problem information to be processed. For example, the compressed task prompt text may be "You are a top-notch information extraction (Information Extraction) AI assistant. Your core task is to accurately and losslessly extract all key information directly used to answer the 'Query' in a given 'document' based on the 'Query' provided by the user, and filter out all irrelevant content." In this compressed task prompt text, "Query" can be the problem information to be processed, the key information used to answer the "Query" can be a valid information sub-segment, and "irrelevant content" can be an invalid information sub-segment. Through the embodiment of the present disclosure, based on the compressed task prompt text, the large model can effectively extract valid information related to the problem information to be processed, which can fully improve the accuracy of the answer information and effectively reduce the probability of incorrect answers and low-quality answers.
[0062] In some embodiments, the compression rule prompt text is used to instruct the large model to process the initial context data according to a preset compression rule. The at least one compression rule prompt text includes a first compression rule prompt text, a second compression rule prompt text, a third compression rule text, and a fourth compression rule prompt text.
[0063] The first compression rule prompt text can instruct the large model to extract at least one initial context sub-segment from the initial context segment. For example, the first compression rule prompt text can be "**Absolutely faithful to the original text**: The content in the 'document' must be quoted **verbatim**. Any form of summarization, summary or rewriting is strictly prohibited. Key data, names, indicators, etc. must be 100% consistent with the original text." In this first compression prompt text, "**verbatim** quote the content in the 'document'" can be used as an initial context sub-segment, which can be one or more. The first compression rule prompt text can instruct the large model to extract the original text from the initial context sub-segment.
[0064] The second compression rule prompt text can instruct the large model to delete irrelevant information sub-segments from at least one initial context sub-segment, where the irrelevant information sub-segment is an initial context sub-segment whose correlation evaluation value with the information of the question to be processed is less than a preset correlation threshold. For example, the second compression rule prompt text can be "**Extreme relevance filtering**: Only extract those information segments that **directly answer or constitute the answer to the `Query`. If the information is only background knowledge, or is slightly related to the `Query` topic but not the answer itself, it must be **resolutely eliminated**". In this second compression rule prompt text, "background knowledge, or slightly related to the `Query` topic but not the answer itself" can be an invalid information sub-segment. Based on this second compression rule prompt text, the large model can filter out invalid information sub-segments.
[0065] The third compression rule prompt text can instruct the large model to merge at least one valid information sub-segment into a target context segment according to the first preset data format. For example, the third compression rule prompt text can be "**Structured output**: Present all extracted information segments in the form of an **unordered list (Markdown - )**. Each list item is an independent piece of content directly extracted from the document." In this third compression rule prompt text, the first preset data format can be an unordered list, and the content in the list item can be a valid information sub-segment.
[0066] The fourth compression prompt text may indicate that the number of characters in the target context segment is less than or equal to the second preset character threshold. For example, the fourth compression rule prompt text may be "**Simplicity constraint**: On the premise of meeting the above requirements, ensure that the total length of the extracted content does not exceed 10,000 words to ensure the refinement and usability of the results". In this fourth compression rule prompt text, the second preset character threshold may be 10,000 words. Through the embodiment of the present disclosure, based on the compression rule prompt text, constraints can be provided for compressing the initial context data of a large model, reducing the probability of the model randomly extracting and generating data, so that the compressed context data has a higher correlation with the problem information to be processed.
[0067] In some embodiments, the first prompt data may further include at least one compression step prompt text, wherein the at least one compression step prompt text includes a first compression step prompt text, a second compression step prompt text, a third compression step prompt text, and a fourth compression step prompt text.
[0068] The prompt text for the first compression step can instruct the large model to understand the compression task prompt text. For example, the prompt text for the first compression step could be "**Analyze the Query**: First, based on 'Tasks and Goals,' deeply understand the core intent of the `Query` and clarify the type of information to be sought." In this first compression step prompt text, the specific content of "Tasks and Goals" can be the aforementioned compression task prompt text. The large model's natural language understanding capabilities can be used to gain a deeper understanding of the problem information to be processed.
[0069] The second compression step prompt text can instruct the large model to perform the first operation indicated by the first compression rule prompt text. For example, the second compression step prompt text can be "**Scan document**: Read the `document` thoroughly, and based on the "**Absolutely faithful to the original text**" rule, mark all paragraphs or sentences that may be related to the `Query`". In this second compression step prompt text, the content of **Absolutely faithful to the original text** can be the above-mentioned first compression rule prompt text. In the process of executing the first operation, the large model can extract one or more initial context sub-segments related to the problem information to be processed from the initial context segment.
[0070] The third compression step prompt text is used to instruct the large model to perform the second operation indicated by the second compression rule prompt text after the first operation is completed. For example, the third compression step prompt text can be "**Refinement and Extraction**: Perform secondary screening in the marked content, retaining only the most direct and critical information, and apply the above-mentioned "extreme relevance filtering" principle." In the third compression rule prompt text, the "extreme relevance filtering" principle can be the above-mentioned second compression rule prompt text. The second operation can be an operation of deleting invalid information sub-segments. In the process of executing the second operation, the large model can perform a correlation evaluation on one or more initial context sub-segments related to the problem information to be processed to determine the correlation evaluation value of the initial context sub-segment. If the correlation is greater than or equal to the preset correlation threshold, the initial context sub-segment can be used as a valid information sub-segment. If the correlation is less than the preset correlation threshold, the initial context sub-segment can be used as an invalid information sub-segment and the invalid information sub-segment can be deleted.
[0071] The prompt text of the fourth compression step is used to instruct the large model to output the target context fragment according to the prompt text of the third compression rule after the second operation is completed. For example, the prompt text of the fourth compression step can be "**Formatted presentation**: The information fragments finally screened out will be sorted and output according to the "structured output" requirements". In the prompt text of the fourth compression step, the content of the "structured output" requirement can be the content of the above-mentioned third compression rule prompt text. Through the embodiment of the present disclosure, based on the prompt text of the compression step, it is possible to effectively provide workflow guidance for the large model to compress context data, and further apply the capabilities of the large model to high-quality context compression, so that the target context data obtained after compression has effective information that is highly relevant to the problem to be processed.
[0072] In some embodiments, based on the first prompt data, a first prompt template can be formed. For example, the first prompt template can be “## Task and goal
[0073] You are a top-notch AI assistant specializing in information extraction. Your core task is to accurately and losslessly extract all the key information directly needed to answer a user's query from a given document, while filtering out any irrelevant content.
[0074] ## Core Principles and Requirements
[0075] 1. **Absolutely faithful to the original text**:
[0076] - Content from `Document` must be quoted verbatim. Summarizing, summarizing, or paraphrasing is strictly prohibited.
[0077] - Key data, names, indicators, etc. must be 100% consistent with the original text.
[0078] 2. **Extreme Correlation Filter**:
[0079] - Extract only those pieces of information that **directly answer or constitute an answer to the `Query`**.
[0080] - If the information is just background knowledge, or is only slightly related to the `Query` topic but not the answer itself, it must be **resolutely eliminated**.
[0081] 3. **Structured output**:
[0082] - Present all extracted information snippets in the form of an unordered list (Markdown's - )**.
[0083] - Each list item is a separate piece of content taken directly from the document.
[0084] - **If no relevant information is found in the document, the response must and can only be: "No directly relevant information was found in the document."**
[0085] 4. **Simplicity Constraint**:
[0086] - While meeting the above requirements, ensure that the total length of the extracted content does not exceed 10,000 words to ensure the conciseness and usability of the results.
[0087] ## Workflow Guidelines
[0088] 1. **Analyze the query**: First, based on the "task and goal", deeply understand the core intent of the query and clarify the type of information you need to find.
[0089] 2. **Scan the document**: Read the `document` thoroughly and mark all paragraphs or sentences that may be relevant to the `Query` based on the "**Absolutely faithful to the original text**" rule.
[0090] 3. **Refinement**: Perform a secondary filter on the marked content, retaining only the most direct and critical information, applying the "extreme relevance filtering" principle mentioned above.
[0091] 4. **Formatted presentation**: The final filtered information fragments will be sorted and output according to the "structured output" requirements.
[0092] ---
[0093] document:
[0094] {{>>Put the document content here}}
[0095] Query:
[0096] {{>>Put Query here}}".
[0097] This first prompt template includes the aforementioned compression task prompt text, at least one compression rule prompt text, and at least one compression step prompt text. It also includes a document slot ("Document: {{>>Place document content here}}") for the initial document and a query slot ("Query: {{>>Place query here}}") for the query to be processed. For another example, the target context data can be obtained by merging two target context segments obtained from the two initial context segments.
[0098] It can be understood that the above describes some ways of obtaining target context data in the present disclosure, and the following describes some ways of generating target answer information.
[0099] In some embodiments, generating target answer information for the question information to be processed based on the target context data includes: generating target answer information for the question information to be processed based on the target context data using a large model according to the second prompt data.
[0100] In some embodiments, the second prompt data includes a response task prompt text and at least one response rule prompt text.
[0101] In some embodiments, the reply task prompt text can instruct the large model to generate target answer information based on the target context data. For example, the reply task prompt text can be "Core task, your task is to strictly follow the given 'context' to provide a precise, clear, and completely text-based answer to the 'question' raised by the user." In the reply task prompt text, the given "context" can be the above-mentioned target context data. It can be understood that when the number of characters in the initial context data is less than the first preset character threshold, the given "context" can also be the above-mentioned initial context data.
[0102] In some embodiments, the answer rule prompt text is used to instruct the large model to generate target answer information according to a preset answer rule. The at least one answer rule prompt text includes at least one of a first answer rule prompt text and a second answer rule prompt text.
[0103] The first-response rule prompt can instruct the large model to use a preset answer as the target answer if the target context data cannot provide a response to the pending question. For example, the first-response rule prompt could be "**Hard rule for 'unable to answer'**: After thoroughly searching the 'context', if you confirm that no direct information can be found to answer the 'question', you **must** simply reply: "**Based on the provided context, no direct answer to this question can be found. **" Beyond that, do not add any apologies, explanations, or suggestions." In this first-response rule prompt, "Based on the provided context, no direct answer to this question can be found" could be the preset answer.
[0104] The second reply rule prompt text can instruct the large model to generate target answer information according to the second preset data format. For example, the second reply rule prompt text can be "**Output format requirements**: The answer should be direct and concise, and respond to the core of the 'question' directly. Use key points (such as Markdown's `-` or `*`) to organize complex or multi-part information to ensure clear logic. If there are key sentences in the original text that directly support the answer, they can be quoted." The second preset data format can be the same as the above-mentioned first preset data format or different. In the second reply rule prompt text, the second preset data format can be an unordered list.
[0105] In some embodiments, the second prompt data may further include at least one answer generation step prompt text, wherein the at least one answer generation step prompt text includes a first answer generation step prompt text, a second answer generation step prompt text, a third answer generation step prompt text, and a fourth answer generation step prompt text.
[0106] The prompt for the first answer generation step can instruct the large model to understand the prompt for the response task. For example, the prompt for the first answer generation step could be "**Understand the question**: First, carefully analyze the intent of the 'question' based on the 'core task' and clarify what to look for in the 'context'." The "core task" could be the prompt for the response task mentioned above.
[0107] The prompt text for the second answer generation step can instruct the large model to determine the target context sub-segment for the question information to be processed within the target context data. For example, the prompt text for the second answer generation step can be "**Information Locating**: Scan and locate all specific sentences and paragraphs related to the 'question' in the 'context'." In this second answer generation step prompt text, "specific sentences and paragraphs" can each be a target context sub-segment.
[0108] The third answer generation prompt text can instruct the large model to generate at least one candidate answer information based on the target context sub-segment and to delete the candidate answer information if any candidate answer information segment of the candidate answer information does not meet the preset conditions. The preset condition can be the presence of a target context sub-segment whose information similarity with the candidate answer information segment is greater than or equal to a preset information similarity threshold. For example, the third answer generation prompt text can be "**Answer construction and verification**: Based on the found information, organize into a direct answer. If any part of the answer cannot find support in the 'context', it must be deleted." In the third answer generation prompt text, "found information" can be a target sentence or a target context sub-segment. The candidate answer information can include one or more candidate answer information segments. If the information similarity between each candidate answer information segment of the candidate answer information and multiple target context sub-segments is less than the preset information similarity threshold, it can be determined that the candidate answer information does not meet the preset conditions, it can be determined that any part of the candidate answer cannot find support in the 'context', and the candidate answer can be deleted. The information similarity can be the distance between the embedding vector of the candidate answer information segment and the embedding vector of the target context sub-segment.
[0109] The prompt text of the fourth answer generation step is used to instruct the large model to generate the target answer information according to the prompt text of the second answer rule. For example, the prompt text of the fourth answer generation step can be "**Final output**: Arrange and present the answer according to the "output format requirements"". The content of "output format requirements" can be the content of the above-mentioned second answer rule prompt text. For another example, the candidate answer information that meets the preset conditions can be processed into answer information that meets the "output format requirements" as the target answer information.
[0110] In some embodiments, based on the second prompt data, a second prompt template can be formed. For example, the second prompt template can be “## Core Task
[0111] Your task is to provide a precise, clear, and completely text-based answer to the user's 'question' strictly based on the given 'context'.
[0112] ## Key Principles and Requirements
[0113] 1. **The rigid rule of “no answer”**:
[0114] - After thoroughly searching the 'Context', if you determine that no direct information can be found that answers the 'Question', you **MUST** simply reply: "**No direct answer to this question can be found based on the context provided."
[0115] - Beyond this, do not add any apologies, explanations, or suggestions.
[0116] 2.**Output format requirements**:
[0117] - Your answers should be direct, concise, and get straight to the point about the question.
[0118] - Use bullet points (like `-` or `*` in Markdown) to organize complex or multi-part information and ensure logical clarity.
[0119] - If there are key sentences in the original text that directly support the answer, you can quote them.
[0120] ## Workflow Guidelines
[0121] 1. **Understand the problem**: First, carefully analyze the intent of the ‘problem’ based on the core task and clarify what you need to find from the ‘context’.
[0122] 2. **Information Location**: Scan and locate all specific sentences and paragraphs related to the ‘question’ in the ‘context’.
[0123] 3. **Answer Construction and Verification**:
[0124] - Organize into direct answers based on the information found.
[0125] - If any part of the answer cannot be supported by the 'context', it must be deleted.
[0126] 4. **Final Output**: Organize and present the answers according to the "Output Format Requirements".
[0127] ---
[0128] Context:
[0129] {{>>Put the context here, the length of which meets the requirements}}
[0130] question:
[0131] {{>>>Put your question here}}
[0132] reply:"
[0133] The second prompt template includes the above-mentioned reply task prompt text, at least one reply rule prompt text and at least one answer generation step prompt text, and also includes a context slot for context data "Context: {{>>Put the context here, the length meets the requirements of Context}}", a question slot for question information to be processed "Query: {{>>Put the Query here}}" and a reply slot for target answer information "Reply:".
[0134] It can be understood that the above describes the method of the present disclosure, and the following will describe the device of the present disclosure.
[0135] Figure 4 It is a block diagram of a question and answer information processing apparatus according to an embodiment of the present disclosure.
[0136] like Figure 4 As shown, the apparatus 400 may include a retrieval module 410 , a determination module 420 and a generation module 430 .
[0137] Retrieval module 410 is configured to search multiple knowledge bases based on the pending question information to obtain at least one target paragraph index for the pending question information. The knowledge base includes multiple initial documents, each of which has at least one initial paragraph index generated based on initial paragraphs in the initial documents. The target paragraph index is an initial paragraph index for which a first matching evaluation value with the pending question information is greater than or equal to a first preset matching threshold.
[0138] The determination module 420 is configured to determine initial context data of the question information to be processed according to at least one first target document indicated by at least one target paragraph index.
[0139] The generating module 430 is configured to generate target answer information for the question information to be processed based on the initial context data.
[0140] In some embodiments, the initial paragraph index is generated based on a paragraph summary of the initial paragraph, at least one initial keyword of the initial paragraph, and at least one of a preset question-answer pair for the initial paragraph, the preset question-answer pair including preset question information for the initial paragraph and preset answer information for the preset question information.
[0141] In some embodiments, the initial document has initial structured information, and the initial structured information includes at least one of a plurality of initial attribute information of the initial document, the plurality of initial attribute information including first initial attribute information, second initial attribute information, and third initial attribute information. The first initial attribute information includes at least one of the author, title, document creation time, and document language of the initial document. The second initial attribute information includes at least one of the document summary, document outline, document field, at least one document keyword, and document style information of the initial document. The third initial attribute information includes a sentiment analysis result of the initial document and at least one of at least one similar document of the initial document, wherein the semantic similarity between the similar document and the initial document is greater than or equal to a preset semantic similarity threshold.
[0142] In some embodiments, the retrieval module includes a retrieval submodule configured to search multiple knowledge bases based on the information to be processed to obtain at least one target paragraph index for the question information to be processed and at least one target structured information for the question information to be processed. The target structured information includes at least one target attribute information, where the target attribute information is initial attribute information having a second matching evaluation value with the question information to be processed that is greater than or equal to a second preset matching threshold.
[0143] In some embodiments, the determination module includes: a determination submodule, which is used to determine the initial context data of the question information to be processed based on at least one first target document indicated by at least one target paragraph index and at least one second target document indicated by at least one target structured information.
[0144] In some embodiments, the generation module includes: a compression submodule configured to, in response to determining that the number of characters included in the initial context data is greater than or equal to a first preset character threshold, compress the initial context data using the large model based on the first prompt data to obtain target context data; and a generation submodule configured to generate target answer information for the question information to be processed based on the target context data.
[0145] In some embodiments, the first prompt data includes at least one of a compression task prompt text and at least one compression rule prompt text. The compression task prompt text is used to instruct the large model to extract at least one valid information sub-segment associated with the problem information to be processed from the initial context segment of the initial context data based on the problem information to be processed. The compression rule prompt text is used to instruct the large model to process the initial context data according to a preset compression rule.
[0146] In some embodiments, at least one compression rule prompt text includes a first compression rule prompt text, a second compression rule prompt text, a third compression rule text, and a fourth compression rule prompt text. The first compression rule prompt text is used to instruct the large model to extract at least one initial context sub-segment from the initial context segment. The second compression rule prompt text is used to instruct the large model to delete irrelevant information sub-segments from at least one initial context sub-segment, and the irrelevant information sub-segments are initial context sub-segments whose correlation evaluation value with the problem information to be processed is less than a preset correlation threshold. The third compression rule prompt text is used to instruct the large model to merge at least one valid information sub-segment into a target context segment according to the first preset data format. The fourth compression prompt text is used to indicate that the number of characters in the target context segment is less than or equal to the second preset character threshold.
[0147] In some embodiments, the first data further includes at least one compression step prompt text, and the at least one compression step prompt text includes a first compression step prompt text, a second compression step prompt text, a third compression step prompt text, and a fourth compression step prompt text. The first compression step prompt text is used to instruct the large model to understand the compression task prompt text. The second compression step prompt text is used to instruct the large model to perform the first operation indicated by the first compression rule prompt text. The third compression step prompt text is used to instruct the large model to perform the second operation indicated by the second compression rule prompt text after the first operation is completed. The fourth compression step prompt text is used to instruct the large model to output the target context segment according to the third compression rule prompt text after the second operation is completed.
[0148] In some embodiments, the generation submodule includes: a generation unit for generating target answer information for the question information to be processed based on the target context data and the second prompt data using the large model.
[0149] In some embodiments, the second prompt data includes at least one of a response task prompt text and at least one response rule prompt text. The response task prompt text is used to instruct the large model to generate target answer information based on the target context data. The response rule prompt text is used to instruct the large model to generate target answer information according to a preset response rule.
[0150] In some embodiments, the at least one answer rule prompt text includes at least one of a first answer rule prompt text and a second answer rule prompt text. The first answer rule prompt text is used to instruct the macro model to use preset answer information as target answer information if the macro model cannot answer the pending question information based on the target context data. The second answer rule prompt text is used to instruct the macro model to generate the target answer information according to a second preset data format.
[0151] In some embodiments, the second prompt data also includes at least one answer generation step prompt text, and the at least one answer generation step prompt text includes a first answer generation step prompt text, a second answer generation step prompt text, a third answer generation step prompt text, and a fourth answer generation step prompt text. The first answer generation step prompt text is used to instruct the large model to understand the reply task prompt text. The second answer generation step prompt text is used to instruct the large model to determine the target context sub-segment for the question information to be processed in the target context data. The third answer generation prompt text is used to instruct the large model to generate at least one candidate answer information based on the target context sub-segment and to delete the candidate answer information if any candidate answer information segment of the candidate answer information does not meet the preset conditions. The preset condition may be the presence of a target context sub-segment whose information similarity with the candidate answer information segment is greater than or equal to a preset information similarity threshold. The fourth answer generation step prompt text is used to instruct the large model to generate the target answer information according to the second reply rule prompt text.
[0152] It can be understood that the above describes the device of the present disclosure, and the following will describe the intelligent agent of the present disclosure.
[0153] Figure 5 is a schematic diagram of an intelligent agent according to an embodiment of the present disclosure.
[0154] In the embodiments of the present disclosure, inspired by the von Neumann structure in modern computer theory, such as Figure 5 As shown, the intelligent agent 500 may include multiple core modules: an input module 510 , a processing module 520 and an output module 530 .
[0155] In this example, input module 510 is responsible for receiving or perceiving information such as queries, requests, instructions, signals, question information, or data from the outside world (e.g., a user or the external environment) and converting it into a format that agent 500 can understand and process. Input module 510 is the primary link for agent 500 to interact with the outside world, enabling agent 500 to efficiently and accurately obtain necessary "sensory" information from the outside world and respond to this information. In this example, input module 510 can be used to receive question information to be processed.
[0156] In this example, processing module 520 is the core support for agent 500's ability to handle complex tasks. Processing module 520 is used to determine a target task based on the input information received by input module 510. Based on the target task, a macro model is determined. The macro model is invoked to execute the question-and-answer information processing method described above, generating output information.
[0157] In an example, the output module 530 may be configured to output the output information obtained by the processing module 520. The output information may include the target answer information as described above.
[0158] In an example, the processing module 520 may include a control unit 521 , a storage unit 522 , and an operation unit 523 .
[0159] During operation, the control unit 521 will continuously interact with the storage unit 522, the computing unit 523, and / or the output module 530. However, in the embodiment of the present disclosure, the control unit 521 acts as a single initiator to initiate communication with the storage unit 530, the computing unit 523, and / or the output module 530, and there may be no communication coupling between the storage unit 522, the computing unit 523, and the output module 530.
[0160] In this example, the performance of the control unit 521 may be closely related to the large model underlying the agent 500. To fully utilize the capabilities of the large language model, the internal structure of the control unit 521 may be designed to be highly configurable and extensible to cope with various types of tasks and requirements in real-world scenarios.
[0161] The storage unit 522 may be responsible for memorizing information such as historical conversations, event flows, etc. Various knowledge bases as described above may be included in the storage unit 522 .
[0162] In this example, after receiving input information, agent 500 can use the input information to determine a target task. Agent 500 can retrieve at least one target paragraph index for the pending question from storage unit 522 and feed it back to control unit 521. Control unit 521 can then use the fed-back target paragraph index or indexes to determine initial context data by invoking the large model. Based on the initial context data, the large model can then be used to generate target answer information for the pending question.
[0163] The operation unit 523 can be regarded as a predefined tool library, such as a format conversion tool, which can be included in the operation unit 523 .
[0164] In this example, when AI agent 500 needs to render multiple output data, it can call the relevant renderer and display tool from the computing unit 523 and feed it back to the processing module 520. The processing module 520 can then use the feedback renderer and display tool to pass the rendered results to the output module 530. It is understandable that although large language models have excellent language understanding and generation capabilities, they are similar to humans and can only perform limited tasks without the help of any tools. Once the AI agent 500 is given the ability to call tools, it can perform tasks such as result display.
[0165] The intelligent agent 500 according to the embodiment of the present disclosure can simply and effectively improve the level of intelligence, and improve flexibility and versatility.
[0166] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0167] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0168] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0169] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. Computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to bus 604.
[0170] Various components in device 600 are connected to I / O interface 605, including an input unit 606, such as a keyboard, mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, optical disk, etc.; and a communication unit 609, such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0171] The computing unit 601 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the question-and-answer information processing method. For example, in some embodiments, the question-and-answer information processing method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the question-and-answer information processing method described above can be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the question-and-answer information processing method in any other appropriate manner (eg, by means of firmware).
[0172] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0173] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0174] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM) or flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0175] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) display or a liquid crystal display (LCD)) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0176] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0177] Computer systems may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The client and server relationship arises through computer programs running on the respective computers and having a client-server relationship to each other.
[0178] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not limited herein.
[0179] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A question-answer information processing method, comprising: Searching multiple knowledge bases based on the information of the question to be processed to obtain at least one target paragraph index for the information of the question to be processed, wherein the knowledge base includes multiple initial documents, the initial documents have at least one initial paragraph index, the initial paragraph index is generated based on the initial paragraphs in the initial documents, and the target paragraph index is the initial paragraph index having a first matching evaluation value with the information of the question to be processed that is greater than or equal to a first preset matching threshold; Determining initial context data of the question information to be processed according to at least one first target document indicated by at least one target paragraph index; Target answer information for the question information to be processed is generated according to the initial context data.
2. The method according to claim 1, wherein The initial paragraph index is generated based on a paragraph summary of the initial paragraph, at least one initial keyword of the initial paragraph, and at least one of a preset question-answer pair for the initial paragraph, wherein the preset question-answer pair includes preset question information for the initial paragraph and preset answer information for the preset question information.
3. The method according to claim 1, wherein The initial document has initial structured information, the initial structured information including at least one of a plurality of initial attribute information of the initial document, the plurality of initial attribute information including the first initial attribute information, the second initial attribute information, and the third initial attribute information. The first initial attribute information includes at least one of the author, title, document creation time, and document language of the initial document; The second initial attribute information includes at least one of a document summary, a document outline, a document field, at least one document keyword, and document style information of the initial document; The third initial attribute information includes a sentiment analysis result of the initial document and at least one of at least one similar document of the initial document, wherein a semantic similarity between the similar document and the initial document is greater than or equal to a preset semantic similarity threshold.
4. The method according to claim 3, wherein: The step of searching multiple knowledge bases according to the information of the problem to be processed to obtain at least one target paragraph index for the information of the problem to be processed includes: According to the information to be processed, a search is performed in multiple knowledge bases to obtain at least one target paragraph index for the problem information to be processed and at least one target structured information for the problem information to be processed, wherein the target structured information includes at least one target attribute information, and the target attribute information is the initial attribute information having a second matching evaluation value with the problem information to be processed that is greater than or equal to a second preset matching threshold.
5. The method according to claim 4, wherein The determining of the initial context data of the question information to be processed according to at least one first target document indicated by at least one target paragraph index comprises: Initial context data of the question information to be processed is determined according to at least one first target document indicated by at least one target paragraph index and at least one second target document indicated by at least one target structured information.
6. The method according to claim 1, wherein Generating target answer information for the question information to be processed according to the initial context data includes: In response to determining that the number of characters included in the initial context data is greater than or equal to a first preset character threshold, compressing the initial context data using the large model based on the first prompt data to obtain target context data; The target answer information for the question information to be processed is generated according to the target context data.
7. The method according to claim 6, wherein: The first prompt data includes at least one of a compression task prompt text and at least one compression rule prompt text, The compression task prompt text is used to instruct the large model to extract at least one valid information sub-segment associated with the problem information to be processed from the initial context segment of the initial context data based on the problem information to be processed; the compression rule prompt text is used to instruct the large model to process the initial context data according to the preset compression rules.
8. The method according to claim 7, wherein: The at least one compression rule prompt text includes a first compression rule prompt text, a second compression rule prompt text, a third compression rule text, and a fourth compression rule prompt text. The first compression rule prompt text is used to instruct the large model to extract at least one initial context sub-segment from the initial context segment; The second compression rule prompt text is used to instruct the large model to delete an irrelevant information sub-segment from at least one of the initial context sub-segments, wherein the irrelevant information sub-segment is an initial context sub-segment whose correlation evaluation value with the problem information to be processed is less than a preset correlation threshold; The third compression rule prompt text is used to instruct the large model to merge at least one of the valid information sub-segments into a target context segment according to a first preset data format; The fourth compressed prompt text is used to indicate that the number of characters in the target context segment is less than or equal to a second preset character threshold.
9. The method according to claim 8, wherein The first data also includes at least one compression step prompt text, the at least one compression step prompt text includes a first compression step prompt text, a second compression step prompt text, a third compression step prompt text and a fourth compression step prompt text, The first compression step prompt text is used to instruct the large model to understand the compression task prompt text. The second compression step prompt text is used to instruct the large model to perform the first operation indicated by the first compression rule prompt text. The third compression step prompt text is used to instruct the large model to perform the second operation indicated by the second compression rule prompt text after the first operation is completed. The fourth compression step prompt text is used to instruct the large model to output the target context segment according to the third compression rule prompt text after the second operation is completed.
10. The method according to claim 6, wherein: Generating the target answer information for the question information to be processed according to the target context data includes: According to the target context data, the target answer information for the question information to be processed is generated using the large model according to the second prompt data.
11. The method according to claim 10, wherein: The second prompt data includes at least one of a response task prompt text and at least one response rule prompt text, The reply task prompt text is used to instruct the large model to generate target answer information based on the target context data; the reply rule prompt text is used to instruct the large model to generate the target answer information according to the preset reply rule.
12. The method according to claim 11, wherein At least one of the reply rule prompt texts includes at least one of a first reply rule prompt text and a second reply rule prompt text, The first answer rule prompt text is used to instruct the large model to use the preset answer information as the target answer information when the large model cannot answer the question information to be processed based on the target context data; The second reply rule prompt text is used to instruct the large model to generate the target answer information according to a second preset data format.
13. The method according to claim 12, wherein: The second prompt data further includes at least one answer generation step prompt text, wherein the at least one answer generation step prompt text includes a first answer generation step prompt text, a second answer generation step prompt text, a third answer generation step prompt text, and a fourth answer generation step prompt text. The first answer generation step prompt text is used to instruct the large model to understand the reply task prompt text. The prompt text of the second answer generation step is used to instruct the large model to determine the target context sub-segment for the question information to be processed in the target context data. The third answer generation prompt text is used to instruct the large model to generate at least one candidate answer information based on the target context sub-segment and to delete the candidate answer information if any candidate answer information segment of the candidate answer information does not meet a preset condition. The preset condition may be that there is a target context sub-segment whose information similarity with the candidate answer information segment is greater than or equal to a preset information similarity threshold. The fourth answer generation step prompt text is used to instruct the large model to generate the target answer information according to the second reply rule prompt text.
14. A question-answer information processing device, comprising: a retrieval module, configured to search multiple knowledge bases based on the information of the question to be processed to obtain at least one target paragraph index for the information of the question to be processed, wherein the knowledge base includes multiple initial documents, the initial documents have at least one initial paragraph index, the initial paragraph index is generated based on the initial paragraphs in the initial documents, and the target paragraph index is the initial paragraph index having a first matching evaluation value with the information of the question to be processed that is greater than or equal to a first preset matching threshold; a determination module, configured to determine initial context data of the question information to be processed according to at least one first target document indicated by at least one target paragraph index; A generating module is used to generate target answer information for the question information to be processed based on the initial context data.
15. An intelligent agent comprising: An input module, used for receiving input information; a processing module, configured to execute the method according to any one of claims 1 to 13 by calling a large model based on the input information received by the input module to obtain output information; An output module is used to output the output information obtained by the processing module.
16. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 13.
17. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 13.
18. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 13.