Method for constructing AI knowledge base based on large model and RAG technology

By combining big models and RAG technology, an AI intelligent knowledge base system was built, which solved the problem that unstructured data could not be effectively utilized, and realized AI interactive query and generation solutions, improving data retrieval and answering capabilities, ensuring that User authentication and model optimization.

CN119271827AInactive Publication Date: 2025-01-07NANJING GLAWAY SOFTWARE CO LTD

Patent Information

Application Number
CN202411797031.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-01-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology is unable to effectively build an unstructured internal knowledge base of data that supports AI interactive query and generation solutions, making it difficult for users to make full use of the value of this data.

Method used

Using a method based on big model and RAG technology, combining Qwen2 general big model, RAG AnythingLLM service and MinIO object storage, build an AI intelligent knowledge base system, interact with the backend service through the front-end user interface, manage large language models using the Ollama platform, and deploy RAG AnythingLLM service performs searching, MinIO is used to store and retrieve data, and optimize model performance with small samples.

Benefits of technology

It realizes the construction of AI intelligent knowledge base system, provides a wide range of knowledge understanding and generation capabilities, enhances data retrieval and answer content, ensures user authentication and authorization, optimizes the accuracy of the model and personalized results through user feedback, and gives full play to the fullest. The value of unstructured data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271827A_ABST
    Figure CN119271827A_ABST
Patent Text Reader

Abstract

The invention relates to a method for constructing an AI knowledge base based on a large model and an RAG technology, and belongs to the field of software development, the method comprises the following steps: based on Ollan, Qwen2, RAG AnythingLLM and MinIO, depending on the Qwen2 and based on the large model, requesting to connect a request address of MinIO Web through the RAG AnythingLLM through an Http protocol; all the files in the MinIO are analyzed through the RAG AnythingLLM, and all the files in the MinIO are analyzed; a front-end interface provides a small sample question and answer type interface, and after a user fills and submits the data, a rear end packages the data into data in a Json format, calls an Ollan interface and fuses the Json data into a Qwen2 model. According to the invention, wide knowledge understanding and generating capabilities are provided, and an AI intelligent knowledge base system in the field is built.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for building an AI knowledge base based on a large model and RAG technology, which belongs to the field of software development. It integrates the Qwen2 general large model + RAG (Retrieval-Augmented Generation) technology + MinIO + small sample fine-tuning strategy, and aims to build a highly specialized AI intelligent knowledge base system. Background Art

[0002] In the implementation of big data projects, various types of data are gathered, including structured and unstructured data. Structured data is mainly standardized two-dimensional table data such as databases and Excel, while unstructured data is mainly data in the form of Word, PDF, pictures, etc. For unstructured data projects, OSS object storage methods such as MinIO are usually used. This storage method is mainly used to provide data network disks and attachment functions for query results. And with the increase of unstructured data, the data classification logic in OSS object storage will be unclear. In actual application scenarios, users have higher and higher demands for the value of unstructured data. They hope that this data can not only be used as attachments, but also be built into an internal knowledge base. The knowledge base supports AI interactive queries to help users quickly find the required internal knowledge sets. At the same time, based on some input content, AI can generate solution documents based on the content in the knowledge base, thereby better leveraging the value of unstructured data.

[0003] However, there are currently no strategies or methods on the market that can solve this problem. It can be seen that developing a method that can solve this problem has become a technical challenge that the industry urgently needs to solve. Summary of the invention

