DISC-MedLLM
DISC-MedLLM是一个专门针对医疗健康对话式场景而设计的医疗领域大模型,由复旦大学数据智能与社会计算实验室 (Fudan-DISC)开发并开源。本文介绍了相关API。
功能介绍
调用本接口,发起一次对话请求。
在线调试
平台提供了 API在线调试平台-示例代码 ,用于帮助开发者调试接口,平台集成快速检索、查看开发文档、查看在线调用的请求内容和返回结果、复制和下载示例代码等功能,简单易用,更多内容请查看API在线调试介绍。
SDK调用
使用说明
本文内容适用Python、Go、Java和Node.js SDK,SDK调用流程请参考SDK安装及使用流程。
调用示例(单轮)
对于用户快速部署自行发布的模型服务,通过使用endpoint
字段进行调用,示例如下。
import os
import qianfan
#通过环境变量初始化认证信息
# 方式一:【推荐】使用安全认证AK/SK鉴权
# 替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
os.environ["QIANFAN_ACCESS_KEY"] = "your_iam_ak"
os.environ["QIANFAN_SECRET_KEY"] = "your_iam_sk"
# 方式二:【不推荐】使用应用AK/SK鉴权
# 替换下列示例中参数,将应用API_Key、应用Secret key值替换为真实值
#os.environ["QIANFAN_AK"] = "应用API_Key"
#os.environ["QIANFAN_SK"] = "应用Secret_Key"
chat_comp = qianfan.ChatCompletion()
# 使用自行发布的模型
resp = chat_comp.do(endpoint="your_custom_endpoint", messages=[{
"role": "user",
"content": "你好"
}])
# 可以通过resp["body"]获取接口返回的内容
print(resp["body"])
package main
import (
"context"
"fmt"
"os"
"github.com/baidubce/bce-qianfan-sdk/go/qianfan"
)
func main() {
// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
os.Setenv("QIANFAN_ACCESS_KEY", "your_iam_ak")
os.Setenv("QIANFAN_SECRET_KEY", "your_iam_sk")
// 使用自行发布的模型
chat := qianfan.NewChatCompletion(
qianfan.WithEndpoint("endpoint"),
)
resp, _ := chat.Do(
context.TODO(),
&qianfan.ChatCompletionRequest{
Messages: []qianfan.ChatCompletionMessage{
qianfan.ChatCompletionUserMessage("你好!"),
},
},
)
fmt.Println(resp.Result)
}
import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;
public class Demo {
public static void main(String[] args) {
// 使用安全认证AK/SK鉴权,替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
Qianfan qianfan = new Qianfan("your_iam_ak", "your_iam_sk");
// 使用自行发布的模型,替换your_custom_endpoint
ChatResponse resp = qianfan.chatCompletion()
.endpoint("your_custom_endpoint")
.addMessage("user", "你好")
.execute();
System.out.println(resp.getResult());
}
}
import {ChatCompletion, setEnvVariable} from "@baiducloud/qianfan";
// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
setEnvVariable('QIANFAN_ACCESS_KEY','your_iam_ak');
setEnvVariable('QIANFAN_SECRET_KEY','your_iam_sk');
const client = new ChatCompletion({Endpoint: '***'});
async function main() {
const resp = await client.chat({
messages: [
{
role: 'user',
content: '你好',
},
],
});
console.log(resp);
}
main();
返回示例(单轮)
{
'id': 'as-4v1h587fyv',
'object': 'chat.completion',
'created': 1695021339,
'result': '您好,我是医疗助手大模型,很高兴为您服务',
'is_truncated': False,
'need_clear_history': False,
'usage': {
'prompt_tokens': 1,
'completion_tokens': 10,
'total_tokens': 11
}
}
您好,我是医疗助手大模型,很高兴为您服务
您好,我是医疗助手大模型,很高兴为您服务
{
id: 'as-xdiknr8pj9',
object: 'chat.completion',
created: 1709721393,
result: '您好,我是医疗助手大模型,很高兴为您服务',
is_truncated: false,
need_clear_history: false,
usage: { prompt_tokens: 1, completion_tokens: 10, total_tokens: 11 }
}
调用示例(多轮)
import os
import qianfan
#通过环境变量初始化认证信息
# 方式一:【推荐】使用安全认证AK/SK鉴权
# 替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
os.environ["QIANFAN_ACCESS_KEY"] = "your_iam_ak"
os.environ["QIANFAN_SECRET_KEY"] = "your_iam_sk"
# 方式二:【不推荐】使用应用AK/SK鉴权
# 替换下列示例中参数,将应用API_Key、应用Secret key值替换为真实值
#os.environ["QIANFAN_AK"] = "应用API_Key"
#os.environ["QIANFAN_SK"] = "应用Secret_Key"
chat_comp = qianfan.ChatCompletion()
# 多轮对话
resp = chat_comp.do(endpoint="your_custom_endpoint",messages=[{
"role": "user",
"content": "你好"
},
{
"role": "assistant",
"content": "您好,我是医疗助手大模型,很高兴为您服务"
},
{
"role": "user",
"content": "最近在旅行,吃饭不规律,晚上也有点熬夜。凌晨突然腹泻,次数频繁,上午量了下体温,发烧38度,请问可能是得了什么病"
},
])
print(resp["body"])
package main
import (
"context"
"fmt"
"os"
"github.com/baidubce/bce-qianfan-sdk/go/qianfan"
)
func main() {
// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
os.Setenv("QIANFAN_ACCESS_KEY", "your_iam_ak")
os.Setenv("QIANFAN_SECRET_KEY", "your_iam_sk")
// 多轮对话
chat := qianfan.NewChatCompletion(
qianfan.WithEndpoint("your_endpoint"),)
resp, _ := chat.Do(
context.TODO(),
&qianfan.ChatCompletionRequest{
Messages: []qianfan.ChatCompletionMessage{
qianfan.ChatCompletionUserMessage("你好!"),
qianfan.ChatCompletionAssistantMessage("您好,我是医疗助手大模型,很高兴为您服务"),
qianfan.ChatCompletionUserMessage("最近在旅行,吃饭不规律,晚上也有点熬夜。凌晨突然腹泻,次数频繁,上午量了下体温,发烧38度,请问可能是得了什么病"),
},
},
)
fmt.Println(resp.Result)
}
import com.baidubce.qianfan.Qianfan;
import com.baidubce.qianfan.model.chat.ChatResponse;
public class Demo {
public static void main(String[] args) {
// 使用安全认证AK/SK鉴权,替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
Qianfan qianfan = new Qianfan("your_iam_ak", "your_iam_sk");
// 多轮对话
ChatResponse resp = qianfan.chatCompletion()
.endpoint("your_custom_endpoint")
.addMessage("user", "你好")
.addMessage("assistant", "您好,我是医疗助手大模型,很高兴为您服务")
.addMessage("user", "最近在旅行,吃饭不规律,晚上也有点熬夜。凌晨突然腹泻,次数频繁,上午量了下体温,发烧38度,请问可能是得了什么病")
.execute();
System.out.println(resp.getResult());
}
}
import {ChatCompletion, setEnvVariable} from "@baiducloud/qianfan";
// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
setEnvVariable('QIANFAN_ACCESS_KEY','your_iam_ak');
setEnvVariable('QIANFAN_SECRET_KEY','your_iam_sk');
const client = new ChatCompletion({Endpoint: 'your_endpoint'});
async function main() { // 调用默认模型,即 ERNIE-Bot-turbo
const resp = await client.chat({
messages: [
{
role: 'user',
content: '你好!',
},
{
role: "assistant",
content: "您好,我是医疗助手大模型,很高兴为您服务"
},
{
role: "user",
"content": "最近在旅行,吃饭不规律,晚上也有点熬夜。凌晨突然腹泻,次数频繁,上午量了下体温,发烧38度,请问可能是得了什么病"
},
],
});
console.log(resp);
}
main();
返回示例(多轮)
{
'id': 'as-127xp18amc',
'object': 'chat.completion',
'created': 1718963291,
'result': '根据您的描述,您可能在旅行中因饮食不规律和熬夜而出现了一些症状。您现在出现了腹泻和发热的情况,可能涉及到以下几种可能的健康问题:\n\n1. 急性肠胃炎:这可能是由于您在旅行期间饮食不规律或者吃了不干净的食物引起的。腹泻和发热是急性肠胃炎的常见症状。\n2. 感冒或其他感染性疾病:在旅途中也可能接触到病毒和细菌等感染因素,可能导致发烧和其他不适感。\n\n考虑到以上情况,建议您及时就医进行检查,以便明确病因和进行治疗。此外,在就医前可以采取以下措施来缓解症状:\n\n1. 维持良好的饮食:避免吃油腻、辛辣或刺激性食物,多喝水以补充体液。\n2. 休息充足:保证充足的睡眠和休息,避免过度劳累。\n3. 降温:用湿毛巾或冰块进行物理降温,缓解发热带来的不适感。\n\n如果您担心自己可能患有某种疾病,建议及时就医进行检查和治疗。希望您能早日康复!',
'is_truncated': False,
'need_clear_history': False,
'usage': {
'prompt_tokens': 45,
'completion_tokens': 212,
'total_tokens': 257
}
}
根据您提供的症状,您可能患上了肠胃炎或食物中毒等消化系统疾病。由于您最近饮食不规律且晚上熬夜,这可能会影响您的身体免疫力和消化系统功能,从而增加了患上此类疾病的风险。
腹泻、频繁的排便和发烧是肠胃炎的常见症状。而食物中毒也可能导致类似的症状,尤其是如果您在旅行期间食用了不新鲜或未经适当处理的食物。
建议您尽快采取以下措施:
1. 保持充足的水分摄入,以避免脱水。
2. 避免食用油腻、辛辣或刺激性食物,以减轻消化系统的负担。
3. 如果症状持续不减或加重,请及时就医并进行相关检查,例如血液检查和粪便检查等,以确定病因并进行相应的治疗。
总之,根据您提供的症状,您可能患上了消化系统疾病。建议您注意休息、保持水分摄入并尽快就医,以便及时诊断和治疗。
根据您提供的症状,您可能因为饮食不规律和熬夜等因素导致身体出现了一些问题。突然的腹泻和频繁的排便可能是由肠胃炎、食物中毒、消化不良等引起的。而发烧38度则可能是身体在应对某种感染或炎症时的自然反应。
综合以上症状,您可能患上了肠胃炎或者食物中毒。建议您尽快采取以下措施:
1. 注意休息:保持充足的睡眠和休息对于恢复身体健康非常重要。
2. 饮食调整:避免食用过于油腻、辛辣、刺激性的食物,多吃一些清淡易消化的食物,如稀饭、面条等。
3. 多喝水:多喝水可以帮助补充体内水分和电解质,防止脱水。
4. 药物缓解:如果症状较严重,可以考虑使用一些药物来缓解症状,如止泻药、退烧药等。但请注意,在使用药物前最好咨询医生或药师的建议。
如果症状持续不减或者加重,建议您尽快前往当地医院就诊,以便医生进行详细的检查和诊断。同时,也要注意避免自行用药,以免延误病情。祝您早日康复!
{
id: 'as-1tidtqnbx7',
object: 'chat.completion',
created: 1718964924,
result: '您好,根据您的症状描述,您最近因为旅行导致的饮食不规律和熬夜,凌晨突然出现频繁腹泻,并且伴有发烧,这可能是身体对不规律作息和饮食的反应。\n' +
'\n' +
'可能的原因包括:\n' +
'\n' +
'1. 食物中毒或肠胃炎:如果您在旅行期间食用了不新鲜或未煮熟的食物,可能会引起肠胃炎或食物中毒,导致腹泻和发烧。\n' +
'\n' +
'2. 病毒感染:病毒如诺如病毒等也可能引起腹泻和发烧等症状。\n' +
'\n' +
'3. 睡眠不足和疲劳:由于您最近熬夜和饮食不规律,可能会导致身体疲劳和免疫力下降,从而引发这些症状。\n' +
'\n' +
'建议您采取以下措施:\n' +
'\n' +
'1. 饮食调整:尽量避免油腻、辛辣、生冷等刺激性食物,多喝水和清淡易消化的食物,如稀饭、面条等。\n' +
'\n' +
'2. 休息充足:保证充足的睡眠时间,尽量调整作息时间,避免熬夜和过度疲劳。\n' +
'\n' +
'3. 观察病情:如果症状持续加重或出现其他症状(如呕吐、腹痛等),建议及时就医并告知医生您的旅行史和症状。\n' +
'\n' +
'希望以上信息对您有所帮助。如果症状持续或加重,请及时就医并告知医生您的症状和旅行史。祝您早日康复!',
is_truncated: false,
need_clear_history: false,
usage: { prompt_tokens: 46, completion_tokens: 259, total_tokens: 305 }
}
调用示例(流式)
import os
import qianfan
#通过环境变量初始化认证信息
# 方式一:【推荐】使用安全认证AK/SK鉴权
# 替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
os.environ["QIANFAN_ACCESS_KEY"] = "your_iam_ak"
os.environ["QIANFAN_SECRET_KEY"] = "your_iam_sk"
# 方式二:【不推荐】使用应用AK/SK鉴权
# 替换下列示例中参数,将应用API_Key、应用Secret key值替换为真实值
#os.environ["QIANFAN_AK"] = "应用API_Key"
#os.environ["QIANFAN_SK"] = "应用Secret_Key"
chat_comp = qianfan.ChatCompletion()
resp = chat_comp.do(endpoint="your_custom_endpoint", messages=[{
"role": "user",
"content": "感冒流鼻涕,一直咳嗽,怎么办"
}], stream=True)
for r in resp:
print(r["body"])
# 输出:
# 您好!
# 有什么我可以帮助你的吗?
package main
import (
"context"
"fmt"
"os"
"github.com/baidubce/bce-qianfan-sdk/go/qianfan"
)
func main() {
// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
os.Setenv("QIANFAN_ACCESS_KEY", "your_iam_ak")
os.Setenv("QIANFAN_SECRET_KEY", "your_iam_sk")
chat := qianfan.NewChatCompletion(
qianfan.WithEndpoint("your_endpoint"),)
resp, _ := chat.Stream( // Stream 启用流式返回,参数与 Do 相同
context.TODO(),
&qianfan.ChatCompletionRequest{
Messages: []qianfan.ChatCompletionMessage{
qianfan.ChatCompletionUserMessage("感冒流鼻涕,一直咳嗽,怎么办"),
},
},
)
for {
r, err := resp.Recv()
if err != nil {
panic(err)
}
if resp.IsEnd { // 判断是否结束
break
}
fmt.Println(r.Result)
}
}
import com.baidubce.qianfan.Qianfan;
import com.google.gson.Gson;
public class Demo {
public static void main(String[] args) {
Gson gson = new Gson();
// 使用安全认证AK/SK鉴权,替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
Qianfan qianfan = new Qianfan("your_iam_ak", "your_iam_sk");
qianfan.chatCompletion()
.endpoint("your_custom_endpoint")
.addMessage("user", "感冒流鼻涕,一直咳嗽,怎么办")
// 启用流式返回
.executeStream()
.forEachRemaining(chunk -> System.out.print(gson.toJson(chunk)));
}
}
import {ChatCompletion, setEnvVariable} from "@baiducloud/qianfan";
// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
setEnvVariable('QIANFAN_ACCESS_KEY','your_iam_ak');
setEnvVariable('QIANFAN_SECRET_KEY','your_iam_sk');
const client = new ChatCompletion({Endpoint: 'your_endpoint'});
async function main() {
const stream = await client.chat({
messages: [
{
role: 'user',
content: '感冒流鼻涕,一直咳嗽,怎么办',
},
],
stream: true, //启用流式返回
});
for await (const chunk of stream ) {
console.log(chunk);
}
}
main();
返回示例(流式)
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964644, 'sentence_id': 0, 'is_end': False, 'is_truncated': False, 'result': '感冒流鼻涕', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 0, 'total_tokens': 7}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964645, 'sentence_id': 1, 'is_end': False, 'is_truncated': False, 'result': ',一直咳嗽,可以考虑采用以下方法:\n\n1. **多喝水**:感冒期间,保持充足的水分摄入有助于缓解不适症状。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 0, 'total_tokens': 7}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964645, 'sentence_id': 2, 'is_end': False, 'is_truncated': False, 'result': '\n2. **注意休息**:保持充足的睡眠,有助于身体恢复健康。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 0, 'total_tokens': 7}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964645, 'sentence_id': 3, 'is_end': False, 'is_truncated': False, 'result': '\n3. **合理饮食**:多吃富含营养的食物,如蔬菜、水果、肉类等,以提供身体所需的营养和能量。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 0, 'total_tokens': 7}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964646, 'sentence_id': 4, 'is_end': False, 'is_truncated': False, 'result': '\n4. **药物治疗**:如果症状严重,可以在医生的指导下使用感冒药、咳嗽药等药物进行治疗。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 98, 'total_tokens': 105}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964646, 'sentence_id': 5, 'is_end': False, 'is_truncated': False, 'result': '\n\n具体药物的使用应根据感冒的类型和程度来决定,切勿自行服药。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 98, 'total_tokens': 105}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964646, 'sentence_id': 6, 'is_end': False, 'is_truncated': False, 'result': '同时,如果咳嗽严重影响到日常生活,可以考虑寻求医疗帮助。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 98, 'total_tokens': 105}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964646, 'sentence_id': 7, 'is_end': False, 'is_truncated': False, 'result': '\n\n请注意,以上方法只能起到缓解作用,并不能根治感冒。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 98, 'total_tokens': 105}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964646, 'sentence_id': 8, 'is_end': False, 'is_truncated': False, 'result': '感冒通常需要时间自行痊愈。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 98, 'total_tokens': 105}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964647, 'sentence_id': 9, 'is_end': False, 'is_truncated': False, 'result': '希望以上信息能对您有所帮助,如果症状持续不减或加重,请及时就医。', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 98, 'total_tokens': 105}}
{'id': 'as-5n70dmkysx', 'object': 'chat.completion', 'created': 1718964647, 'sentence_id': 10, 'is_end': True, 'is_truncated': False, 'result': '', 'need_clear_history': False, 'usage': {'prompt_tokens': 7, 'completion_tokens': 170, 'total_tokens': 177}}
的问题。
7. 避免刺激物:避免吸烟和暴露在二手烟、空气污染和其他刺激物中,这些都可能加重咳嗽和流涕症状
。
8. 饮食调整:吃一些清淡、易消化的食物,如稀饭、面条等,避免辛辣、油腻和刺激性食物。
9. 咳嗽技巧:有时候轻轻咳嗽或使用蒸汽吸入器可以帮痰液松动并更容易排出。
如果症状持续不减或加重,建议及时就医,以便医生进行诊断和治疗。
特别是对于儿童、老年人或患有其他慢性疾病的人,更应该密切关注症状变化并寻求医生的建议。
{
"sentenceId": 0,
"isEnd": false,
"isTruncated": false,
"result": "针对感冒",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 2,
"totalTokens": 9
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965381,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 1,
"isEnd": false,
"isTruncated": false,
"result": "流鼻涕和咳嗽的症状,你可以采取以下措施来缓解症状并加速康复:\n\n1. 注意休息:保证充足的睡眠和休息时间,这有助于",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 2,
"totalTokens": 9
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965382,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 2,
"isEnd": false,
"isTruncated": false,
"result": "身体恢复和增强免疫力。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965382,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 3,
"isEnd": false,
"isTruncated": false,
"result": "\n2. 补充水分:多喝水或果汁等饮料,保持身体充足的水分。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965383,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 4,
"isEnd": false,
"isTruncated": false,
"result": "这有助于保持鼻腔湿润,防止流涕加重,也有助于排出体内的病毒。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965383,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 5,
"isEnd": false,
"isTruncated": false,
"result": "\n3. 温热敷:使用热水浸湿的毛巾敷在鼻子上,可以帮助减轻流鼻涕和鼻塞的症状。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965384,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 6,
"isEnd": false,
"isTruncated": false,
"result": "\n4. 清洁鼻腔:用生理盐水滴鼻液或用温开水清洗鼻腔,帮助清理掉鼻涕,并减轻鼻子的不适感。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965384,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 7,
"isEnd": false,
"isTruncated": false,
"result": "\n5. 药物缓解:可以考虑使用感冒药或止咳药来缓解症状。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965385,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 8,
"isEnd": false,
"isTruncated": false,
"result": "但请遵循医生建议的剂量和使用方法,并避免滥用药物。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965385,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 9,
"isEnd": false,
"isTruncated": false,
"result": "\n6. 饮食调理:饮食以清淡为主,多吃蔬菜水果,避免辛辣、油腻、刺激性食物。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965386,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 10,
"isEnd": false,
"isTruncated": false,
"result": "这有助于缓解咳嗽和流涕的症状。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965386,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 11,
"isEnd": false,
"isTruncated": false,
"result": "\n7. 增加室内湿度:使用加湿器或挂湿毛巾等增加室内湿度的方法,有助于缓解鼻塞和流涕的症状。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965386,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 12,
"isEnd": false,
"isTruncated": false,
"result": "\n8. 运动锻炼:适当进行运动锻炼,如散步、慢跑等,有助于增强身体的免疫力,促进身体恢复。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965387,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 13,
"isEnd": false,
"isTruncated": false,
"result": "\n\n如果症状严重或持续不减,建议及时就医。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965387,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 14,
"isEnd": false,
"isTruncated": false,
"result": "在医生的指导下进行诊断和治疗,以免延误病情。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965387,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 15,
"isEnd": false,
"isTruncated": false,
"result": "同时,保持良好的生活习惯和心态,也有助于身体的康复。",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 40,
"totalTokens": 47
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965388,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
} {
"sentenceId": 16,
"isEnd": true,
"isTruncated": false,
"result": "",
"needClearHistory": false,
"usage": {
"promptTokens": 7,
"completionTokens": 292,
"totalTokens": 299
},
"id": "as-wikvv4gqhb",
"object": "chat.completion",
"created": 1718965388,
"headers": {
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Origin": "*",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Content-Type": "text/event-stream; charset\u003dutf-8",
"Date": "Fri, 21 Jun 2024 10:23:01 GMT",
"P3p": "CP\u003d\" OTI DSP COR IVA OUR IND COM \"",
"Server": "Apache",
"Set-Cookie": "BAIDUID\u003d97A2AD014870DC7303526626CDD05238:FG\u003d1; expires\u003dThu, 31-Dec-37 23:55:55 GMT; max-age\u003d2145916555; path\u003d/; domain\u003d.baidu.com; version\u003d1",
"Statement": "AI-generated",
"X-Accel-Buffering": "no",
"X-Baidu-Request-Id": "00928b14411f5fb66e6cdeb0bc0e52441000924",
"X-Openapi-Server-Timestamp": "1718965381",
"X-Ratelimit-Limit-Requests": "300",
"X-Ratelimit-Limit-Tokens": "300000",
"X-Ratelimit-Remaining-Requests": "299",
"X-Ratelimit-Remaining-Tokens": "299993",
"Transfer-Encoding": "chunked"
}
}```
```JavaScript label=Node.js
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965673,
sentence_id: 0,
is_end: false,
is_truncated: false,
result: '针对感冒',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965673,
sentence_id: 1,
is_end: false,
is_truncated: false,
result: '、流鼻涕以及持续咳嗽的情况,首先应当判断症状的严重程度。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965673,
sentence_id: 2,
is_end: false,
is_truncated: false,
result: '如果是轻微的不适,通常可以通过一些家庭护理方法来缓解。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965674,
sentence_id: 3,
is_end: false,
is_truncated: false,
result: '而如果症状较重,建议及时就医寻求专业的治疗。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965674,
sentence_id: 4,
is_end: false,
is_truncated: false,
result: '\n\n1. 家庭护理方法:\n - 保持充足的休息:多休息有助于身体恢复。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965674,
sentence_id: 5,
is_end: false,
is_truncated: false,
result: '\n - 饮水保湿:多喝水可以帮助清洁呼吸道,并保持喉咙湿润。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965675,
sentence_id: 6,
is_end: false,
is_truncated: false,
result: '同时,温热的液体如热茶、鸡汤等也有助于缓解症状。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965676,
sentence_id: 7,
is_end: false,
is_truncated: false,
result: '\n - 空气湿度:使用加湿器增加室内空气湿度,有助于缓解呼吸道干燥和咳嗽。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965676,
sentence_id: 8,
is_end: false,
is_truncated: false,
result: '\n - 饮食调整:饮食宜清淡,多吃蔬菜水果,避免辛辣、油腻和刺激性食物。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965677,
sentence_id: 9,
is_end: false,
is_truncated: false,
result: '\n - 热敷:用热毛巾敷在脸上或前额上,可以缓解流鼻涕和鼻塞症状。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965677,
sentence_id: 10,
is_end: false,
is_truncated: false,
result: '\n\n2. 药物治疗:\n - 非处方药:可以在药师的建议下使用一些非处方的感冒药、止咳药来缓解症状。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965678,
sentence_id: 11,
is_end: false,
is_truncated: false,
result: '但应注意药物的剂量和使用方法,避免过量或不当使用。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965679,
sentence_id: 12,
is_end: false,
is_truncated: false,
result: '\n - 中药治疗:一些中成药如板蓝根颗粒、感冒清热颗粒等也可以考虑使用,但最好在医生或中药师的建议',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965679,
sentence_id: 13,
is_end: false,
is_truncated: false,
result: '下使用。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965679,
sentence_id: 14,
is_end: false,
is_truncated: false,
result: '\n\n3. 及时就医:\n - 如果症状持续加重或出现高烧、呼吸困难等严重情况,建议及时就医。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965680,
sentence_id: 15,
is_end: false,
is_truncated: false,
result: '医生会根据具体情况进行诊断和治疗,可能包括开处方药、进行实验室检查等。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965681,
sentence_id: 16,
is_end: false,
is_truncated: false,
result: '\n - 在就医时,告知医生您的症状、持续时间以及是否尝试过任何自我护理或药物治疗。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965681,
sentence_id: 17,
is_end: false,
is_truncated: false,
result: '\n\n除了上述措施外,还需注意预防感冒的再次发生。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965682,
sentence_id: 18,
is_end: false,
is_truncated: false,
result: '保持良好作息、加强锻炼、保持良好的卫生习惯(如勤洗手、戴口罩等)都有助于预防感冒。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965682,
sentence_id: 19,
is_end: false,
is_truncated: false,
result: '同时,保持良好的生活习惯和健康饮食也是增强免疫力、预防疾病的关键。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965683,
sentence_id: 20,
is_end: false,
is_truncated: false,
result: '\n\n总的来说,对于感冒流鼻涕和持续咳嗽的症状,首先要进行家庭护理和药物治疗来缓解不适。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965683,
sentence_id: 21,
is_end: false,
is_truncated: false,
result: '如果症状严重或持续不减,建议及时就医寻求专业治疗。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 0, total_tokens: 7 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965684,
sentence_id: 22,
is_end: false,
is_truncated: false,
result: '同时,加强预防措施,避免感冒的再次发生。',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 422, total_tokens: 429 }
}
{
id: 'as-hms7artiyk',
object: 'chat.completion',
created: 1718965684,
sentence_id: 23,
is_end: true,
is_truncated: false,
result: '',
need_clear_history: false,
usage: { prompt_tokens: 7, completion_tokens: 422, total_tokens: 429 }
}
请求参数
注意:以下为Python SDK参数说明,其他SDK参数相关说明请参考Go SDK-对话Chat参数相关说明、Java SDK参数相关说明、Node.js SDK参数相关说明。
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
messages | List[dict] | 是 | 聊天上下文信息。说明: (1)messages成员不能为空,1个成员表示单轮对话,多个成员表示多轮对话 (2)最后一个message为当前请求的信息,前面的message为历史对话信息 (3)必须为奇数个成员,成员中message的role必须依次为user、assistant (4)message中的content总长度不能超过4800个字符 |
endpoint | string | 是 | 用于指定用户自行发布的模型服务,说明: (1)该字段值可以通过查看服务地址获取:打开模型服务-模型推理-我的服务页面,选择创建的服务-点击详情页查看服务地址,endpoint值为 https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ 后面的地址,如下图所示(2)注意:在创建服务页面,选择模型后,API地址会自动新增个后缀。例如选择某模型,输入API地址为“test1”,endpoint的取值即为“ngxxxol8_test1”,如下图所示,如何发布服务请参考发布平台预置的模型服务 |
temperature | float | 否 | 说明: (1)较高的数值会使输出更加随机,而较低的数值会使其更加集中和确定 (2) 范围(0, 1.0],不能为0 |
top_k | float | 否 | Top-K 采样参数,在每轮token生成时,保留k个概率最高的token作为候选。说明: (1)影响输出文本的多样性,取值越大,生成文本的多样性越强 (2)取值范围:正整数 |
top_p | float | 否 | 说明: (1)影响输出文本的多样性,取值越大,生成文本的多样性越强 (2)取值范围 [0, 1.0] |
penalty_score | float | 否 | 通过对已生成的token增加惩罚,减少重复生成的现象。说明: (1)值越大表示惩罚越大 (2)取值范围:[1.0, 2.0] |
stream | bool | 否 | 是否以流式接口的形式返回数据,默认False · True:是,以流式接口的形式返回数据 · False:否 |
retry_count | int | 否 | 重试次数,默认1次 |
request_timeout | float | 否 | 请求超时时间,默认60秒 |
backoff_factor | float | 否 | 请求重试参数,用于指定重试的策略,默认为0 |
stop | List[string] | 否 | 生成停止标识。当模型生成结果以stop中某个元素结尾时,停止文本生成。说明: (1)每个元素长度不超过20字符。 (2)最多4个元素 |
user_id | string | 否 | 表示最终用户的唯一标识符 |
message说明
名称 | 类型 | 描述 |
---|---|---|
role | string | 当前支持以下: user: 表示用户 assistant: 表示对话助手 |
content | string | 对话内容,不能为空 |
返回参数
名称 | 类型 | 描述 |
---|---|---|
id | string | 本轮对话的id |
object | string | 回包类型。 chat.completion:多轮对话返回 |
created | int | 时间戳 |
sentence_id | int | 表示当前子句的序号。只有在流式接口模式下会返回该字段 |
is_end | bool | 表示当前子句是否是最后一句。只有在流式接口模式下会返回该字段 |
is_truncated | bool | 当前生成的结果是否被截断 |
result | string | 对话返回结果 |
need_clear_history | bool | 表示用户输入是否存在安全,是否关闭当前会话,清理历史会话信息 True:是,表示用户输入存在安全风险,建议关闭当前会话,清理历史会话信息 False:否,表示用户输入无安全风险 |
ban_round | int | 当need_clear_history为true时,此字段会告知第几轮对话有敏感信息,如果是当前问题,ban_round=-1 |
usage | usage | token统计信息 |
usage说明
名称 | 类型 | 描述 |
---|---|---|
prompt_tokens | int | 问题tokens数 |
completion_tokens | int | 回答tokens数 |
total_tokens | int | tokens总数 |
HTTP调用
鉴权说明
本文API,支持2种鉴权方式。不同鉴权方式,调用方式不同,使用Header、Query参数不同,详见本文请求说明。开发者可以选择以下任一种方式进行鉴权。
· 访问凭证access_token鉴权
· 基于安全认证AK/SK进行签名计算鉴权
请求说明
- 基本信息
请求地址: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/{创建服务时填写的API地址}
请求方式: POST
- API地址说明
创建服务时填写的API地址,相关内容请查看模型服务-在线服务-服务配置。
- Header参数
根据不同鉴权方式,查看对应Header参数。
访问凭证access_token鉴权
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
Content-Type | string | 是 | 固定值application/json |
基于安全认证AK/SK进行签名计算鉴权
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
Content-Type | string | 是 | 固定值application/json |
x-bce-date | string | 否 | 当前时间,遵循ISO8601规范,格式如2016-04-06T08:23:49Z |
Authorization | string | 是 | 用于验证请求合法性的认证信息,更多内容请参考鉴权认证机制,签名工具可参考IAM签名工具 |
- Query参数
只有访问凭证access_token鉴权方式,需使用Query参数。
访问凭证access_token鉴权
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
access_token | string | 是 | 通过API Key和Secret Key获取的access_token,参考Access Token获取 |
- Body参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
messages | List(message) | 是 | 聊天上下文信息。说明: (1)messages成员不能为空,1个成员表示单轮对话,多个成员表示多轮对话 (2)最后一个message为当前请求的信息,前面的message为历史对话信息 (3)必须为奇数个成员,成员中message的role必须依次为user、assistant (4)message中的content总长度不能超过4800个字符 |
stream | bool | 否 | 是否以流式接口的形式返回数据,默认false |
temperature | float | 否 | 说明: (1)较高的数值会使输出更加随机,而较低的数值会使其更加集中和确定 (2)范围 (0, 1.0],不能为0 |
top_k | int | 否 | Top-K 采样参数,在每轮token生成时,保留k个概率最高的token作为候选。说明: (1)影响输出文本的多样性,取值越大,生成文本的多样性越强 (2)取值范围:正整数 |
top_p | float | 否 | 说明: (1)影响输出文本的多样性,取值越大,生成文本的多样性越强 (2)取值范围 [0, 1.0] |
penalty_score | float | 否 | 通过对已生成的token增加惩罚,减少重复生成的现象。说明: (1)值越大表示惩罚越大 (2)取值范围:[1.0, 2.0] |
stop | List(String) | 否 | 生成停止标识。当模型生成结果以stop中某个元素结尾时,停止文本生成。说明: (1)每个元素长度不超过20字符。 (2)最多4个元素 |
user_id | string | 否 | 表示最终用户的唯一标识符 |
message说明
名称 | 类型 | 描述 |
---|---|---|
role | string | 当前支持以下: user: 表示用户 assistant: 表示对话助手 |
content | string | 对话内容,不能为空 |
响应说明
名称 | 类型 | 描述 |
---|---|---|
id | string | 本轮对话的id |
object | string | 回包类型。 chat.completion:多轮对话返回 |
created | int | 时间戳 |
sentence_id | int | 表示当前子句的序号。只有在流式接口模式下会返回该字段 |
is_end | bool | 表示当前子句是否是最后一句。只有在流式接口模式下会返回该字段 |
is_truncated | bool | 当前生成的结果是否被截断 |
result | string | 对话返回结果 |
need_clear_history | bool | 表示用户输入是否存在安全,是否关闭当前会话,清理历史会话信息 true:是,表示用户输入存在安全风险,建议关闭当前会话,清理历史会话信息 false:否,表示用户输入无安全风险 |
ban_round | int | 当need_clear_history为true时,此字段会告知第几轮对话有敏感信息,如果是当前问题,ban_round=-1 |
usage | usage | token统计信息 |
usage说明
名称 | 类型 | 描述 |
---|---|---|
prompt_tokens | int | 问题tokens数 |
completion_tokens | int | 回答tokens数 |
total_tokens | int | tokens总数 |
注意 :同步模式和流式模式,响应参数返回不同,详细内容参考示例描述。
- 同步模式下,响应参数为以上字段的完整json包。
- 流式模式下,各字段的响应参数为 data: {响应参数}。
请求示例(单轮)
以访问凭证access_token鉴权方式为例,说明如何调用API,示例如下。
# 步骤一,获取access_token,替换下列示例中的应用API Key与应用Secret Key
curl 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[应用API Key]&client_secret=[应用Secret Key]'
# 步骤二,调用本文API,使用步骤一获取的access_token,替换下列示例中的“调用接口获取的access_token”;替换示例中的创建服务时填写的API名称
curl -XPOST 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/[创建服务时填写的API名称]?access_token=[步骤一调用接口获取的access_token]' -d '{
"messages": [
{"role":"user","content":"你好"}
]
}' | iconv -f utf-8 -t utf-8
import requests
import json
def get_access_token():
"""
使用 API Key,Secret Key 获取access_token,替换下列示例中的应用API Key、应用Secret Key
"""
url = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[应用API Key]&client_secret=[应用Secret Key]"
payload = json.dumps("")
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
return response.json().get("access_token")
def main():
"""
替换下列示例中的创建服务时填写的API名称
"""
url = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/[创建服务时填写的API名称]?access_token=" + get_access_token()
payload = json.dumps({
"messages": [
{
"role": "user",
"content": "你好"
}
]
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
if __name__ == '__main__':
main()
响应示例(单轮)
{
"id": "as-vhsdz6iu2i",
"object": "chat.completion",
"created": 1702626862,
"result": "您好,我是医疗助手大模型,很高兴为您服务",
"is_truncated": false,
"need_clear_history": false,
"finish_reason": "normal",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 10,
"total_tokens": 11
}
}
请求示例(多轮)
# 步骤一,获取access_token,替换下列示例中的应用API Key与应用Secret Key
curl 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[应用API Key]&client_secret=[应用Secret Key]'
# 步骤二,调用本文API,使用步骤一获取的access_token,替换下列示例中的“调用接口获取的access_token”;替换示例中的创建服务时填写的API名称
curl -XPOST 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/[创建服务时填写的api名称}]?access_token=[步骤一调用接口获取的access_token]' -d '{
"messages": [
{"role":"user","content":"你好"},
{"role":"assistant","content":"您好,我是医疗助手大模型,很高兴为您服务"},
{"role":"user","content": "最近在旅行,吃饭不规律,晚上也有点熬夜。凌晨突然腹泻,次数频繁,上午量了下体温,发烧38度,请问可能是得了什么病"}
]
}' | iconv -f utf-8 -t utf-8
import requests
import json
def get_access_token():
"""
使用 API Key,Secret Key 获取access_token,替换下列示例中的应用API Key、应用Secret Key
"""
url = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[应用API Key]&client_secret=[应用Secret Key]"
payload = json.dumps("")
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
return response.json().get("access_token")
def main():
"""
替换下列示例中的创建服务时填写的API名称
"""
url = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/[创建服务时填写的API名称]?access_token=" + get_access_token()
payload = json.dumps({
"messages": [
{
"role": "user",
"content": "你好"
},
{
"role": "assistant",
"content": "您好,我是医疗助手大模型,很高兴为您服务"
},
{
"role": "user",
"content": "最近在旅行,吃饭不规律,晚上也有点熬夜。凌晨突然腹泻,次数频繁,上午量了下体温,发烧38度,请问可能是得了什么病?"
}
]
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
if __name__ == '__main__':
main()
响应示例(多轮)
HTTP/1.1 200 OK
Date: Mon, 12 Apr 2021 06:27:55 GMT
Content-Type: application/json;charset=utf-8
Statement: AI-generated
{
"id": "as-1tbbc0x5af",
"object": "chat.completion",
"created": 1680166551,
"result": "很抱歉听到您的不适。根据您描述的症状,包括腹泻、发烧和夜间睡眠不足等,可能是因为饮食不规律导致的胃肠功能紊乱引起的急性肠胃炎。此外,还有其他一些可能的原因也导致类似症状,例如食物中毒或肠道感染等。为了更准确地判断病因,我想请您提供更多关于当前症状的详细描述。在此期间,建议您多休息,保持室内空气流通,避免寒冷刺激。另外,您可以尝试以下措施来缓解症状:1.多喝水以补充体液;2.避免油腻和辛辣食物,选择清淡易消化的食物;3.注意个人卫生,勤洗手,避免交叉感染;4.如果发热持续或出现其他严重症状,请及时就医并进行进一步检查以明确病因。",
"is_truncated":false,
"need_clear_history": false,
"usage": {
"prompt_tokens": 45,
"completion_tokens": 256,
"total_tokens": 301
}
}
请求示例(流式)
# 步骤一,获取access_token,替换下列示例中的应用API Key与应用Secret Key
curl 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[应用API Key]&client_secret=[应用Secret Key]'
# 步骤二,调用本文API,使用步骤一获取的access_token,替换下列示例中的“调用接口获取的access_token”;替换示例中的创建服务时填写的API名称
curl -XPOST 'https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/[创建服务时填写的API名称]?access_token=[步骤一调用接口获取的access_token]' -d '{
"messages": [
{"role":"user", "content": "感冒流鼻涕,一直咳嗽,怎么办"}
],
"stream": true
}'
import requests
import json
def get_access_token():
"""
使用 API Key,Secret Key 获取access_token,替换下列示例中的应用API Key、应用Secret Key
"""
url = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[应用API Key]&client_secret=[应用Secret Key]"
payload = json.dumps("")
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
return response.json().get("access_token")
def main():
"""
替换下列示例中的创建服务时填写的API名称
"""
url = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/[创建服务时填写的API名称]?access_token=" + get_access_token()
payload = json.dumps({
"messages": [
{
"role": "user",
"content": "感冒流鼻涕,一直咳嗽,怎么办"
}
],
"stream": True
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload, stream=True)
for line in response.iter_lines():
print(line.decode("UTF-8"))
if __name__ == '__main__':
main()
响应示例(流式)
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628198,"sentence_id":0,"is_end":false,"is_truncated":false,"result":"很抱歉听到您的不适。针对感冒","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":0,"total_tokens":7}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628199,"sentence_id":1,"is_end":false,"is_truncated":false,"result":"引起的流鼻涕和咳嗽,可以采取以下措施:\n\n1. 保持良好的生活习惯:保持充足的睡眠,避免过度劳累,多喝水,多吃蔬菜水果,避免","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628200,"sentence_id":2,"is_end":false,"is_truncated":false,"result":"辛辣、刺激性食物,注意保暖,避免受凉。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628201,"sentence_id":3,"is_end":false,"is_truncated":false,"result":"\n2. 使用抗组胺药物:针对流鼻涕,可以使用抗组胺药物如氯雷他定等,可以缓解流鼻涕的症状。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628202,"sentence_id":4,"is_end":false,"is_truncated":false,"result":"\n3. 使用复方药物:针对感冒的其他症状,也可以采用复方药物进行治疗。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628203,"sentence_id":5,"is_end":false,"is_truncated":false,"result":"\n4. 针对咳嗽的治疗:可以采取一些止咳药物,如右美沙芬等。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628203,"sentence_id":6,"is_end":false,"is_truncated":false,"result":"\n5. 使用抗病毒药物:如果是由于病毒感染引起的感冒,可以使用抗病毒药物如快克等。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628204,"sentence_id":7,"is_end":false,"is_truncated":false,"result":"\n6. 采用中药治疗:针对不同类型的感冒,可以采取不同的中药治疗。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628206,"sentence_id":8,"is_end":false,"is_truncated":false,"result":"例如,对于风寒感冒,可以使用辛温解表的方法,如红糖、生姜一起熬水饮用,祛除体内的湿气;","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628207,"sentence_id":9,"is_end":false,"is_truncated":false,"result":"对于风热感冒,可以使用辛凉解表、清热解毒治疗为主的方法,如使用vC银翘片等。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":34,"total_tokens":41}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628209,"sentence_id":10,"is_end":false,"is_truncated":false,"result":"\n7. 增强免疫力:平时注意锻炼身体,增强机体的抗病毒能力、免疫力等。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":223,"total_tokens":230}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628210,"sentence_id":11,"is_end":false,"is_truncated":false,"result":"\n\n以上措施需要根据个人情况选择合适的方法进行治疗。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":235,"total_tokens":242}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628210,"sentence_id":12,"is_end":false,"is_truncated":false,"result":"如果症状持续严重或出现其他症状,建议及时就医。","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":235,"total_tokens":242}}
data: {"id":"as-hv7fej0cct","object":"chat.completion","created":1702628210,"sentence_id":13,"is_end":true,"is_truncated":false,"result":"","need_clear_history":false,"finish_reason":"normal","usage":{"prompt_tokens":7,"completion_tokens":248,"total_tokens":255}}
错误码
如果请求错误,服务器返回的JSON文本包含以下参数。
名称 | 描述 |
---|---|
error_code | 错误码 |
error_msg | 错误描述信息,帮助理解和解决发生的错误 |
例如Access Token失效返回以下内容,需要重新获取新的Access Token再次请求。
{
"error_code": 110,
"error_msg": "Access token invalid or no longer valid"
}
更多相关错误码,请查看错误码说明。