The interface request uses a binary request, and the data is returned in a stream, that is, returned in blocks (batches).
Question: How many days are there in a week
request header
Detailed parameters
parameter name |
illustrate |
role |
The role of the message sender, in this case "assistant". |
id |
Unique identifier for the message. |
parentMessageId |
The ID of the parent message, which can be used to determine the hierarchical relationship between messages. |
text |
The text content of the message, which is "one". |
delta |
The difference between the message and the original text is the addition of a Chinese character "一". |
detail attribute |
|
id |
(Unique identifier for the message, same as the id attribute above. |
object |
The type of the message object, here is "chat.completion.chunk", indicating that the message is a chat completion block. |
created |
The timestamp of message creation, in seconds. |
model |
The AI model name used, here is "gpt-3.5-turbo-0301". |
choices attribute |
|
delta |
The difference between the suggestion and the original text, here {"content": "one"}. |
index |
The index number of this suggestion in all suggestions, here is 0. |
finish_reason |
The reason why the AI model provides completion suggestions, "stop" means the model stops providing completion suggestions, and null means the model continues to provide suggestions, but the content has not been loaded yet. |
- role: The role of the message sender, here is "assistant".
- id: A unique identifier for the message.
- parentMessageId: The ID of the parent message, which can be used to determine the hierarchical relationship between messages.
- text: The text content of the message, ie "one".
- delta: The difference between the message and the original text, that is, a Chinese character "one" is added.
In the detail attribute, include the following sub-attributes:
- id: The unique identifier of the message, same as the id attribute above.
- object: The type of message object, here is "chat.completion.chunk", indicating that the message is a chat completion block.
- created: The timestamp of message creation, in seconds.
- model: The name of the AI model used, here is "gpt-3.5-turbo-0301".
- choices: Completion suggestions generated by the AI model, which is a list containing only one element. This element contains the following attributes:
-
- delta: The difference between the suggestion and the original text, here {"content": "one"}.
- index: The index number of the suggestion in all suggestions, here is 0.
- finish_reason: The reason why the AI model provides completion suggestions, "stop" indicates that the model stops providing completion suggestions, and null indicates that the model continues to provide suggestions, but the content has not been loaded yet.
- return data for the first time
{
"role": "assistant",
"id": "chatcmpl-757xI2obW41Qyx7M9g25ZicbgjNWX",
"parentMessageId": "12913811-4262-41b7-ba34-19bf62a0c0ae",
"text": "",
"detail": {
"id": "chatcmpl-757xI2obW41Qyx7M9g25ZicbgjNWX",
"object": "chat.completion.chunk",
"created": 1681456576,
"model": "gpt-3.5-turbo-0301",
"choices": [{
"delta": {
"role": "assistant"
},
"index": 0,
"finish_reason": null
}]
}
}
- return data a second time
{
"role": "assistant",
"id": "chatcmpl-757xI2obW41Qyx7M9g25ZicbgjNWX",
"parentMessageId": "12913811-4262-41b7-ba34-19bf62a0c0ae",
"text": "一",
"detail": {
"id": "chatcmpl-757xI2obW41Qyx7M9g25ZicbgjNWX",
"object": "chat.completion.chunk",
"created": 1681456576,
"model": "gpt-3.5-turbo-0301",
"choices": [{
"delta": {
"content": "一"
},
"index": 0,
"finish_reason": null
}]
}
}
- last returned result
{
"role": "assistant",
"id": "chatcmpl-757xI2obW41Qyx7M9g25ZicbgjNWX",
"parentMessageId": "12913811-4262-41b7-ba34-19bf62a0c0ae",
"text": "一周有七天。",
"detail": {
"id": "chatcmpl-757xI2obW41Qyx7M9g25ZicbgjNWX",
"object": "chat.completion.chunk",
"created": 1681456576,
"model": "gpt-3.5-turbo-0301",
"choices": [{
"delta": {},
"index": 0,
"finish_reason": "stop"
}]
}
}