openai_struct/models/
chat_completion_stream_options.rs

1/*
2 * OpenAI API
3 *
4 * The OpenAI REST API. Please see pub https:///platform.openai.com/docs/api-reference for more details.
5 *
6 * OpenAPI spec pub version: 2.3.0
7 *
8 * Generated pub by: https:///github.com/swagger-api/swagger-codegen.git
9 */
10
11/// pub ChatCompletionStreamOptions : Options for streaming response. Only set this when you set `stream: true`.
12
13#[allow(unused_imports)]
14use serde_json::Value;
15
16/// # on openapi.yaml
17///
18/// ```yaml
19/// ChatCompletionStreamOptions:
20///   description: >
21///     Options for streaming response. Only set this when you set `stream:
22///     true`.
23///   type: object
24///   nullable: true
25///   default: null
26///   properties:
27///     include_usage:
28///       type: boolean
29///       description: >
30///         If set, an additional chunk will be streamed before the `data:
31///         [DONE]`
32///
33///         message. The `usage` field on this chunk shows the token usage
34///         statistics
35///
36///         for the entire request, and the `choices` field will always be an
37///         empty
38///
39///         array.
40///
41///
42///         All other chunks will also include a `usage` field, but with a null
43///
44///         value. **NOTE:** If the stream is interrupted, you may not receive
45///         the
46///
47///         final usage chunk which contains the total token usage for the
48///         request.
49/// ```
50#[derive(Debug, Serialize, Deserialize)]
51pub struct ChatCompletionStreamOptions {
52    /// If set, an additional chunk will be streamed before the `data: [DONE]` message. The `usage` field on this chunk shows the token usage statistics for the entire request, and the `choices` field will always be an empty array.   All other chunks will also include a `usage` field, but with a null value. **NOTE:** If the stream is interrupted, you may not receive the final usage chunk which contains the total token usage for the request.
53    #[serde(rename = "include_usage")]
54    pub include_usage: Option<bool>,
55}