-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
130 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
"baseUrl": ".", | ||
"paths": { | ||
"*": [ | ||
"../../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/[email protected]/package/dist/cjs/popper.js/*", | ||
"../../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/[email protected]+incompatible/js/*" | ||
"../../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/[email protected]/package/dist/cjs/popper.js/*", | ||
"../../../../../.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/[email protected]+incompatible/js/*" | ||
] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
weight: 0 | ||
title: '本地模型使用' | ||
description: 'FastGPT 对接本地模型' | ||
icon: 'model_training' | ||
draft: false | ||
images: [] | ||
--- |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
--- | ||
title: '接入 M3E 向量模型' | ||
description: ' 将 FastGPT 接入私有化模型 M3E' | ||
icon: 'model_training' | ||
draft: false | ||
toc: true | ||
weight: 100 | ||
--- | ||
|
||
## 前言 | ||
|
||
FastGPT 默认使用了 openai 的 embedding 向量模型,如果你想私有部署的话,可以使用 M3E 向量模型进行替换。M3E 向量模型属于小模型,资源使用不高,CPU 也可以运行。下面教程是基于 “睡大觉” 同学提供的一个 CPU 版本的镜像。 | ||
|
||
## 部署镜像 | ||
|
||
镜像名: `stawky/m3e-large-api:latest` | ||
端口号: 6008 | ||
|
||
## 接入 OneAPI | ||
|
||
添加一个渠道,参数如下: | ||
|
||
![](/imgs/model-m3e1.png) | ||
|
||
## 测试 | ||
|
||
curl 例子: | ||
|
||
```bash | ||
curl --location --request POST 'https://domain/v1/embeddings' \ | ||
--header 'Authorization: Bearer sk-key' \ | ||
--header 'Content-Type: application/json' \ | ||
--data-raw '{ | ||
"model": "m3e", | ||
"input": ["laf是什么"] | ||
}' | ||
``` | ||
|
||
Authorization 为 sk-key。model 为刚刚在 OneAPI 填写的自定义模型。 | ||
|
||
## 接入 FastGPT | ||
|
||
修改 config.json 配置文件,在 VectorModels 中加入 M3E 模型: | ||
|
||
```json | ||
"VectorModels": [ | ||
{ | ||
"model": "text-embedding-ada-002", | ||
"name": "Embedding-2", | ||
"price": 0.2, | ||
"defaultToken": 500, | ||
"maxToken": 3000 | ||
}, | ||
{ | ||
"model": "m3e", | ||
"name": "M3E(测试使用)", | ||
"price": 0.1, | ||
"defaultToken": 500, | ||
"maxToken": 1800 | ||
} | ||
], | ||
``` | ||
|
||
## 测试使用 | ||
|
||
1. 创建知识库时候选择 M3E 模型。 | ||
|
||
注意,一旦选择后,知识库将无法修改向量模型。 | ||
|
||
![](/imgs/model-m3e2.png) | ||
|
||
2. 导入数据 | ||
3. 搜索测试 | ||
|
||
![](/imgs/model-m3e3.png) | ||
|
||
4. 应用绑定知识库 | ||
|
||
注意,应用只能绑定同一个向量模型的知识库,不能跨模型绑定。并且,需要注意调整相似度,不同向量模型的相似度(距离)会有所区别,需要自行测试实验。 | ||
|
||
![](/imgs/model-m3e4.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: '升级到 V4.2.1' | ||
description: 'FastGPT 从旧版本升级到 V4.2.1 操作指南' | ||
icon: 'upgrade' | ||
draft: false | ||
toc: true | ||
weight: 763 | ||
--- | ||
|
||
私有部署,如果添加了配置文件,需要在配置文件中修改 `VectorModels` 字段。增加 defaultToken 和 maxToken,分别对应直接分段时的默认 token 数量和该模型支持的 token 上限(通常不建议超过 3000) | ||
|
||
```json | ||
"VectorModels": [ | ||
{ | ||
"model": "text-embedding-ada-002", | ||
"name": "Embedding-2", | ||
"price": 0, | ||
"defaultToken": 500, | ||
"maxToken": 3000 | ||
} | ||
] | ||
``` | ||
|
||
改动目的是,我们认为不需要留有选择余地,选择一个最合适的模型去进行任务即可。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters