search
HomeTechnology peripheralsAIQuickly build a large language model AI knowledge base in just three minutes

FastGPT

FastGPT is a knowledge base question and answer system built using the LLM large language model, which can provide plug-and-play data processing and model calling functions. At the same time, it also supports Flow visual workflow orchestration to realize complex question and answer scenarios

Knowledge base core flow chart

Quickly build a large language model AI knowledge base in just three minutesPicture

Image source: https://doc.fastgpt.in

Private deployment

Use Docker Compose here to quickly perform FastGPT privatization deployment

1. Install Docker

# 安装 Dockercurl -fsSL https://get.docker.com | bash -s docker --mirror Aliyunsystemctl enable --now docker# 安装 docker-composecurl -L https://github.com/docker/compose/releases/download/2.20.3/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-compose# 验证安装docker -vdocker-compose -v

If it has already been installed, skip directly

2. Container orchestration

Create a local directory and enter the directory
mkdir tinywan-fastgptcd tinywan-fastgpt

The directory path created above is /d/Tinywan/GPT/tinywan-fastgpt

docker-compose.yml configuration file
version: '3.3'services:pg:image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.5.0 # 阿里云container_name: pgrestart: alwaysports: # 生产环境建议不要暴露- 5432:5432networks:- fastgptenvironment:# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果- POSTGRES_USER=username- POSTGRES_PASSWORD=password- POSTGRES_DB=postgresvolumes:- ./pg/data:/var/lib/postgresql/datamongo:image: mongo:5.0.18# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云container_name: mongorestart: alwaysports: # 生产环境建议不要暴露- 27017:27017networks:- fastgptenvironment:# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果- MONGO_INITDB_ROOT_USERNAME=username- MONGO_INITDB_ROOT_PASSWORD=passwordvolumes:- ./mongo/data:/data/dbfastgpt:container_name: fastgptimage: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:latest # 阿里云ports:- 3000:3000networks:- fastgptdepends_on:- mongo- pgrestart: alwaysenvironment:# root 密码,用户名为: root- DEFAULT_ROOT_PSW=123465# 中转地址,如果是用官方号,不需要管- OPENAI_BASE_URL=https://api.openai.com/v1- CHAT_API_KEY=sb-xxx- DB_MAX_LINK=5 # database max link- TOKEN_KEY=any- ROOT_KEY=root_key- FILE_TOKEN_KEY=filetoken# mongo 配置,不需要改. 如果连不上,可能需要去掉 ?authSource=admin- MONGODB_URI=mongodb://username:password@mongo:27017/fastgpt?authSource=admin# pg配置. 不需要改- PG_URL=postgresql://username:password@pg:5432/postgresvolumes:- ./config.json:/app/data/config.jsonnetworks:fastgpt:

Note: Please fill in the value corresponding to CHAT_API_KEY.