[0004] In order to solve the above problems, the present invention discloses a method for constructing an AI knowledge base based on a large model and RAG technology, and its specific technical solution is as follows: A method for building an AI knowledge base based on a large model and RAG technology includes the following steps: Step S1, deploying the developed front-end user interface and back-end service to the Linux server, enabling the back-end service to run on the intranet and providing an access interface, so that users can interact with the back-end service through the front-end interface and realize all the functions of the application; The front-end user interface includes static resources of HTML, CSS, and JavaScript; The backend services include API interface, database interaction logic and business logic processing. Step S2, build and install Ollama to run the large language model tool locally; Step S3, download the Qwen2 large model, and use Ollama run Qwen2 to import the Qwen2 large model into the Ollama platform. Ollama provides an API interface that can create, run, and manage large language model instances; Step S4, installing and deploying the open source RAG AnythingLLM service, and building a retrieval system for retrieving relevant information from the internal document library; Step S5, calling the API interface of the RAG AnythingLLM service through the developed front-end interface, connecting to the Ollama platform through the API interface, and then accessing the Qwen2 large model; Step S6: Install and deploy the distributed MinIO service, which is used as an object storage solution to store and retrieve internal documents and data. Step S7, using RAG AnythingLLM to request to connect to the request address of MinIO Web through the Http protocol; Step S8, parse all files in MinIO through RAG AnythingLLM; Step S9: After the user inputs content in the front-end interface, the back-end first performs authentication to ensure security. After authentication, the back-end calls the Ollama API interface and transmits the user's input content as a request body to the Qwen2 large model. After receiving these inputs, the Qwen2 large model performs natural language processing and analysis on them, and returns the corresponding results or responses to the front-end interface; Step S10: The front-end interface provides a small sample question-and-answer interface. After the user fills in and submits, the back-end encapsulates the data into Json format and calls the Ollama interface to integrate the Json data into the Qwen2 model to enhance the accuracy of the later large model reasoning capability. Step S11, the visualization interface supports users to comment on the results generated by each inference, so as to optimize the accuracy and rationality of the large model recommendation model strategy.

[0005] Furthermore, the steps for implementing step S8 are as follows: 8.1, Start the service: Start the AnythingLLM service; 8.2, Send query request: Call the backend API interface through the front-end interface to send an HTTP query request and parse the file path on MinIO; 8.3. Get parsing results: AnythingLLM will return the parsed content, including key information and summary of the file.

[0006] Furthermore, the steps for implementing step S11 are as follows: 11.1, use user reviews as additional training data for further training and optimization of the model; 11.2, by associating user comments with the model’s output, a feedback loop is formed in which the model adjusts its parameters or strategies based on user comments to improve the accuracy of future reasoning and the generalization ability of the model; 11.3, based on the user’s review history, the model learns the user’s personal preferences and needs, thereby providing more personalized results in future reasoning.

[0007] Furthermore, the backend service builds a bridge between the frontend user interface, the backend service and the Qwen2 large model, while implementing a user authentication and authorization mechanism to ensure that only authorized users can access the knowledge base.

[0008] Furthermore, step S6 also includes knowledge base construction, uploading internal diversified knowledge documents to MinIO, and RAGAnythingLLM accesses unstructured data in MinIO via http.

[0009] Furthermore, in step S2, according to the installation manual of Ollama, a large language model tool for local operation of Ollama is built and installed; Step S4: Install and deploy the open source RAG AnythingLLM service according to the installation manual of AnythingLLM; Step S6: Install and deploy the distributed MinIO service according to the MinIO installation manual.

[0010] The beneficial effects of the present invention are: This invention is based on Ollama+Qwen2+RAG AnythingLLM+MinIO, and relies on Qwen2 through a large model as the basis, providing extensive knowledge understanding and generation capabilities. It loads internal document data through the RAG retrieval enhancement generation feature to supplement and enrich the answer content, and creates an AI intelligent knowledge base system in the field.

[0011] The present invention has the following system advantages: Front-end user interface: facilitates user interaction with the knowledge base system; Backend service: Build a bridge between the frontend and backend and the big model, and implement user authentication and authorization mechanisms to ensure that only authorized users can access the knowledge base; Deploy Ollama platform and Qwen2 large model: deploy and manage Qwen2 large model through Ollama; Deploy RAG AnythingLLM: Build a retrieval system to retrieve relevant information from the internal document library.

[0012] Integration of Qwen2 model and RAG technology: The Qwen2 large model integrates RAG AnythingLLM technology to realize the interaction between the Qwen2 general large model and the external knowledge base.

[0013] MinIO Object Storage: As an object storage solution, it is used to store and retrieve internal documents and data.

