Vector database-based AI knowledge base construction and query method and system

By integrating the pgvector vector database and the DeepSeek-R1 model, an AI knowledge base is built, and the problem of lack of localized deployment of vectorization technology is solved, efficient localization closed loop is achieved, and user experience and query efficiency is improved.

CN120407705APending Publication Date: 2025-08-01GUANGDONG CHICO ELECTRONIC INC +3
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510492914.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-18
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The current knowledge base based on vectorization technology lacks the ability to localize the deployment of deep learning models and efficient retrieval systems, which hinders the localized closed-loop implementation of the entire process from data storage to intelligent question-and-answer, affecting the user experience.

Method used

The integration of the pgvector vector database and the DeepSeek-R1 model is adopted to build an AI knowledge base, convert text into high-dimensional vector data through natural language processing models, and combine pgvector's efficient storage and DeepSeek-R1's deep semantic understanding capabilities to achieve a localized closed loop.

Benefits of technology

It realizes a localized closed loop from data storage to intelligent question-and-answer process, improves the interactive experience between users and the knowledge base, and enhances the intelligence and query efficiency of the knowledge base.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407705A_ABST
    Figure CN120407705A_ABST
Patent Text Reader

Abstract

The invention discloses an AI knowledge base construction and query method and system based on a vector database. The method comprises the following steps of obtaining a plurality of knowledge texts; the method comprises the following steps: constructing a natural language processing model, a pgvector database and a DeepSeek-R1 model; a plurality of knowledge texts are preprocessed, the preprocessed knowledge texts are converted into vector data through a natural language processing model, and the vector data are stored in a pgvector vector database; integrating the pgvector database with a DeepSeek-R1 model so as to construct an AI (Artificial Intelligence) knowledge base; receiving a query request submitted by a user, and converting query content into vector data; and inputting the vector data of the query content into the AI knowledge base for query, and outputting an answer of the query content. The method solves the problem that most of current knowledge base construction and query methods based on the vectorization technology lack the combining capacity of a localized deployment deep learning model and an efficient retrieval system, and localized closed loop implementation of the whole process from data storage to intelligent question and answer is hindered to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of AI knowledge base technology, and in particular to a method and system for constructing and querying an AI knowledge base based on a vector database. Background Art

[0002] With the rapid development of artificial intelligence and natural language processing technologies, knowledge base construction and query technologies have ushered in unprecedented development opportunities, but also face severe challenges. Vectorization technology, as an effective means of mapping text data into high-dimensional vector space, has gradually become a research hotspot in the field of knowledge base construction and query. By capturing the semantic features of text and converting them into numerical vectors, this technology not only significantly improves the dimensionality and flexibility of data processing, but also enhances the accuracy of semantic similarity calculations, laying the foundation for building efficient and intelligent knowledge retrieval systems. However, most of the current knowledge base construction and query methods based on vectorization technology lack the ability to combine locally deployed deep learning models, such as DeepSeek-R1, with efficient retrieval systems. This shortcoming has, to a certain extent, hindered the realization of a localized closed-loop from data storage to intelligent question-answering, affecting the user experience. Summary of the Invention

[0003] In response to the above-mentioned defects, the present invention proposes an AI knowledge base construction and query method and system based on a vector database, aiming to solve the problem that most of the current knowledge base construction and query methods based on vectorization technology lack the ability to combine localized deployment of deep learning models with efficient retrieval systems. This, to a certain extent, hinders the localized closed-loop implementation of the entire process from data storage to intelligent question and answer, affecting the user experience.

[0004] To achieve this object, the present invention adopts the following technical solutions:

[0005] A method for constructing and querying an AI knowledge base based on a vector database includes the following steps:

[0006] Step S1: Obtain several knowledge texts;

[0007] Step S2: Construct a natural language processing model, a pgvector vector database, and a DeepSeek-R1 model. The natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification on the query content and generate answers.

[0008] Step S3: Preprocessing a number of knowledge texts to obtain preprocessed knowledge texts, inputting the preprocessed knowledge texts into a natural language processing model for processing, and outputting vector data of the knowledge texts;

[0009] Step S4: storing the vector data of the knowledge text in the pgvector vector database;