config.json configuration file
{"SystemParams": {"pluginBaseUrl": "","vectorMaxProcess": 15,"qaMaxProcess": 15,"pgHNSWEfSearch": 100},"ChatModels": [{"model": "gpt-3.5-turbo-1106","name": "GPT35-1106","price": 0,"maxContext": 16000,"maxResponse": 4000,"quoteMaxToken": 2000,"maxTemperature": 1.2,"censor": false,"vision": false,"defaultSystemChatPrompt": ""},{"model": "gpt-3.5-turbo-16k","name": "GPT35-16k","maxContext": 16000,"maxResponse": 16000,"price": 0,"quoteMaxToken": 8000,"maxTemperature": 1.2,"censor": false,"vision": false,"defaultSystemChatPrompt": ""},{"model": "gpt-4","name": "GPT4-8k","maxContext": 8000,"maxResponse": 8000,"price": 0,"quoteMaxToken": 4000,"maxTemperature": 1.2,"censor": false,"vision": false,"defaultSystemChatPrompt": ""},{"model": "gpt-4-vision-preview","name": "GPT4-Vision","maxContext": 128000,"maxResponse": 4000,"price": 0,"quoteMaxToken": 100000,"maxTemperature": 1.2,"censor": false,"vision": true,"defaultSystemChatPrompt": ""}],"QAModels": [{"model": "gpt-3.5-turbo-16k","name": "GPT35-16k","maxContext": 16000,"maxResponse": 16000,"price": 0}],"CQModels": [{"model": "gpt-3.5-turbo-1106","name": "GPT35-1106","maxContext": 16000,"maxResponse": 4000,"price": 0,"functionCall": true,"functionPrompt": ""},{"model": "gpt-4","name": "GPT4-8k","maxContext": 8000,"maxResponse": 8000,"price": 0,"functionCall": true,"functionPrompt": ""}],"ExtractModels": [{"model": "gpt-3.5-turbo-1106","name": "GPT35-1106","maxContext": 16000,"maxResponse": 4000,"price": 0,"functionCall": true,"functionPrompt": ""}],"QGModels": [{"model": "gpt-3.5-turbo-1106","name": "GPT35-1106","maxContext": 1600,"maxResponse": 4000,"price": 0}],"VectorModels": [{"model": "text-embedding-ada-002","name": "Embedding-2","price": 0.2,"defaultToken": 700,"maxToken": 3000}],"AudioSpeechModels": [{"model": "tts-1","name": "OpenAI TTS1","price": 0,"voices": [{"label": "Alloy","value": "alloy","bufferId": "openai-Alloy"},{"label": "Echo","value": "echo","bufferId": "openai-Echo"},{"label": "Fable","value": "fable","bufferId": "openai-Fable"},{"label": "Onyx","value": "onyx","bufferId": "openai-Onyx"},{"label": "Nova","value": "nova","bufferId": "openai-Nova"},{"label": "Shimmer","value": "shimmer","bufferId": "openai-Shimmer"}]}],"WhisperModel": {"model": "whisper-1","name": "Whisper1","price": 0}}

3. Start the container

Get the updated version of the image through the command docker-compose pull

Quickly build a large language model AI knowledge base in just three minutesPicture

Start the container through the command docker-compose up -d

Quickly build a large language model AI knowledge base in just three minutesPicture

View the startup status of the container

Quickly build a large language model AI knowledge base in just three minutesPicture

4. Access FastGPT

Currently available Direct access via ip:3000. This is a local deployment, so you can access it directly through http://127.0.0.1:3000.

Deployment is successful, you can access the following page:

Quickly build a large language model AI knowledge base in just three minutesPicture

The login user name is root and the password is DEFAULT_ROOT_PSW set in the docker-compose.yml environment variable.

After successful login, you will be redirected to the following page:

Quickly build a large language model AI knowledge base in just three minutesPicture

Build Knowledge Base

Create Knowledge Base

After successful login, we can create a new knowledge base and name it Open Source Technology Stack

Quickly build a large language model AI knowledge base in just three minutesPicture

The way to import personal experience into the knowledge base is through file

. The content that needs to be rewritten is: [New/Import] [File Import]. Rewritten content: [Create/Import][File Import]

Quickly build a large language model AI knowledge base in just three minutesPicture

After confirmation, start converting the current data into vector data

Quickly build a large language model AI knowledge base in just three minutesPicture

When selecting a file to import, you can choose the direct segmentation plan. Direct segmentation will use the sentence segmenter to split the text to a certain length, and finally split it into multiple groups of q. If you choose the direct segmentation solution, it is recommended to use a general template when setting the reference prompt words in the application. There is no need to select a question and answer template

Import successful

Quickly build a large language model AI knowledge base in just three minutes图片

至此,个人知识库已经建好了。尝试进行测试问答

Quickly build a large language model AI knowledge base in just three minutes图片

重新书写后的内容:重新连接训练数据

https://mp.weixin.qq.com/s/1GD8eKrxJWXdgS3OKR4VHQhttps://mp.weixin.qq.com/s/BFdfDXHavZ_jZwVaFq2duQhttps://mp.weixin.qq.com/s/mNhMCzUtLUKrIzqSVa-qZAhttps://mp.weixin.qq.com/s/n4n-0UCWJW9u2N1ca3HisQhttps://mp.weixin.qq.com/s/WXAPxHYteX7h1Hu73KEnFQhttps://mp.weixin.qq.com/s/chI8IbenaMFejvS7blLsBw

Quickly build a large language model AI knowledge base in just three minutes图片

等待所有数据准备就绪

Quickly build a large language model AI knowledge base in just three minutes图片

使用知识库

创建应用

