mirror of
https://github.com/labring/FastGPT.git
synced 2026-04-27 02:08:10 +08:00
765ec526cc
* docs(faq): 更新常见问题文档并新增注意事项页面 - 在 error.mdx 中调整问题序号并新增 OCR 配置问题 - 新增 attention.mdx 页面,提供问题排查步骤和技术支持指引 - 重构 dataset.mdx 内容结构,使用数字序号并补充知识库闪烁问题 * docs: 重构私有部署故障排查文档结构并新增详细指南 将原有的 FAQ 文档拆分为多个专题文档,包括通用问题排查、S3问题、OneAPI错误、模型可用性问题和排查方法。更新了导航菜单和目录结构,使文档组织更清晰,便于用户快速定位和解决特定问题。 新增了详细的故障排查步骤、CURL测试示例和具体错误解决方案,特别是针对对象存储连接、签名错误和模型调用失败等常见问题提供了更全面的指导。 * docs: 移除已弃用的 OneAPI 错误排查文档 移除 `oneapi-errors` 相关文档文件,因其内容已过时或合并至其他章节。同步更新中英文文档目录和元数据文件中的引用。 * docs: 更新文档FAQ内容,移除过时条目并重新编号 - 删除关于OneAPI官网的过时FAQ条目 - 重新编号故障排除FAQ章节,使序号连续 - 同步更新中英文文档内容保持一致 * docs: 重构FAQ和自托管文档结构,合并错误排查内容 将原FAQ中的“报错”和“注意”章节迁移至自托管文档的“故障排查”目录下 在model-errors.mdx中整合常见错误解决方案,如“上游负载饱和”和“Connection Error” 更新meta.json和toc.mdx文件以反映新的文档结构 --------- Co-authored-by: Archer <545436317@qq.com>
276 lines
6.9 KiB
Plaintext
276 lines
6.9 KiB
Plaintext
---
|
|
title: 模型问题排查
|
|
description: FastGPT 私有部署模型问题排查
|
|
---
|
|
|
|
|
|
### (1)如何检查模型可用性问题
|
|
|
|
1. 私有部署模型,先确认部署的模型是否正常。
|
|
2. 通过 CURL 请求,直接测试上游模型是否正常运行(云端模型或私有模型均进行测试)
|
|
3. 通过 CURL 请求,请求 OneAPI 去测试模型是否正常。
|
|
4. 在 FastGPT 中使用该模型进行测试。
|
|
|
|
下面是几个测试 CURL 示例:
|
|
|
|
<Tabs items={['LLM模型','Embedding模型','Rerank 模型','TTS 模型','Whisper 模型']}>
|
|
<Tab value="LLM模型">
|
|
```bash
|
|
curl https://api.openai.com/v1/chat/completions \
|
|
-H "Content-Type: application/json" \
|
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
-d '{
|
|
"model": "gpt-4o",
|
|
"messages": [
|
|
{
|
|
"role": "system",
|
|
"content": "You are a helpful assistant."
|
|
},
|
|
{
|
|
"role": "user",
|
|
"content": "Hello!"
|
|
}
|
|
]
|
|
}'
|
|
```
|
|
</Tab>
|
|
<Tab value="Embedding模型">
|
|
```bash
|
|
curl https://api.openai.com/v1/embeddings \
|
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"input": "The food was delicious and the waiter...",
|
|
"model": "text-embedding-ada-002",
|
|
"encoding_format": "float"
|
|
}'
|
|
```
|
|
</Tab>
|
|
<Tab value="Rerank 模型">
|
|
```bash
|
|
curl --location --request POST 'https://xxxx.com/api/v1/rerank' \
|
|
--header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw '{
|
|
"model": "bge-rerank-m3",
|
|
"query": "导演是谁",
|
|
"documents": [
|
|
"你是谁?\n我是电影《铃芽之旅》助手"
|
|
]
|
|
}'
|
|
```
|
|
</Tab>
|
|
<Tab value="TTS 模型">
|
|
```bash
|
|
curl https://api.openai.com/v1/audio/speech \
|
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"model": "tts-1",
|
|
"input": "The quick brown fox jumped over the lazy dog.",
|
|
"voice": "alloy"
|
|
}' \
|
|
--output speech.mp3
|
|
```
|
|
</Tab>
|
|
<Tab value="Whisper 模型">
|
|
```bash
|
|
curl https://api.openai.com/v1/audio/transcriptions \
|
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F file="@/path/to/file/audio.mp3" \
|
|
-F model="whisper-1"
|
|
```
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
---
|
|
|
|
### (2)报错 - 模型响应为空/模型报错
|
|
|
|
该错误是由于 stream 模式下,oneapi 直接结束了流请求,并且未返回任何内容导致。
|
|
|
|
4.8.10 版本新增了错误日志,报错时,会在日志中打印出实际发送的 Body 参数,可以复制该参数后,通过 curl 向 oneapi 发起请求测试。
|
|
|
|
由于 oneapi 在 stream 模式下,无法正确捕获错误,有时候可以设置成 `stream=false` 来获取到精确的错误。
|
|
|
|
可能的报错问题:
|
|
|
|
1. 国内模型命中风控
|
|
2. 不支持的模型参数:只保留 messages 和必要参数来测试,删除其他参数测试。
|
|
3. 参数不符合模型要求:例如有的模型 temperature 不支持 0,有些不支持两位小数。max_tokens 超出,上下文超长等。
|
|
4. 模型部署有问题,stream 模式不兼容。
|
|
|
|
测试示例如下,可复制报错日志中的请求体进行测试:
|
|
|
|
```bash
|
|
curl --location --request POST 'https://api.openai.com/v1/chat/completions' \
|
|
--header 'Authorization: Bearer sk-xxxx' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw '{
|
|
"model": "xxx",
|
|
"temperature": 0.01,
|
|
"max_tokens": 1000,
|
|
"stream": true,
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": " 你是饿"
|
|
}
|
|
]
|
|
}'
|
|
```
|
|
---
|
|
|
|
### (3)如何测试模型是否支持工具调用
|
|
|
|
需要模型提供商和 oneapi 同时支持工具调用才可使用,测试方法如下:
|
|
|
|
##### 1. 通过 `curl` 向 `oneapi` 发起第一轮 stream 模式的 tool 测试。
|
|
|
|
```bash
|
|
curl --location --request POST 'https://oneapi.xxx/v1/chat/completions' \
|
|
--header 'Authorization: Bearer sk-xxxx' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw '{
|
|
"model": "gpt-5",
|
|
"temperature": 0.01,
|
|
"max_tokens": 8000,
|
|
"stream": true,
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "几点了"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "hCVbIY",
|
|
"description": "获取用户当前时区的时间。",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {},
|
|
"required": []
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"tool_choice": "auto"
|
|
}'
|
|
```
|
|
|
|
|
|
##### 2. 检查响应参数
|
|
|
|
如果能正常调用工具,会返回对应 `tool_calls` 参数。
|
|
|
|
```json
|
|
{
|
|
"id": "chatcmpl-A7kwo1rZ3OHYSeIFgfWYxu8X2koN3",
|
|
"object": "chat.completion.chunk",
|
|
"created": 1726412126,
|
|
"model": "gpt-5",
|
|
"system_fingerprint": "fp_483d39d857",
|
|
"choices": [
|
|
{
|
|
"index": 0,
|
|
"id": "call_0n24eiFk8OUyIyrdEbLdirU7",
|
|
"type": "function",
|
|
"function": {
|
|
"name": "mEYIcFl84rYC",
|
|
"arguments": ""
|
|
}
|
|
}
|
|
],
|
|
"refusal": null
|
|
},
|
|
"logprobs": null,
|
|
"finish_reason": null
|
|
}
|
|
],
|
|
"usage": null
|
|
}
|
|
```
|
|
|
|
##### 3. 通过 `curl` 向 `oneapi` 发起第二轮 stream 模式的 tool 测试。
|
|
|
|
第二轮请求是把工具结果发送给模型。发起后会得到模型回答的结果。
|
|
|
|
```bash
|
|
curl --location --request POST 'https://oneapi.xxxx/v1/chat/completions' \
|
|
--header 'Authorization: Bearer sk-xxx' \
|
|
--header 'Content-Type: application/json' \
|
|
--data-raw '{
|
|
"model": "gpt-5",
|
|
"temperature": 0.01,
|
|
"max_tokens": 8000,
|
|
"stream": true,
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": "几点了"
|
|
},
|
|
{
|
|
"role": "assistant",
|
|
"tool_calls": [
|
|
{
|
|
"id": "kDia9S19c4RO",
|
|
"type": "function",
|
|
"function": {
|
|
"name": "hCVbIY",
|
|
"arguments": "{}"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tool_call_id": "kDia9S19c4RO",
|
|
"role": "tool",
|
|
"name": "hCVbIY",
|
|
"content": "{\n \"time\": \"2024-09-14 22:59:21 Sunday\"\n}"
|
|
}
|
|
],
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "hCVbIY",
|
|
"description": "获取用户当前时区的时间。",
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {},
|
|
"required": []
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"tool_choice": "auto"
|
|
}'
|
|
```
|
|
|
|
---
|
|
|
|
### (4)向量检索得分大于 1
|
|
|
|
由于模型没有归一化导致的。目前仅支持归一化的模型。
|
|
|
|
---
|
|
|
|
### (5) 当前分组上游负载已饱和,请稍后再试
|
|
|
|
如果在日志或请求中遇到此错误(如 `request id:xxx`),这通常是 OneAPI 渠道的问题,可以换个模型使用或者换一家中转站。
|
|
|
|
---
|
|
|
|
### (6) 使用API时在日志中报错 Connection Error
|
|
|
|
大概率是 API Key 填写了 OpenAI 的地址,但是部署的服务器在国内,不能访问海外的 API。可以使用中转或者反代的手段解决访问不到的问题。
|
|
|
|
---
|
|
|
|
### (7) 开启图片索引报 400
|
|
|
|
需在 `Admin` -> `系统配置` 中正确配置 OCR 模型。
|