[0010] Step S5: Integrate the pgvector vector database storing vector data of knowledge text with the DeepSeek-R1 model to build an AI knowledge base;

[0011] Step S6: Receive the query request submitted by the user and convert the query content into vector data through a natural language processing model;

[0012] Step S7: Input the vector data of the query content into the AI knowledge base for query, and output the answer to the query content.

[0013] Preferably, in step S1, the following sub-steps are specifically included: obtaining the knowledge text uploaded by the user through the Go language-based Web terminal.

[0014] Preferably, in step S3, a plurality of knowledge texts are preprocessed to obtain preprocessed knowledge texts, which specifically includes the following sub-steps:

[0015] Cleaning and word segmentation processing are performed on several knowledge texts. Specifically, cleaning processing of several knowledge texts includes the following sub-steps:

[0016] Delete special characters, stop words and irrelevant parts in the knowledge text, convert the text format in the knowledge text to uniform uppercase and lowercase, correct spelling errors in the knowledge text and standardize the symbols in the knowledge text;

[0017] Perform word segmentation on several knowledge texts, which includes the following sub-steps:

[0018] According to a preset dictionary, a continuous character stream in a knowledge text is divided into several meaningful words, and meaningless words are removed; compound words in several meaningful words are processed into separate words and several meaningful words are marked.

[0019] Preferably, in step S7, the following sub-steps are specifically included: Step S71: input the vector data of the query content into the pgvector vector database for similarity retrieval, retrieve the knowledge text most similar to the query content, and use it as context information; Step S72: input the context information into the DeepSeek-R1 model for semantic verification and answer generation, and output the answer to the query content.

[0020] Preferably, in step S71, it specifically includes the following sub-steps: Using the cosine similarity algorithm and the Euclidean distance metric algorithm, compare and match the vector data of the query content with the vector data of the knowledge texts in the pgvector vector database, and filter out the knowledge text that is most similar to the query content.

[0021] Another aspect of the present application provides an AI knowledge base construction and query system based on a vector database, and the system includes:

[0022] An acquisition module, configured to acquire a number of knowledge texts;

[0023] A construction module, configured to construct a natural language processing model, a pgvector vector database, and a DeepSeek-R1 model, wherein the natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification and answer generation on the query content;

[0024] A preprocessing module, configured to preprocess a number of knowledge texts to obtain preprocessed knowledge texts;

[0025] A first vector conversion module, configured to input the preprocessed knowledge texts into the natural language processing model for processing, and output the vector data of the knowledge texts;

[0026] A storage module, configured to store the vector data of the knowledge texts in the pgvector vector database;

[0027] An integration module, configured to integrate the pgvector vector database storing the vector data of the knowledge texts with the DeepSeek-R1 model to construct an AI knowledge base;

[0028] A receiving module, configured to receive a query request submitted by a user;

[0029] A second vector conversion module, configured to convert the query content into vector data through the natural language processing model;

[0030] A query module, configured to input the vector data of the query content into the AI knowledge base for query, and output the answer to the query content.

[0031] Preferably, the acquisition module includes: an acquisition sub-module, configured to acquire the knowledge texts uploaded by the user through a Web end based on the Go language.

[0032] Preferably, the preprocessing module includes:

[0033] A text cleaning sub-module, configured to clean and process a number of knowledge texts;

[0034] A text tokenization sub-module for tokenizing a number of knowledge texts;

[0035] The text cleaning sub-module includes:

[0036] A deletion sub-unit for deleting special characters, stop words, and irrelevant parts in the knowledge text;

[0037] A conversion sub-unit for converting the text format in the knowledge text to unified upper and lower cases;

[0038] A correction sub-unit for correcting spelling mistakes in the knowledge text;

[0039] A standardization sub-unit for standardizing symbols in the knowledge text;

[0040] The text tokenization sub-module includes:

[0041] A division sub-unit for dividing a continuous character stream in the knowledge text into several meaningful words according to a preset dictionary;

[0042] An elimination sub-unit for eliminating meaningless words;

[0043] A compound word processing sub-unit for processing compound words in several meaningful words into individual words;