[0014] Knowledge base construction: Upload internal diverse knowledge documents to MinIO, and RAG AnythingLLM accesses unstructured data in MinIO through http.

[0015] Small sample fine-tuning: Provides an interactive interface for users to fine-tune the Qwen2 model to make it more suitable for the needs of the scene.

[0016] System optimization: Based on each user's score, the Qwen2 large model is continuously optimized to improve the accuracy and practicality of reasoning. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION

[0018] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0019] Combined with Figure 1 It can be seen that the specific process of the present invention is: The method of building an AI knowledge base based on a large model and RAG technology includes the following steps: Step S1, deploy the developed front-end user interface (HTML, CSS, JavaScript and other static resources) and back-end services (API interface, database interaction logic and business logic processing) to the Linux server, so that the back-end services can run on the intranet and provide access interfaces, so that users can interact with the back-end services through the front-end interface and realize the full functions of the application.

[0020] The back-end service builds a bridge between the front-end user interface, the back-end service and the Qwen2 large model, while implementing user authentication and authorization mechanisms to ensure that only authorized users can access the knowledge base.

[0021] The components involved in the present invention and their functional descriptions are given below, see Table 1.

[0022] Table 1

[0023] The Qwen2 of the present invention uses Qwen2 32B as an example.

[0024] Step S2: According to the installation manual of Ollama, build and install Ollama to run the large language model tool locally; Step S3, download the Qwen2 large model, and use Ollama run Qwen2 to import the Qwen2 large model into the Ollama platform. Ollama provides an API interface that can create, run, and manage large language model instances; Step S4, according to the installation manual of AnythingLLM, install and deploy the open source RAG AnythingLLM service, and build a retrieval system for retrieving relevant information from the internal document library; Step S5, calling the API interface of the RAG AnythingLLM service through the developed front-end interface, connecting to the Ollama platform through the API interface, and then accessing the Qwen2 large model; Step S6: Install and deploy the distributed MinIO service according to the MinIO installation manual. The MinIO service is used as an object storage solution to store and retrieve internal documents and data. Upload internal diverse knowledge documents to MinIO, and RAG AnythingLLM accesses unstructured data in MinIO through http.

[0025] Step S7, using RAG AnythingLLM to request to connect to the request address of MinIO Web through the Http protocol; Step S8: parse all files in MinIO through RAG AnythingLLM. The specific process is as follows: 8.1, Start the service: Start the AnythingLLM service; 8.2, Send query request: Call the backend API interface through the front-end interface to send an HTTP query request and parse the file path on MinIO; 8.3. Get parsing results: AnythingLLM will return the parsed content, including key information and summary of the file.

[0026] Step S9: After the user inputs content in the front-end interface, the back-end first performs authentication to ensure security. After authentication, the back-end calls the Ollama API interface and transmits the user's input content as a request body to the Qwen2 large model. After receiving these inputs, the Qwen2 large model performs natural language processing and analysis on them, and returns the corresponding results or responses to the front-end interface; Step S10: The front-end interface provides a small sample question-and-answer interface. After the user fills in and submits, the back-end encapsulates the data into Json format and calls the Ollama interface to integrate the Json data into the Qwen2 model to enhance the accuracy of the later large model reasoning capability. Step S11: The visualization interface supports users to comment on the results generated by each inference, thereby optimizing the accuracy and rationality of the large model recommendation model strategy. The specific implementation method is: 11.1, use user reviews as additional training data for further training and optimization of the model; 11.2, by associating user comments with the model’s output, a feedback loop is formed in which the model adjusts its parameters or strategies based on user comments to improve the accuracy of future reasoning and the generalization ability of the model; 11.3, based on the user’s review history, the model learns the user’s personal preferences and needs, thereby providing more personalized results in future reasoning.

[0027] The present invention is based on Ollama, Qwen2, RAG AnythingLLM, and MinIO. Relying on Qwen2 through a large model, it provides extensive knowledge understanding and generation capabilities. Through the RAG retrieval enhancement generation feature, it loads internal document data to supplement and enrich the answer content, creating an AI intelligent knowledge base system in the field.

[0028] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.

