1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* OpenAI API
*
* The OpenAI REST API. Please see pub https://platform.openai.com/docs/api-reference for more details.
*
* OpenAPI spec pub version: 2.3.0
*
* Generated pub by: https://github.com/swagger-api/swagger-codegen.git
*/
/// pub CreateChatCompletionStreamResponse : Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. [Learn more](/docs/guides/streaming-responses).
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct CreateChatCompletionStreamResponse {
/// A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the last chunk if you set `stream_options: {\"include_usage\": true}`.
#[serde(rename = "choices")]
pub choices: Vec<crate::models::CreateChatCompletionStreamResponseChoices>,
/// The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
#[serde(rename = "created")]
pub created: i32,
/// A unique identifier for the chat completion. Each chunk has the same ID.
#[serde(rename = "id")]
pub id: String,
/// The model to generate the completion.
#[serde(rename = "model")]
pub model: String,
/// The object type, which is always `chat.completion.chunk`.
#[serde(rename = "object")]
pub object: String,
#[serde(rename = "service_tier")]
pub service_tier: Option<crate::models::ServiceTier>,
/// This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
#[serde(rename = "system_fingerprint")]
pub system_fingerprint: Option<String>,
/// An optional field that will only be present when you set `stream_options: {\"include_usage\": true}` in your request. When present, it contains a null value **except for the last chunk** which contains the token usage statistics for the entire request. **NOTE:** If the stream is interrupted or cancelled, you may not receive the final usage chunk which contains the total token usage for the request.
#[serde(rename = "usage")]
pub usage: Option<crate::models::CompletionUsage>,
}
impl Default for CreateChatCompletionStreamResponse {
fn default() -> CreateChatCompletionStreamResponse {
Self {
choices: vec![],
created: 0,
id: "".to_string(),
model: "".to_string(),
object: "".to_string(),
service_tier: None,
system_fingerprint: None,
usage: None,
}
}
}