chatgpt api 接口中的message 参数说明

2023-4-11 philsun 科技

   messages字段组成部分包括角色role和content问题两个部分组成,如下所示:

 model="gpt-3.5-turbo",
  messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Who won the world series in 2020?"},
        {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
        {"role": "user", "content": "Where was it played?"}
    ]

在gpt-3.5-turbo模型中,角色role包含system系统、assistant助手和用户user三种类型。

System角色相当于告诉ChatGPT具体以何种角色回答问题,需要在content中指明具体的角色和问题内容。

而gpt-3.5-turbo-0301主要区别在于更加关注问题内容,而不会特别关注具体的角色部分。

gpt-3.5-turbo-0301模型有效期到6月1日,而gpt-3.5-turbo会持续更新。

assistant助手和用户user则相当于已经指明了角色,content直接写入关注的问题即可。

标签: chatgpt

发表评论:

Powered by emlog 鲁ICP备13004488