An AI-based question and answer method and terminal
By querying associated vectors and vector sets in both the vector database and the cache database, the inefficiency of AI question-answering systems was resolved, resulting in faster responses, higher accuracy, and an improved user experience.
Patent Information
- Application Number
- CN202410384854.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-01
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-04-01
AI Technical Summary
Existing AI question-answering systems are inefficient in the answering process and have low accuracy, resulting in long waiting times and a poor user experience.
The system queries the vector database for the associated vectors of prompt words and searches the cache database for question-and-answer results. If no matching results are found, the system retrieves the most relevant vector set from the vector database for AI querying and combines it with the question-and-answer results from the cache database to return the AI query results.
It improves the efficiency of AI question answering, enhances the accuracy of results, and improves the user experience.
Smart Images

Figure CN118349645B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of question and answer data processing, and particularly relates to an AI-based question and answer method and terminal. BACKGROUND
[0002] In current Internet systems, applications of AI and other related artificial intelligence are ubiquitous and have been applied to various application programs. At present, application scenarios of AI and other related artificial intelligence are very diversified, but the specific forms embodied are relatively uniform, and usually a prompt prompt word mode is adopted to achieve this. The specific process is as follows: an AI model is trained through massive data, and a relatively complete question and answer model is finally generated; a user inputs a prompt word parameter into the question and answer model, and the question and answer model returns relevant result content; when the content of the prompt word is relatively clear and complete, the question and answer model will return a relatively accurate result.
[0003] However, in the current question and answer process, because the model generates a result according to input data, there is a relatively long time process, so the prompt mode can only return result information word by word, and the user needs to wait, which is low in question and answer efficiency. SUMMARY
[0004] The technical problem to be solved by the present application is to provide an AI-based question and answer method and terminal, which can improve the answering efficiency of AI question and answer scenarios, and at the same time, the accuracy of the answer will not have a large deviation, further improving the overall experience of users.
[0005] In order to solve the above technical problems, the technical scheme adopted by the present application is:
[0006] An AI-based question and answer method, comprising the steps of:
[0007] receiving a prompt word input for a question, and using the prompt word to query an associated vector in a vector database;
[0008] querying a corresponding question and answer result in a cache database according to the associated vector, if the corresponding question and answer result exists, returning the question and answer result, if the corresponding question and answer result does not exist, obtaining a vector set most relevant to the prompt word from the vector database, performing AI query according to the question and answer result in the cache database of the vector set, and returning an AI query result.
[0009] In order to solve the above technical problems, another technical scheme adopted by the present application is:
[0010] An AI-based question and answer terminal comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements each step of the AI-based question and answer method.
[0011] The present application has the beneficial effect that when the prompt word of the question input is received, the associated vector of the prompt word is queried in the vector database, and the question and answer result of the associated vector is queried in the cache database. At this time, if the question and answer result can be queried, the question and answer result is directly returned, if the question and answer result cannot be queried, the most relevant vector set of the prompt word is obtained from the vector database, the question and answer result of the vector set in the cache database is queried together, and the AI query result is returned. In this way, when there is data related to the prompt word in the database, the result can be quickly displayed without returning the result information word by word; when there is no data related to the prompt word in the database, AI query can also be performed together with a plurality of more associated data to obtain more accurate answer data, which can be cached subsequently. BRIEF DESCRIPTION OF DRAWINGS
[0012] Figure 1 A flowchart of an AI-based question and answer method according to an embodiment of the present application;
[0013] Figure 2 A schematic diagram of an AI-based question and answer terminal according to an embodiment of the present application;
[0014] REFERENCE NUMERALS
[0015] 1. An AI-based question and answer terminal; 2. a memory; 3. a processor. DETAILED DESCRIPTION
[0016] To explain the technical content, purposes and effects of the present application in detail, the following embodiments are described in conjunction with the drawings.
[0017] Please refer to Figure 1 The present application provides an AI-based question and answer method, comprising the steps of:
[0018] receiving a prompt word of a question input, and querying an associated vector in a vector database using the prompt word;
[0019] querying a corresponding question and answer result in a cache database according to the associated vector, if the corresponding question and answer result exists, returning the question and answer result, if the corresponding question and answer result does not exist, obtaining a most relevant vector set of the prompt word from the vector database, querying an AI query result according to the question and answer result of the vector set in the cache database, and returning the AI query result.
[0020] From the above description, the beneficial effects of the present application are that when the prompt word of the question input is received, the associated vector of the prompt word is queried in the vector database, and the question and answer result of the associated vector is queried in the cache database. At this time, if the question and answer result can be queried, the question and answer result is directly returned, if the question and answer result cannot be queried, the most relevant vector set of the prompt word is obtained from the vector database, the question and answer result of the vector set in the cache database is queried together, and the AI query result is returned. In this way, when there is data related to the prompt word in the database, the result can be quickly displayed without returning the result information word by word; when there is no data related to the prompt word in the database, AI query can also be performed in combination with a plurality of more relevant data to obtain more accurate answer data, and the answer data can be cached subsequently.
[0021] Further, the associated vector is queried in the vector database using the prompt word, comprising:
[0022] The vector of the prompt word is calculated, vectors whose deviation from the vector of the prompt word is within a first vector deviation range are found in the vector database, and the first vector with the minimum vector deviation value is taken as the associated vector.
[0023] From the above description, the vectors whose deviation from the vector of the prompt word is within a first vector deviation range are found in the vector database, and the first vector with the minimum vector deviation value is taken as the associated vector. In this way, the associated vector with higher relevance can be confirmed to ensure the accuracy of the answer.
[0024] Further, the associated vector is queried in the vector database using the prompt word, further comprising:
[0025] If the associated vector is not queried in the vector database using the prompt word, the vector of the prompt word is added to the vector database, and the vector of the prompt word is taken as the associated vector.
[0026] From the above description, the vector of the prompt word is added to the vector database when the associated vector is not queried in the vector database. In this way, the vector database is enriched, and the application range of subsequent question and answer is improved.
[0027] Further, the most relevant vector set of the prompt word is obtained from the vector database, comprising:
[0028] A second vector whose deviation from the associated vector is within a second vector deviation range is found in the vector database;
[0029] The vector set is obtained in combination with the second vector and the vector of the prompt word;
[0030] The minimum value of the second vector deviation range is greater than or equal to the maximum value of the first vector deviation range.
[0031] As can be seen from the above description, the second vector in the vector database is found, which has a deviation from the associated vector within the second vector deviation range, in this way, multiple closer results can be obtained according to the query, so as to facilitate subsequent AI query based on the prompt word vector and the multiple closer results together.
[0032] Further, the AI query is performed according to the question and answer result of the vector set in the cache database, and the AI query result is returned, including:
[0033] The AI query is performed in combination with the question and answer result of the second vector in the vector set in the cache database and the vector of the prompt word, and the AI query result is returned;
[0034] And the AI query result is stored in the cache database in association with the vector of the prompt word.
[0035] As can be seen from the above description, using the prompt word vector and the multiple closer results can greatly increase the number of descriptions of the prompt word, and further improve the accuracy of the AI model.
[0036] Please refer to Figure 2 Another embodiment of the present application provides an AI-based question and answer terminal, including a memory, a processor and a computer program stored in the memory and executable on the processor, and each step of the above-mentioned AI-based question and answer method is realized when the processor executes the computer program.
[0037] The above-mentioned AI-based question and answer method and terminal of the present application are suitable for improving the answering efficiency of AI question and answer scene, and the accuracy of the answer will not be greatly deviated, further improving the overall experience of the user, which will be described in detail in the following specific embodiment:
[0038] Embodiment one
[0039] Please refer to Figure 1 An AI-based question and answer method, including steps:
[0040] S1, receiving the input prompt word, using the prompt word to query the associated vector in the vector database.
[0041] S11, when the user inputs the prompt word, receiving the prompt word, calculating the vector of the prompt word, finding the vector in the vector database which has a deviation from the vector of the prompt word within the first vector deviation range, and taking the first vector with the minimum vector deviation value as the associated vector.
[0042] In the embodiment, the vector deviation value is the difference or distance between two vectors.
[0043] Suppose there is a prompt word vector of "Apple phone" in the vector database, when the user inputs "iPhone", a prompt word vector will be calculated according to "iPhone" first, which will query the vectors within a certain vector deviation range in the vector database, and when the vector deviation value is within the first vector deviation range, it will be considered as a similar prompt word.
[0044] In the embodiment, the first vector deviation range can be within 1% of the vector value deviation, so when "iPhone" is used for query, all vectors within 1% deviation will be returned. If there are multiple returned, a vector with the smallest deviation value will be selected and returned, and here "Apple phone" will be returned.
[0045] S12, if the associated vector is not queried in the vector database using the prompt word, the vector of the prompt word is added to the vector database as the associated vector.
[0046] S2, query the corresponding question and answer result in the cache database according to the associated vector, if the corresponding question and answer result exists, return the question and answer result, if the corresponding question and answer result does not exist, get the vector set most related to the prompt word from the vector database, perform AI query according to the question and answer result of the vector set in the cache database, and return the AI query result.
[0047] Specifically, the corresponding question and answer result in the cache database is queried according to the associated vector, if the corresponding question and answer result exists, the question and answer result is returned to the user client;
[0048] If the corresponding question and answer result does not exist, a second vector within a second vector deviation range from the associated vector is found in the vector database, AI query is performed in combination with the question and answer result of the second vector in the cache database and the associated vector, the AI query result is returned, and the AI query result is associated with the prompt word vector and stored in the cache database.
[0049] In the embodiment, if the corresponding question and answer result is not found in the cache database, the closer result is queried according to multiple vectors, that is, the prompt word input by the user and the data of some closer vectors are taken as parameters to request the AI model to obtain more accurate answer data. The second vector deviation range can be between 1% and 3%.
[0050] Therefore, in the method of the embodiment, the vector deviation degree less than 1% can be inquired from the cache, the vector deviation degree between 1% and 3% can greatly increase the number of prompt words in the process of AI inquiry, and the AI model can further increase the accuracy of the answer in AI inquiry. Here, the reason for using more vectors to query together is that more accurate prompt words can be provided, and the AI large model can return more accurate result information.
[0051] Embodiment two
[0052] Please refer to Figure 2 An AI-based question and answer terminal 1 includes a memory 2, a processor 3, and a computer program stored on the memory 2 and executable on the processor 3, and the processor 3 implements each step of the AI-based question and answer method of embodiment one when executing the computer program.
[0053] In summary, the AI-based question and answer method and terminal provided by the application compares the input content in the form of vectors, queries from the cache if there is a vector value that meets the conditions, and requests the AI model with the input content and some data of vector values close to the input content as total parameters if there is no vector value that meets the conditions, so that more accurate answer data can be obtained. In this way, the answer efficiency of the AI question and answer scene is improved, and the accuracy of the answer will not be greatly deviated, further improving the overall experience of the user.
[0054] The above is only an embodiment of the application, and does not limit the patent scope of the application, and any equivalent transformation or direct or indirect application in the related technical field based on the content of the specification and drawings of the application is also included in the patent protection scope of the application.
Claims
1. An AI-based question and answer method, characterized by, The method comprises the steps of: receiving a prompt word of a question input, and querying an associated vector in a vector database using the prompt word; querying a corresponding question and answer result in a cache database according to the associated vector, returning the question and answer result if the corresponding question and answer result exists, and obtaining a vector set most relevant to the prompt word from the vector database, performing AI query according to a question and answer result of the vector set in the cache database, and returning an AI query result if the corresponding question and answer result does not exist; querying an associated vector in a vector database using the prompt word, comprising: calculating a vector of the prompt word, finding a vector in the vector database within a first vector deviation range from the vector of the prompt word, and taking a first vector with a minimum vector deviation value as the associated vector; querying an associated vector in a vector database using the prompt word, further comprising: if no associated vector is queried in the vector database using the prompt word, adding the vector of the prompt word to the vector database, and taking the vector of the prompt word as the associated vector.
2. The AI-based question answering method of claim 1, wherein, obtaining a vector set most relevant to the prompt word from the vector database, comprising: finding a second vector in the vector database within a second vector deviation range from the associated vector; obtaining a vector set by combining the second vector and the vector of the prompt word; a minimum value of the second vector deviation range is greater than or equal to a maximum value of the first vector deviation range.
3. The AI-based question answering method of claim 2, wherein, performing AI query according to a question and answer result of the vector set in the cache database, and returning an AI query result, comprising: performing AI query by combining a question and answer result of the second vector in the cache database and the vector of the prompt word, and returning an AI query result; and storing the AI query result in association with the vector of the prompt word in the cache database.
4. An AI-based question and answer terminal comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the following steps when executing the computer program: receiving a prompt word of a question input, and querying an associated vector in a vector database using the prompt word; querying a corresponding question and answer result in a cache database according to the associated vector, returning the question and answer result if the corresponding question and answer result exists, and obtaining a vector set most relevant to the prompt word from the vector database, performing AI query according to a question and answer result of the vector set in the cache database, and returning an AI query result if the corresponding question and answer result does not exist; querying an associated vector in a vector database using the prompt word, comprising: calculating a vector of the prompt word, finding a vector in the vector database within a first vector deviation range from the vector of the prompt word, and taking a first vector with a minimum vector deviation value as the associated vector; querying an associated vector in a vector database using the prompt word, further comprising: if no associated vector is queried in the vector database using the prompt word, adding the vector of the prompt word to the vector database, and taking the vector of the prompt word as the associated vector.
5. The AI-based question answering terminal according to claim 4, characterized in that, obtaining a vector set most relevant to the prompt word from the vector database, comprising: finding a second vector in the vector database within a second vector deviation range from the associated vector; obtaining a vector set by combining the second vector and the vector of the prompt word; a minimum value of the second vector deviation range is greater than or equal to a maximum value of the first vector deviation range. performing AI query according to a question and answer result of the vector set in the cache database, and returning an AI query result, comprising: performing AI query by combining a question and answer result of the second vector in the cache database and the vector of the prompt word, and returning an AI query result; and storing the AI query result in association with the vector of the prompt word in the cache database. obtaining a vector set in combination with the second vector and the vector of the prompt word; a minimum value of the second vector deviation range is greater than or equal to a maximum value of the first vector deviation range.
6. The AI-based question answering terminal according to claim 5, characterized in that, AI query is performed according to the question and answer result of the vector set in the cache database, and an AI query result is returned, including: AI query is performed in combination with the question and answer result of the second vector in the cache database and the vector of the prompt word in the vector set, and an AI query result is returned; and the AI query result is stored in the cache database in association with the vector of the prompt word.
Citation Information
Patent Citations
Table question and answer data processing method, electronic equipment and computer storage medium
CN114579605A
Question and answer method and device
CN114691843A