使用知识库必须要创建一个应用

Quickly build a large language model AI knowledge base in just three minutes图片

关联知识库

已添加开场白并选择绑定相应的知识库开源技术堆栈

Quickly build a large language model AI knowledge base in just three minutes图片

点击保存预留后,可以直接在右边调试预览框预览对话进行文档内容测试。

开始对话

Quickly build a large language model AI knowledge base in just three minutes图片

Quickly build a large language model AI knowledge base in just three minutes图片

请点击链接查看知识库引用

Quickly build a large language model AI knowledge base in just three minutes图片

打开对应链接可以直接跳转到微信公众号文章地址

总结

构建私有数据训练服务,针对问题提供精准回答。可以通过AI服务训练自有数据,形成AI知识库,然后创建不同的机器人针对用户问题提供精准回答。并且可以通过API接口很方便整合到自己的产品服务中。

The above is the detailed content of Quickly build a large language model AI knowledge base in just three minutes. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:51CTO.COM. If there is any infringement, please contact admin@php.cn delete
How to Build Your Personal AI Assistant with Huggingface SmolLMHow to Build Your Personal AI Assistant with Huggingface SmolLMApr 18, 2025 am 11:52 AM

Harness the Power of On-Device AI: Building a Personal Chatbot CLI In the recent past, the concept of a personal AI assistant seemed like science fiction. Imagine Alex, a tech enthusiast, dreaming of a smart, local AI companion—one that doesn't rely

AI For Mental Health Gets Attentively Analyzed Via Exciting New Initiative At Stanford UniversityAI For Mental Health Gets Attentively Analyzed Via Exciting New Initiative At Stanford UniversityApr 18, 2025 am 11:49 AM

Their inaugural launch of AI4MH took place on April 15, 2025, and luminary Dr. Tom Insel, M.D., famed psychiatrist and neuroscientist, served as the kick-off speaker. Dr. Insel is renowned for his outstanding work in mental health research and techno

The 2025 WNBA Draft Class Enters A League Growing And Fighting Online HarassmentThe 2025 WNBA Draft Class Enters A League Growing And Fighting Online HarassmentApr 18, 2025 am 11:44 AM

"We want to ensure that the WNBA remains a space where everyone, players, fans and corporate partners, feel safe, valued and empowered," Engelbert stated, addressing what has become one of women's sports' most damaging challenges. The anno

Comprehensive Guide to Python Built-in Data Structures - Analytics VidhyaComprehensive Guide to Python Built-in Data Structures - Analytics VidhyaApr 18, 2025 am 11:43 AM

Introduction Python excels as a programming language, particularly in data science and generative AI. Efficient data manipulation (storage, management, and access) is crucial when dealing with large datasets. We've previously covered numbers and st

First Impressions From OpenAI's New Models Compared To AlternativesFirst Impressions From OpenAI's New Models Compared To AlternativesApr 18, 2025 am 11:41 AM

Before diving in, an important caveat: AI performance is non-deterministic and highly use-case specific. In simpler terms, Your Mileage May Vary. Don't take this (or any other) article as the final word—instead, test these models on your own scenario

AI Portfolio | How to Build a Portfolio for an AI Career?AI Portfolio | How to Build a Portfolio for an AI Career?Apr 18, 2025 am 11:40 AM

Building a Standout AI/ML Portfolio: A Guide for Beginners and Professionals Creating a compelling portfolio is crucial for securing roles in artificial intelligence (AI) and machine learning (ML). This guide provides advice for building a portfolio

What Agentic AI Could Mean For Security OperationsWhat Agentic AI Could Mean For Security OperationsApr 18, 2025 am 11:36 AM

The result? Burnout, inefficiency, and a widening gap between detection and action. None of this should come as a shock to anyone who works in cybersecurity. The promise of agentic AI has emerged as a potential turning point, though. This new class

Google Versus OpenAI: The AI Fight For StudentsGoogle Versus OpenAI: The AI Fight For StudentsApr 18, 2025 am 11:31 AM

Immediate Impact versus Long-Term Partnership? Two weeks ago OpenAI stepped forward with a powerful short-term offer, granting U.S. and Canadian college students free access to ChatGPT Plus through the end of May 2025. This tool includes GPT‑4o, an a

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment