注意以下所有url中的:https://api.openai.com,需要替换为:https://api.zhizengzeng.com/)gpt-3.5-turbo模型,以完成从提示“Say this is a test”开始的文本。您应该会收到类似以下内容的响应:{
"id":"chatcmpl-abc123",
"object":"chat.completion",
"created":1677858242,
"model":"gpt-3.5-turbo-0301",
"usage":{
"prompt_tokens":13,
"completion_tokens":7,
"total_tokens":20
},
"choices":[
{
"message":{
"role":"assistant",
"content":"\n\nThis is a test!"
},
"finish_reason":"stop",
"index":0
}
]
}finish_reason 是 stop,这意味着API返回了模型生成的完整完成。在上面的请求中,我们只生成了一条消息,但您可以将 n 参数设置为生成多个消息选项。在此示例中,gpt-3.5-turbo 被用于更传统的 文本完成任务。该模型也针对 聊天应用 进行了优化。