[0044] A labeling sub-unit for labeling several meaningful words.

[0045] Preferably, the query module includes: a similarity retrieval sub-module for inputting vector data of the query content into a pgvector vector database for similarity retrieval, retrieving the knowledge text most similar to the query content, and using it as context information; an answer generation sub-module for inputting the context information into a DeepSeek-R1 model for semantic verification and answer generation, and outputting the answer to the query content.

[0046] Preferably, the similarity retrieval sub-module includes: a comparison and matching sub-unit for comparing and matching the vector data of the query content with the vector data of the knowledge text in the pgvector vector database by using the cosine similarity algorithm and the Euclidean distance metric algorithm, and screening out the knowledge text most similar to the query content.

[0047] The technical solution provided by the embodiments of the present application may include the following beneficial effects:

[0048] In this solution, an AI knowledge base is constructed by integrating a pgvector vector database storing vector data of knowledge texts and the DeepSeek-R1 model, enabling the AI knowledge base to have both the efficient storage and query capabilities of the pgvector vector database and the deep semantic understanding ability of the DeepSeek-R1 model, realizing a local closed-loop for the entire process from data storage to intelligent question answering, thereby improving the interaction experience between users and the knowledge base. Description of the Drawings

[0049] Figure 1 It is a flowchart of the steps of a method for constructing and querying an AI knowledge base based on a vector database. Detailed Embodiments

[0050] The following details the embodiments of the present invention. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention.

[0051] A method for constructing and querying an AI knowledge base based on a vector database includes the following steps:

[0052] Step S1: Obtain a number of knowledge texts;

[0053] Step S2: Construct a natural language processing model, a pgvector vector database, and the DeepSeek-R1 model. Among them, the natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification and answer generation on the query content;

[0054] Step S3: Preprocess a number of knowledge texts to obtain preprocessed knowledge texts, and input the preprocessed knowledge texts into the natural language processing model for processing to output the vector data of the knowledge texts;

[0055] Step S4: Store the vector data of the knowledge texts in the pgvector vector database;

[0056] Step S5: Integrate the pgvector vector database storing the vector data of the knowledge texts with the DeepSeek-R1 model to construct an AI knowledge base;

[0057] Step S6: Receive a query request submitted by the user, and convert the query content into vector data through the natural language processing model;

[0058] Step S7: Input the vector data of the query content into the AI knowledge base for query, and output the answer to the query content.

[0059] A method for constructing and querying an AI knowledge base based on a vector database in this solution, such as Figure 1As shown in the figure, the first step is to obtain a number of knowledge texts. In this embodiment, by obtaining a large number of knowledge texts, it is beneficial to provide data support for the subsequent construction of the AI knowledge base. The second step is to construct a natural language processing model, a pgvector vector database, and a DeepSeek-R1 model. Among them, the natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification and answer generation on the query content. In this embodiment, the natural language processing model is the BERT model. By constructing the natural language processing model, it is beneficial to convert the knowledge text into high-dimensional vectors in the subsequent process for semantic retrieval and question-and-answer generation. The pgvector vector database is a vector storage extension that extends the PostgreSQL database and is used to efficiently store and retrieve high-dimensional vector data. It is particularly suitable for storing multi-dimensional data such as text, images, and audio that have been converted into vectors and supports efficient similarity retrieval. By constructing the pgvector vector database, it is beneficial to store and retrieve vector data in the subsequent process. The DeepSeek-R1 model is an open-source locally deployed deep learning model. By constructing the DeepSeek-R1 model, it is beneficial to perform semantic verification and answer generation on the query content in the subsequent process. The third step is to preprocess a number of knowledge texts to obtain preprocessed knowledge texts, and input the preprocessed knowledge texts into the natural language processing model for processing to output the vector data of the knowledge texts. In this embodiment, by preprocessing a number of knowledge texts, it is beneficial to improve the quality and usability of the knowledge texts. Through the natural language processing model, it is beneficial to convert the preprocessed knowledge texts into high-dimensional vectors. The fourth step is to store the vector data of the knowledge texts in the pgvector vector database. In this embodiment, by storing the vector data of the knowledge texts in the pgvector vector database, it is convenient for the storage, query, and maintenance of the vector data of the knowledge texts. The fifth step is to integrate the pgvector vector database storing the vector data of the knowledge texts with the DeepSeek-R1 model to construct an AI knowledge base. In this embodiment, by integrating the pgvector vector database with the DeepSeek-R1 model, the efficient storage and query capabilities of the pgvector vector database and the deep semantic understanding capabilities of the DeepSeek-R1 model are effectively integrated, making the AI knowledge base more intelligent and better able to meet the needs of users. The sixth step is to receive the query request submitted by the user and convert the query content into vector data through the natural language processing model. In this embodiment, by converting the query content into vector data, it is convenient for subsequent query and matching in the AI knowledge base.The seventh step is to input the vector data of the query content into the AI knowledge base for query and output the answer to the query content. In this embodiment, the AI knowledge base can accurately and quickly query the answers to the questions raised by the user, thereby improving the user's query experience.

