仅发起对话接口需要在接口传参中添加消息内容(content)和消息类型(type),但不同场景支持传入的消息类型和角色类型(role)不同。本文档介绍各个场景支持的 type 类型及各种类型消息内容示例。
仅发起对话接口支持将此参数作为入参,且:
其中,type=question 只能和 role=user 对应,即仅用户角色可以且只能发起 question 类型的消息。
|
type |
发起对话 |
||
|---|---|---|---|
|
Response |
Request,且 autoSaveHistory=false |
Request,且 autoSaveHistory=true |
|
|
question |
❌ |
✔️ |
✔️ |
|
answer |
✔️ |
✔️ |
✔️ |
|
function_call |
✔️ |
✔️ |
❌ |
|
tool_output/tool_response |
✔️ |
✔️ |
❌ |
|
follow_up |
✔️ |
❌ |
❌ |
|
knowledge |
✔️ |
❌ |
❌ |
|
verbose |
✔️ |
❌ |
❌ |
创建消息并指定消息类型时,应遵循 type、role 和 content_type 的匹配关系,例如 role 为 user 时,type 只能为 question。详细的匹配关系及消息体示例可参考下表。
|
消息类型(type) |
角色 |
内容类型 |
示例 |
|---|---|---|---|
|
question |
user |
|
|
|
answer |
assistant |
text |
|
|
function_call |
assistant |
text |
|
|
tool_output/tool_response |
assistant |
text |
|
|
follow_up |
assistant |
text |
|
|
verbose |
assistant |
text |
|