-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
dfff20e
commit 6659607
Showing
5 changed files
with
287 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# 国产大模型配置实例 | ||
|
||
### 混元配置项 | ||
配置混元模型需要以下参数: | ||
```yaml | ||
secretId: "xxx" | ||
secretKey: "xxx" | ||
region: "" | ||
maxTokensHunyuan: 1024 | ||
hunyuanType: 3 # 可选类型:0=高级版, 1=标准版std, 2=hunyuan-lite, 3=hunyuan-standard, 4=hunyuan-standard-256K, 5=hunyuan-pro | ||
hunyuanStreamModeration: true # 启用流式内容审核 | ||
topPHunyuan: 1.0 | ||
temperatureHunyuan: 1.0 # 控制生成内容的随机性 | ||
``` | ||
### 文心配置项 | ||
配置文心模型时需要以下参数,这里涵盖了接口的调用以及特殊参数的设置: | ||
```yaml | ||
wenxinAccessToken: "xxx" | ||
wenxinApiPath: "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant" | ||
wenxinEmbeddingUrl: "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/embeddings/embedding-v1" # 百度的embedding接口URL | ||
maxTokenWenxin: 1024 | ||
wenxinTopp: 0.7 # 控制输出文本的多样性,取值范围0.1~1.0,默认0.7 | ||
wenxinPenaltyScore: 1.0 # 增加生成token的惩罚,以减少重复,值越大惩罚越重 | ||
wenxinMaxOutputTokens: 100 # 模型最大输出token数,范围2~1024 | ||
``` | ||
### RWKV 模型配置(rwkv runner) | ||
```yaml | ||
rwkvApiPath: "https://" # 符合RWKV标准的API地址 | ||
rwkvMaxTokens: 100 | ||
rwkvTemperature: 1.1 | ||
rwkvTopP: 0.5 | ||
rwkvPresencePenalty: 0.5 | ||
rwkvFrequencyPenalty: 1.1 | ||
rwkvPenaltyDecay: 0.99 | ||
rwkvTopK: 25 | ||
rwkvSseType: 0 | ||
rwkvGlobalPenalty: false | ||
rwkvStop: | ||
- "\n\nUser" | ||
rwkvUserName: "User" | ||
rwkvAssistantName: "Assistant" | ||
rwkvSystemName: "System" | ||
rwkvPreSystem: false | ||
``` | ||
### TYQW 模型配置 | ||
```yaml | ||
tyqwApiPath: "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation" | ||
tyqwMaxTokens: 1500 | ||
tyqwModel: "qwen-turbo" | ||
tyqwApiKey: "sk-" | ||
tyqwWorkspace: "" | ||
tyqwTemperature: 0.85 | ||
tyqwTopP: 0.9 | ||
tyqwPresencePenalty: 0.2 | ||
tyqwFrequencyPenalty: 0.2 | ||
tyqwRepetitionPenalty: 1.1 | ||
tyqwPenaltyDecay: 0.99 | ||
tyqwTopK: 40 | ||
tyqwSeed: 1234 | ||
tyqwSseType: 1 | ||
tyqwGlobalPenalty: false | ||
tyqwStop: | ||
- "\n\nUser" | ||
tyqwUserName: "User" | ||
tyqwAssistantName: "Assistant" | ||
tyqwSystemName: "System" | ||
tyqwPreSystem: false | ||
tyqwEnableSearch: false | ||
``` | ||
### GLM 模型配置 | ||
```yaml | ||
glmApiPath: "https://open.bigmodel.cn/api/paas/v4/chat/completions" | ||
glmModel: "glm-3-turbo" | ||
glmApiKey: ".xxx" | ||
glmRequestID: "" | ||
glmDoSample: true | ||
glmTemperature: 0.95 | ||
glmTopP: 0.9 | ||
glmMaxTokens: 1024 | ||
glmStop: | ||
- "stop_token" | ||
glmTools: | ||
- "" | ||
glmToolChoice: "auto" | ||
glmUserID: "" | ||
``` |
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,49 @@ | ||
### 国际模型配置实例 | ||
|
||
#### api2d 配置项 | ||
```yaml | ||
gptModel: "gpt-3.5-turbo" | ||
gptApiPath: "https://openai.api2d.net/v1/chat/completions" | ||
gptToken: "fk207628-***********" | ||
maxTokenGpt: 1024 | ||
gptModeration: false # 额外走腾讯云检查安全,不合规直接拦截. 仅api2d支持 | ||
gptSafeMode: false | ||
gptSseType: 0 | ||
``` | ||
#### openai 测试配置 | ||
```yaml | ||
gptModel: "gpt-3.5-turbo" | ||
gptApiPath: "https://api.openai.com/v1/chat/completions" | ||
gptToken: "sk_8*******" | ||
maxTokenGpt: 1024 | ||
gptModeration: false # 额外走腾讯云检查安全,不合规直接拦截. 仅api2d支持 | ||
gptSafeMode: false | ||
gptSseType: 0 | ||
standardGptApi: true # 标准的gptApi, OpenAI 和 Groq 需要开启 | ||
``` | ||
#### Groq 测试配置 | ||
```yaml | ||
gptModel: "llama3-70b-8192" | ||
gptApiPath: "https://api.groq.com/openai/v1/chat/completions" | ||
gptToken: "gsk_8*******" | ||
maxTokenGpt: 1024 | ||
gptModeration: false # 额外走腾讯云检查安全,不合规直接拦截. 仅api2d支持 | ||
gptSafeMode: false | ||
gptSseType: 0 | ||
standardGptApi: true # 标准的gptApi, OpenAI 和 Groq 需要开启 | ||
``` | ||
#### One-API 测试配置(该项目也支持国内多个大模型,具体请参考one-api接入教程) | ||
[one-api](https://github.com/songquanpeng/one-api) | ||
```yaml | ||
gptModel: "chatglm_turbo" | ||
gptApiPath: "http://127.0.0.1:3000/v1/chat/completions" | ||
gptToken: "sk-d*****" | ||
maxTokenGpt: 1024 | ||
gptModeration: false # 额外走腾讯云检查安全,不合规直接拦截. 仅api2d支持 | ||
gptSafeMode: false | ||
gptSseType: 0 | ||
standardGptApi: true # 标准的gptApi, OpenAI 和 Groq 需要开启 | ||
``` |
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,39 @@ | ||
### 开始使用 One-API对接gsk-llm | ||
|
||
**步骤 1: 下载 One-API** | ||
- One-API 是一个轻便易用的项目,包含一个可执行文件,无需其他环境支持,且带有 Web UI。 | ||
- 下载链接:[one-api](https://github.com/songquanpeng/one-api) | ||
|
||
**步骤 2: 运行 One-API** | ||
- 执行下载的 One-API 可执行文件。 | ||
- 在浏览器中打开 `http://localhost:3000/`。 | ||
|
||
**步骤 3: 登录** | ||
- 使用默认用户名 `root` 和密码 `123456` 登录。 | ||
|
||
**步骤 4: 创建 API 渠道** | ||
- 在网页控制台的顶栏选择“渠道”-“添加新的渠道”。 | ||
- 为你的模型渠道命名,并在模型栏中输入你申请的模型名称,该栏支持自动补全。 | ||
- 输入你从模型所在平台(如腾讯云、智谱、通义等)获取的 API access token。 | ||
- 点击“提交”以创建 API 渠道。 | ||
|
||
**步骤 5: 生成令牌** | ||
- 点击顶栏的“令牌”并创建一个新令牌。 | ||
- 选择要使用的模型,创建令牌后点击绿色的“复制”按钮复制生成的令牌。 | ||
|
||
**步骤 6: 配置 gsk-llm** | ||
- 在 gsk-llm 配置文件中更新以下配置以连接到你的 one-api 平台。 | ||
```yaml | ||
# One-API 测试配置 | ||
gptModel: "chatglm_turbo" # 使用的模型名称 | ||
gptApiPath: "http://127.0.0.1:3000/v1/chat/completions" # One-API 服务的端口号 | ||
gptToken: "sk-dbmr0Oxxxxxxxxxxxxxxxxxxxxxxx" # 生成的密钥 | ||
maxTokenGpt: 1024 | ||
gptModeration: false | ||
gptSafeMode: false | ||
gptSseType: 0 | ||
standardGptApi: true # 启用标准 GPT API | ||
``` | ||
这样配置后,你就可以灵活地管理用量和使用的模型了。本项目的配置文件是热更新的,你不需要重启来应用配置. | ||
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,98 @@ | ||
|
||
# Gensokyo-LLM (gsk-llm) 初阶教程 | ||
|
||
## 名词介绍 | ||
**gsk-llm**:在本教程中,我们将 Gensokyo-LLM 缩写为 **gsk-llm**。 | ||
|
||
**OneBot v11 实现端**:实现了 OneBot v11 标准的应用。在教程中使用 Gensokyo,任何采用 OneBot v11 的实现端均可成功对接使用。 | ||
|
||
## 支持实现端列表 | ||
访问 [OneBot 生态系统](https://onebot.dev/ecosystem.html) 查看支持实现端的完整列表。 | ||
|
||
## 接入方法 | ||
|
||
### 使用ob11反向 WebSocket 接入 | ||
1. 直接让机器人连接到以下本程序地址的 port 上: | ||
- **反向链接地址**:`ws://127.0.0.1:46233` | ||
- **Port**:46233 | ||
|
||
连接成功后,机器人便可收发信息。 | ||
|
||
### 使用ob11 HTTP API 接入方法 | ||
1. 运行 gsk-llm 的 exe 可执行程序。 | ||
2. 打开 `config.yml` 文件并进行以下设置: | ||
- **通用配置项**: | ||
``` | ||
allApi: true # 同时开启全部 API | ||
useSse: true # 通过 stream 方式发送信息 | ||
port: 46233 | ||
path: "http://192.168.0.102:33800" | ||
``` | ||
- **配置监听地址**:确保没有端口冲突,可以保持默认。 | ||
- **配置 OneBot v11 的正向 HTTP API 地址**: | ||
``` | ||
path: "http://127.0.0.1:46233/gensokyo" | ||
``` | ||
- **上报消息地址**: | ||
``` | ||
http://192.168.0.102:33800 | ||
``` | ||
- **API 类型选择**: | ||
``` | ||
apiType: 5 # 选择适合的 API 类型,文末对api类型有讲解 | ||
``` | ||
- **API Key 设置**:填入对应平台的 API Key。 | ||
3. 设置 `systemPrompt` 为需要的人设提示词。 | ||
4. 根据注释完成其他必要配置。 | ||
一旦配置完成,你的机器人将作为一个基本的 AI 聊天对话机器人运行。 | ||
### 特别配置解释 | ||
- **useSse: true**:API 通过 stream 方式发送信息,机器人将流式地发送信息。 | ||
- **splitByPuntuations**: 40 #私聊截断率 | ||
- **splitByPuntuationsGroup**: 40 #群聊截断率,仅在 SSE 时有效,100 表示每句截断。 | ||
建议截断率取值范围为 30-40,以便优化信息流的连贯性。 | ||
--- | ||
### API apiType 类型选择 | ||
在配置文件中,`apiType` 用于指定使用的 API 类型。您可以根据需要选择以下编号对应的 API 类型: | ||
- **0:混元** | ||
- **1:文心** | ||
- **2:GPT** | ||
- **3:RWKV** | ||
- **4:TYQW** | ||
- **5:GLm** | ||
确保您有对应平台的 API key。 | ||
#### 特殊配置:API Type 2 | ||
当 `apiType` 设置为 **2(GPT)** 时,本程序支持兼容包括但不限于以下项目,以及所有采用 OpenAI 格式的 API 或中转项目: | ||
- [one-api](https://github.com/songquanpeng/one-api) | ||
- [groq](https://console.groq.com) | ||
对于完全标准的 OpenAI 格式 API,调整配置如下: | ||
- `standardGptApi: true` 表示启用原生的 OpenAI 格式 | ||
对于特殊的 OpenAI API 格式(api2d),则使用: | ||
- `standardGptApi: false` | ||
API2d 提供了一些额外的配置,如安全模式和腾讯云审核等: | ||
- [api-2d](https://api2d.com/) | ||
#### 网络代理设置 | ||
可以通过设置 `proxy: "http://192.168.0.113:7890"` 来使本程序通过网络代理。 | ||
#### 使用须知 | ||
请注意,部分平台如 QQ 开放平台和微信开放平台要求模型需要通过算法备案。请不要在这些平台使用未备案的模型。由此产生的服务号或机器人被下线的问题,本项目已尽到提醒的责任,概不负责。 | ||
--- |
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