[0060] In this solution, the AI knowledge base is constructed by integrating the pgvector vector database that stores vector data of knowledge text and the DeepSeek-R1 model. This enables the AI knowledge base to have both the efficient storage and query capabilities of the pgvector vector database and the deep semantic understanding capabilities of the DeepSeek-R1 model, realizing a localized closed loop from data storage to intelligent question and answer, thereby improving the user's interactive experience with the knowledge base.

[0061] Preferably, step S1 specifically includes the following sub-steps: obtaining knowledge text uploaded by the user through a Go language-based web terminal. In this embodiment, the user uploads the knowledge text through a Go language-based web terminal. Go language has excellent concurrent processing capabilities and can quickly respond to upload requests from multiple users to avoid congestion or performance bottlenecks.

[0062] Preferably, in step S3, a plurality of knowledge texts are preprocessed to obtain preprocessed knowledge texts, which specifically includes the following sub-steps:

[0063] Cleaning and word segmentation processing are performed on several knowledge texts. Specifically, cleaning processing of several knowledge texts includes the following sub-steps:

[0064] Delete special characters, stop words and irrelevant parts in the knowledge text, convert the text format in the knowledge text to uniform uppercase and lowercase, correct spelling errors in the knowledge text and standardize the symbols in the knowledge text;

[0065] Perform word segmentation on several knowledge texts, which includes the following sub-steps:

[0066] According to a preset dictionary, a continuous character stream in a knowledge text is divided into several meaningful words, and meaningless words are removed; compound words in several meaningful words are processed into separate words and several meaningful words are marked.

[0067] In this embodiment, by cleaning the knowledge text, irrelevant or interfering content can be removed, thereby improving the quality of the knowledge text. By performing word segmentation on the knowledge text, the knowledge text can be segmented into meaningful words, laying a solid foundation for the subsequent semantic understanding of the DeepSeek-R1 model.

[0068] Furthermore, during the process of cleaning several knowledge texts, by deleting special characters in the knowledge texts, such as HTML tags, non-alphabetic characters, and spaces, stop words, such as "de", "shi", and "zai", and irrelevant parts, such as irrelevant metadata, head and tail information, and footers, it is beneficial to remove redundant information in the knowledge texts. By converting the text format in the knowledge texts to unified upper and lower cases, it is beneficial to avoid differences caused by text sizes. By correcting spelling mistakes in the knowledge texts, it is beneficial to improve the accuracy of text expression. By standardizing the symbols in the knowledge texts, the standardization of the knowledge texts is ensured. During the process of word segmentation of several knowledge texts, by dividing the continuous character stream in the knowledge texts into several meaningful words according to a preset dictionary and removing meaningless words, the core information in the knowledge texts can be accurately extracted, avoiding semantic understanding deviations caused by interference of meaningless characters. By processing compound words into separate words, it helps to parse the text semantics more meticulously. By annotating meaningful words, information such as the part of speech and semantic category of the words can be clarified, which is beneficial for subsequent semantic analysis.

[0069] Preferably, in step S7, it specifically includes the following sub-steps: Step S71: Input the vector data of the query content into the pgvector vector database for similarity retrieval, retrieve the knowledge text most similar to the query content, and use it as context information; Step S72: Input the context information into the DeepSeek-R1 model for semantic verification and answer generation, and output the answer to the query content.

[0070] In this embodiment, in step S71, by performing vector similarity retrieval of the query content in the pgvector vector database, it is beneficial to capture deeper semantic similarities between the knowledge text and the query content, avoid retrieval omissions caused by differences in keyword expressions, and greatly improve the accuracy and efficiency of retrieval. By using the knowledge text most similar to the query content as context information, background information is provided for the DeepSeek-R1 model, helping the DeepSeek-R1 model understand the specific context and requirements of the query content. In step S72, by passing the knowledge text most similar to the query content to the DeepSeek-R1 model, the DeepSeek-R1 model can generate relevant answers more accurately.

[0071] Preferably, in step S71, it specifically includes the following sub-steps: Using the cosine similarity algorithm and the Euclidean distance metric algorithm, compare and match the vector data of the query content with the vector data of the knowledge texts in the pgvector vector database, and screen out the knowledge text most similar to the query content. In this embodiment, the cosine similarity algorithm focuses on the vector direction difference, and the Euclidean distance metric algorithm focuses on the vector space position distance. By using the cosine similarity algorithm and the Euclidean distance metric algorithm, the similarity between the query content vector and the knowledge text vector can be measured more comprehensively, thereby effectively improving the accuracy of matching, quickly locating the knowledge text most similar to the query content, reducing the mis-matching situation, and improving the information retrieval efficiency.

[0072] On the other hand, the present application provides an AI knowledge base construction and query system based on a vector database, and the system includes:

[0073] An acquisition module, used to acquire a number of knowledge texts;

[0074] A construction module, used to construct a natural language processing model, a pgvector vector database, and a DeepSeek-R1 model. Among them, the natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification and answer generation on the query content;

[0075] A preprocessing module, used to preprocess a number of knowledge texts to obtain preprocessed knowledge texts;

[0076] A first vector conversion module, used to input the preprocessed knowledge text into the natural language processing model for processing, and output the vector data of the knowledge text;

[0077] A storage module, used to store the vector data of the knowledge text in the pgvector vector database;

[0078] An integration module, used to integrate the pgvector vector database storing the vector data of the knowledge text with the DeepSeek-R1 model to construct an AI knowledge base;

[0079] A receiving module, used to receive a query request submitted by the user;

[0080] A second vector conversion module, used to convert the query content into vector data through the natural language processing model;

[0081] A query module, used to input the vector data of the query content into the AI knowledge base for query, and output the answer to the query content.

[0082] An AI knowledge base construction and query system based on a vector database in this solution realizes the construction and query of an AI knowledge base through the cooperation of an acquisition module, a construction module, a preprocessing module, a first vector conversion module, a storage module, an integration module, a reception module, a second vector conversion module, and a query module. In this solution, an AI knowledge base is constructed by integrating a pgvector vector database storing vector data of knowledge texts and a DeepSeek-R1 model, enabling the AI knowledge base to have both the efficient storage and query capabilities of the pgvector vector database and the deep semantic understanding ability of the DeepSeek-R1 model, realizing a local closed-loop for the entire process from data storage to intelligent question answering, thereby improving the interaction experience between users and the knowledge base.

[0083] Preferably, the acquisition module includes: an acquisition sub-module for acquiring knowledge texts uploaded by users through a Web end based on the Go language. In this embodiment, by setting the acquisition sub-module, the Go language has excellent concurrent processing capabilities and can quickly respond to upload requests from multiple users, avoiding congestion or performance bottlenecks.

[0084] Preferably, the preprocessing module includes:

[0085] A text cleaning sub-module for cleaning a number of knowledge texts;

[0086] A text tokenization sub-module for tokenizing a number of knowledge texts;

[0087] The text cleaning sub-module includes:

[0088] A deletion sub-unit for deleting special characters, stop words, and irrelevant parts in the knowledge texts;

[0089] A conversion sub-unit for converting the text format in the knowledge texts into a unified case;

[0090] A correction sub-unit for correcting spelling mistakes in the knowledge texts;

[0091] A standardization sub-unit for standardizing symbols in the knowledge texts;