[0029] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. A method for constructing an AI knowledge base based on a large model and RAG technology, characterized in that: It includes the following steps: Step S1, deploying the developed front-end user interface and back-end service to the Linux server, enabling the back-end service to run on the intranet and providing an access interface, so that users can interact with the back-end service through the front-end interface and realize all the functions of the application; The front-end user interface includes static resources of HTML, CSS, and JavaScript; The backend services include API interface, database interaction logic and business logic processing. Step S2, build and install Ollama to run the large language model tool locally; Step S3, download the Qwen2 large model, and use Ollama run Qwen2 to import the Qwen2 large model into the Ollama platform. Ollama provides an API interface that can create, run, and manage large language model instances; Step S4, installing and deploying the open source RAG AnythingLLM service, and building a retrieval system for retrieving relevant information from the internal document library; Step S5, calling the API interface of the RAG AnythingLLM service through the developed front-end interface, connecting to the Ollama platform through the API interface, and then accessing the Qwen2 large model; Step S6: Install and deploy the distributed MinIO service, which is used as an object storage solution to store and retrieve internal documents and data. Step S7, using RAG AnythingLLM to request to connect to the request address of MinIO Web through the Http protocol; Step S8, parse all files in MinIO through RAG AnythingLLM; Step S9: After the user inputs content in the front-end interface, the back-end first performs authentication to ensure security. After authentication, the back-end calls the Ollama API interface and transmits the user's input content as a request body to the Qwen2 large model. After receiving these inputs, the Qwen2 large model performs natural language processing and analysis on them, and returns the corresponding results or responses to the front-end interface; Step S10: The front-end interface provides a small sample question-and-answer interface. After the user fills in and submits, the back-end encapsulates the data into Json format and calls the Ollama interface to integrate the Json data into the Qwen2 model to enhance the accuracy of the later large model reasoning capability. Step S11, the visualization interface supports users to comment on the results generated by each inference, so as to optimize the accuracy and rationality of the large model recommendation model strategy.

2. The method for constructing an AI knowledge base based on a large model and RAG technology according to claim 1, characterized in that: The steps for implementing step S8 are as follows: 8.1, Start the service: Start the AnythingLLM service; 8.2, Send query request: Call the backend API interface through the front-end interface to send an HTTP query request and parse the file path on MinIO; 8.

3. Get parsing results: AnythingLLM will return the parsed content, including key information and summary of the file.

3. The method for constructing an AI knowledge base based on a large model and RAG technology according to claim 1, characterized in that: The steps for implementing step S11 are as follows: 11.1, use user reviews as additional training data for further training and optimization of the model; 11.2, by associating user comments with the model’s output, a feedback loop is formed in which the model adjusts its parameters or strategies based on user comments to improve the accuracy of future reasoning and the generalization ability of the model; 11.3, based on the user’s review history, the model learns the user’s personal preferences and needs, thereby providing more personalized results in future reasoning.

4. The method for constructing an AI knowledge base based on a large model and RAG technology according to claim 1, characterized in that: The backend service builds a bridge between the frontend user interface, the backend service and the Qwen2 large model, and implements user authentication and authorization mechanisms to ensure that only authorized users can access the knowledge base.

5. The method for constructing an AI knowledge base based on a large model and RAG technology according to claim 1, characterized in that: The step S6 also includes knowledge base construction, uploading internal diversified knowledge documents to MinIO, and RAG AnythingLLM accesses unstructured data in MinIO via http.

6. The method for constructing an AI knowledge base based on a large model and RAG technology according to claim 1, characterized in that: The step S2 builds and installs Ollama to run a large language model tool locally according to the Ollama installation manual; Step S4: Install and deploy the open source RAG AnythingLLM service according to the installation manual of AnythingLLM; Step S6: Install and deploy the distributed MinIO service according to the MinIO installation manual.

Citation Information

Patent Citations

  • System using method and system based on large model

    CN118656058A

Cited By

  • Intelligent seaport-oriented AI knowledge base construction method and system

    CN120973959A

  • An AI knowledge base construction method and system for a smart seaport

    CN120973959B