Skip to content

Commit cd3acb4

Browse files
authored
v4.6-4 (#473)
1 parent bfd8be5 commit cd3acb4

File tree

39 files changed

+453
-156
lines changed

39 files changed

+453
-156
lines changed
54.3 KB
Loading

docSite/content/docs/installation/upgrading/46.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ curl --location --request POST 'https://{{host}}/api/admin/initv46-2' \
5050
1. 新增 - 团队空间
5151
2. 新增 - 多路向量(多个向量映射一组数据)
5252
3. 新增 - tts语音
53-
4. 线上环境新增 - ReRank向量召回,提高召回精度
54-
5. 优化 - 知识库导出,可直接触发流下载,无需等待转圈圈
53+
4. 新增 - 支持知识库配置文本预处理模型
54+
5. 线上环境新增 - ReRank向量召回,提高召回精度
55+
6. 优化 - 知识库导出,可直接触发流下载,无需等待转圈圈

docSite/content/docs/pricing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: '定价'
3-
description: 'FastGPT 的定价'
2+
title: '线上版定价'
3+
description: 'FastGPT 线上版定价'
44
icon: 'currency_yen'
55
draft: false
66
toc: true
7-
weight: 10
7+
weight: 11
88
---
99

1010
## Tokens 说明
@@ -15,7 +15,7 @@ weight: 10
1515

1616
## FastGPT 线上计费
1717

18-
目前,FastGPT 线上计费也仅按 Tokens 使用数量为准。以下是详细的计费表(最新定价以线上表格为准,可在点击充值后实时获取):
18+
使用: [https://fastgpt.run](https://fastgpt.run)[https://ai.fastgpt.in](https://ai.fastgpt.in) 只需仅按 Tokens 使用数量扣费即可。可在 账号-使用记录 中查看具体使用情况,以下是详细的计费表(最新定价以线上表格为准,可在点击充值后实时获取):
1919

2020
{{< table "table-hover table-striped-columns" >}}
2121
| 计费项 | 价格: 元/ 1K tokens(包含上下文) |

docSite/content/docs/use-cases/datasetEngine.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "知识库结构讲解"
3-
description: "本节会介绍 FastGPT 知识库结构设计,理解其 QA 的存储格式和检索格式,以便更好的构建知识库。这篇介绍主要以使用为主,详细原理不多介绍。"
3+
description: "本节会详细介绍 FastGPT 知识库结构设计,理解其 QA 的存储格式和多向量映射,以便更好的构建知识库。这篇介绍主要以使用为主,详细原理不多介绍。"
44
icon: "dataset"
55
draft: false
66
toc: true
@@ -25,13 +25,21 @@ FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 Fast
2525

2626
FastGPT 采用了 `PostgresSQL``PG Vector` 插件作为向量检索器,索引为`HNSW`。且`PostgresSQL`仅用于向量检索,`MongoDB`用于其他数据的存取。
2727

28-
`PostgresSQL`的表中,设置一个 `index` 字段用于存储向量、一个 `q` 字段用于存储向量对应的内容,以及一个 `a` 字段用于检索映射。之所以取字段为 `qa` 是由于一些历史缘故,无需完全解为 “问答对” 的格式。在实际使用过程中,可以利用`q``a`的组合,对检索后的内容做进一步的声明,提高大模型的理解力(注意,这里不直接提高搜索精度)
28+
`PostgresSQL`的表中,设置一个 `index` 字段用于存储向量,以及一个`data_id`用于在`MongoDB`中寻找对应的映射值。多个`index`可以对应一组`data_id`,也就是说,一组向量可以对应多组数据。在进行检索时,相同数据会进行合并
2929

30-
目前,提高向量搜索的精度,主要可以通过几种途径:
30+
![](/imgs/datasetSetting1.png)
3131

32-
1. 精简`q`的内容,减少向量内容的长度:当`q`的内容更少,更准确时,检索精度自然会提高。但与此同时,会牺牲一定的检索范围,适合答案较为严格的场景。
33-
2. 更好分词分段:当一段话的结构和语义是完整的,并且是单一的,精度也会提高。因此,许多系统都会优化分词器,尽可能的保障每组数据的完整性。
34-
3. 多样性文本:为一段内容增加关键词、摘要、相似问题等描述性信息,可以使得该内容的向量具有更大的检索覆盖范围。
32+
## 多向量的目的和使用方式
33+
34+
在一组数据中,如果我们希望它尽可能长,但语义又要在向量中尽可能提现,则没有办法通过一组向量来表示。因此,我们采用了多向量映射的方式,将一组数据映射到多组向量中,从而保障数据的完整性和语义的提现。
35+
36+
你可以为一组较长的文本,添加多组向量,从而在检索时,只要其中一组向量被检索到,该数据也将被召回。
37+
38+
## 提高向量搜索精度的方法
39+
40+
1. 更好分词分段:当一段话的结构和语义是完整的,并且是单一的,精度也会提高。因此,许多系统都会优化分词器,尽可能的保障每组数据的完整性。
41+
2. 精简`index`的内容,减少向量内容的长度:当`index`的内容更少,更准确时,检索精度自然会提高。但与此同时,会牺牲一定的检索范围,适合答案较为严格的场景。
42+
3. 丰富`index`的数量,可以为同一个`chunk`内容增加多组`index`
3543
4. 优化检索词:在实际使用过程中,用户的问题通常是模糊的或是缺失的,并不一定是完整清晰的问题。因此优化用户的问题(检索词)很大程度上也可以提高精度。
3644
5. 微调向量模型:由于市面上直接使用的向量模型都是通用型模型,在特定领域的检索精度并不高,因此微调向量模型可以很大程度上提高专业领域的检索效果。
3745

packages/global/common/string/textSplitter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ export const splitText2Chunks = (props: { text: string; maxLen: number; overlapL
6363
let chunks: string[] = [];
6464
for (let i = 0; i < splitTexts.length; i++) {
6565
let text = splitTexts[i];
66-
let chunkToken = countPromptTokens(lastChunk, '');
67-
const textToken = countPromptTokens(text, '');
66+
let chunkToken = lastChunk.length;
67+
const textToken = text.length;
6868

6969
// next chunk is too large / new chunk is too large(The current chunk must be smaller than maxLen)
7070
if (textToken >= maxLen || chunkToken + textToken > maxLen * 1.4) {

packages/global/core/dataset/type.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { VectorModelItemType } from '../../core/ai/model.d';
1+
import type { LLMModelItemType, VectorModelItemType } from '../../core/ai/model.d';
22
import { PermissionTypeEnum } from '../../support/permission/constant';
33
import { PushDatasetDataChunkProps } from './api';
44
import {
@@ -19,6 +19,7 @@ export type DatasetSchemaType = {
1919
avatar: string;
2020
name: string;
2121
vectorModel: string;
22+
agentModel: string;
2223
tags: string[];
2324
type: `${DatasetTypeEnum}`;
2425
permission: `${PermissionTypeEnum}`;
@@ -84,8 +85,9 @@ export type CollectionWithDatasetType = Omit<DatasetCollectionSchemaType, 'datas
8485
};
8586

8687
/* ================= dataset ===================== */
87-
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel'> & {
88+
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentModel'> & {
8889
vectorModel: VectorModelItemType;
90+
agentModel: LLMModelItemType;
8991
isOwner: boolean;
9092
canWrite: boolean;
9193
};

packages/global/support/wallet/bill/api.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { BillListItemType } from './type';
33

44
export type CreateTrainingBillProps = {
55
name: string;
6+
vectorModel?: string;
7+
agentModel?: string;
68
};
79

810
export type ConcatBillProps = {

packages/service/core/app/schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const AppSchema = new Schema({
6161

6262
try {
6363
AppSchema.index({ updateTime: -1 });
64-
AppSchema.index({ 'share.collection': -1 });
6564
} catch (error) {
6665
console.log(error);
6766
}

packages/service/core/dataset/collection/schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ const DatasetCollectionSchema = new Schema({
6969

7070
try {
7171
DatasetCollectionSchema.index({ datasetId: 1 });
72-
DatasetCollectionSchema.index({ userId: 1 });
7372
DatasetCollectionSchema.index({ updateTime: -1 });
7473
} catch (error) {
7574
console.log(error);

packages/service/core/dataset/schema.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ const DatasetSchema = new Schema({
4848
required: true,
4949
default: 'text-embedding-ada-002'
5050
},
51+
agentModel: {
52+
type: String,
53+
required: true,
54+
default: 'gpt-3.5-turbo-16k'
55+
},
5156
type: {
5257
type: String,
5358
enum: Object.keys(DatasetTypeMap),

0 commit comments

Comments
 (0)