Home > Technology peripherals > AI > body text

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

WBOY
Release: 2023-11-26 11:18:52
forward
2052 people have browsed it

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
Copy after login

If it has already been installed, skip directly

2. Container orchestration

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

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:
Copy after login

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}}
Copy after login

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
Copy after login

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!

Related labels:
source:51cto.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template