[0092] The text tokenization sub-module includes:

[0093] A division sub-unit for dividing a continuous character stream in the knowledge texts into several meaningful words according to a preset dictionary;

[0094] An elimination sub-unit for eliminating meaningless words;

[0095] A compound word processing sub-unit for processing compound words in several meaningful words into individual words;

[0096] Annotation subunit, used to annotate a number of meaningful words.

[0097] In this embodiment, by setting a text cleaning sub-module composed of a deletion subunit, a conversion subunit, a correction subunit, and a normalization subunit, irrelevant or interfering content in the knowledge text can be removed, thereby improving the quality of the knowledge text. By setting a text tokenization sub-module composed of a division subunit, a removal subunit, a compound word processing subunit, an annotation subunit, and a normalization processing subunit, the knowledge text can be segmented into meaningful words, laying a solid foundation for the semantic understanding of the subsequent DeepSeek-R1 model.

[0098] Preferably, the query module includes: a similarity retrieval sub-module, used to input the vector data of the query content into the pgvector vector database for similarity retrieval, retrieve the knowledge text most similar to the query content, and use it as context information; an answer generation sub-module, used to input the context information into the DeepSeek-R1 model for semantic verification and answer generation, and output the answer to the query content.

[0099] In this embodiment, in the similarity retrieval sub-module, by performing vector similarity retrieval of the query content in the pgvector vector database, it is beneficial to capture deeper semantic similarities between the knowledge text and the query content, avoid retrieval omissions caused by differences in keyword expressions, and greatly improve the accuracy and efficiency of retrieval. By using the knowledge text most similar to the query content as context information, background information is provided for the DeepSeek-R1 model, helping the DeepSeek-R1 model understand the specific context and requirements of the query content. In the answer generation sub-module, by passing the knowledge text most similar to the query content to the DeepSeek-R1 model, the DeepSeek-R1 model can generate relevant answers more accurately.

[0100] Preferably, the similarity retrieval sub-module includes: a comparison and matching subunit, used to use the cosine similarity algorithm and the Euclidean distance metric algorithm to compare and match the vector data of the query content with the vector data of the knowledge text in the pgvector vector database, and screen out the knowledge text most similar to the query content. In this embodiment, by setting the comparison and matching subunit, it is beneficial to quickly locate the knowledge text most similar to the query content, reduce mis-matching situations, and improve the information retrieval efficiency.

[0101] In addition, each functional unit in the various embodiments of the present invention may be integrated into a processing module, may exist separately as individual units physically, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0102] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for constructing and querying an AI knowledge base based on a vector database, characterized in that: The following steps are involved: Step S1: Obtain several knowledge texts; Step S2: Construct a natural language processing model, a pgvector vector database, and a DeepSeek-R1 model. The natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification on the query content and generate answers. Step S3: Preprocessing a number of knowledge texts to obtain preprocessed knowledge texts, inputting the preprocessed knowledge texts into a natural language processing model for processing, and outputting vector data of the knowledge texts; Step S4: storing the vector data of the knowledge text in the pgvector vector database; Step S5: Integrate the pgvector vector database storing vector data of knowledge text with the DeepSeek-R1 model to build an AI knowledge base; Step S6: Receive the query request submitted by the user and convert the query content into vector data through a natural language processing model; Step S7: Input the vector data of the query content into the AI knowledge base for query, and output the answer to the query content.

2. The AI knowledge base construction and query method based on a vector database according to claim 1, wherein: In step S1, the following sub-steps are specifically included: obtaining the knowledge text uploaded by the user through the Go language-based Web terminal.

3. A method for constructing and querying an AI knowledge base based on a vector database according to claim 1, characterized in that: In step S3, a plurality of knowledge texts are preprocessed to obtain preprocessed knowledge texts, which specifically includes the following sub-steps: Cleaning and word segmentation processing are performed on several knowledge texts. Specifically, cleaning processing of several knowledge texts includes the following sub-steps: Delete special characters, stop words and irrelevant parts in the knowledge text, convert the text format in the knowledge text to uniform uppercase and lowercase, correct spelling errors in the knowledge text and standardize the symbols in the knowledge text; Perform word segmentation on several knowledge texts, which includes the following sub-steps: According to a preset dictionary, a continuous character stream in a knowledge text is divided into several meaningful words, and meaningless words are removed; compound words in several meaningful words are processed into separate words and several meaningful words are marked.

4. A method for constructing and querying an AI knowledge base based on a vector database according to claim 1, characterized in that: In step S7, the following sub-steps are specifically included: Step S71: Input the vector data of the query content into the pgvector vector database for similarity search, retrieve the knowledge text most similar to the query content, and use it as context information; Step S72: Input the context information into the DeepSeek-R1 model for semantic verification and answer generation, and output the answer to the query content.

5. The AI knowledge base construction and query method based on a vector database according to claim 4, wherein: In step S71, the following sub-steps are specifically included: The cosine similarity algorithm and the Euclidean distance measurement algorithm are used to compare and match the vector data of the query content with the vector data of the knowledge text in the pgvector vector database, and the knowledge text that is most similar to the query content is screened out.

6. An AI knowledge base construction and query system based on a vector database, which uses the AI knowledge base construction and query method based on a vector database described in any one of claims 1-5, characterized in that: The system comprises: An acquisition module is used to acquire several knowledge texts; A construction module is used to build a natural language processing model, a pgvector vector database, and a DeepSeek-R1 model. The natural language processing model is used to convert text into high-dimensional vector data, the pgvector vector database is used to store and retrieve high-dimensional vector data, and the DeepSeek-R1 model is used to perform semantic verification on query content and generate answers. A preprocessing module is used to preprocess a number of knowledge texts to obtain preprocessed knowledge texts; A first vector conversion module is used to input the pre-processed knowledge text into the natural language processing model for processing and output vector data of the knowledge text; The storage module is used to store the vector data of the knowledge text in the pgvector vector database; An integration module for integrating the pgvector vector database, which stores vector data of knowledge text, with the DeepSeek-R1 model to build an AI knowledge base; A receiving module, used for receiving a query request submitted by a user; A second vector conversion module is used to convert the query content into vector data through a natural language processing model; The query module is used to input the vector data of the query content into the AI knowledge base for query and output the answer to the query content.

7. An AI knowledge base construction and query system based on a vector database according to claim 6, characterized in that: The acquisition module includes: The acquisition submodule is used to obtain knowledge text uploaded by users through the Go language-based web client.

8. An AI knowledge base construction and query system based on a vector database according to claim 6, characterized in that: The pre-processing module comprises: The text cleaning submodule is used to clean several knowledge texts; The text segmentation submodule is used to perform word segmentation on several knowledge texts; The text cleaning submodule includes: The deletion subunit is used to delete special characters, stop words and irrelevant parts in the knowledge text; The conversion subunit is used to convert the text format in the knowledge text into a unified uppercase and lowercase format; The correction subunit is used to correct spelling errors in the knowledge text; The standardization subunit is used to standardize the symbols in the knowledge text; The text segmentation submodule includes: A division subunit is used to divide a continuous character stream in a knowledge text into a number of meaningful words according to a preset dictionary; Remove subunits to remove meaningless words; a compound word processing subunit, for processing compound words among a plurality of meaningful words into separate words; The annotation subunit is used to annotate several meaningful words.

9. An AI knowledge base construction and query system based on a vector database according to claim 6, characterized in that: The query module includes: The similarity retrieval submodule is used to input the vector data of the query content into the pgvector vector database for similarity retrieval, retrieve the knowledge text most similar to the query content, and use it as context information; The answer generation submodule is used to input context information into the DeepSeek-R1 model for semantic verification and answer generation, and output the answer to the query content.

10. An AI knowledge base construction and query system based on a vector database according to claim 9, characterized in that: The similarity retrieval submodule includes: The comparison and matching subunit is used to compare and match the vector data of the query content with the vector data of the knowledge text in the pgvector vector database using the cosine similarity algorithm and the Euclidean distance measurement algorithm, and to screen out the knowledge text that is most similar to the query content.

Citation Information

Patent Citations

  • Knowledge question-answering system based on large language model

    CN119396975A

  • Document data structured storage and retrieval method based on AI drive

    CN119829723A