openai_struct/models/chat_completion_stream_response_delta.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 ChatCompletionStreamResponseDelta : A chat completion delta generated by streamed model responses.
12
13#[allow(unused_imports)]
14use serde_json::Value;
15
16/// # on openapi.yaml
17///
18/// ```yaml
19/// ChatCompletionStreamResponseDelta:
20/// type: object
21/// description: A chat completion delta generated by streamed model responses.
22/// properties:
23/// content:
24/// type: string
25/// description: The contents of the chunk message.
26/// nullable: true
27/// function_call:
28/// deprecated: true
29/// type: object
30/// description:
31/// Deprecated and replaced by `tool_calls`. The name and arguments of
32/// a function that should be called, as generated by the model.
33/// properties:
34/// arguments:
35/// type: string
36/// description:
37/// The arguments to call the function with, as generated by the model
38/// in JSON format. Note that the model does not always generate
39/// valid JSON, and may hallucinate parameters not defined by your
40/// function schema. Validate the arguments in your code before
41/// calling your function.
42/// name:
43/// type: string
44/// description: The name of the function to call.
45/// tool_calls:
46/// type: array
47/// items:
48/// $ref: "#/components/schemas/ChatCompletionMessageToolCallChunk"
49/// role:
50/// type: string
51/// enum:
52/// - developer
53/// - system
54/// - user
55/// - assistant
56/// - tool
57/// description: The role of the author of this message.
58/// refusal:
59/// type: string
60/// description: The refusal message generated by the model.
61/// nullable: true
62/// ```
63#[derive(Debug, Serialize, Deserialize)]
64pub struct ChatCompletionStreamResponseDelta {
65 /// The contents of the chunk message.
66 #[serde(rename = "content")]
67 pub content: Option<String>,
68 #[serde(rename = "function_call")]
69 pub function_call: Option<crate::models::ChatCompletionStreamResponseDeltaFunctionCall>,
70 /// The refusal message generated by the model.
71 #[serde(rename = "refusal")]
72 pub refusal: Option<String>,
73 /// The role of the author of this message.
74 #[serde(rename = "role")]
75 pub role: Option<String>,
76 #[serde(rename = "tool_calls")]
77 pub tool_calls: Option<Vec<crate::models::ChatCompletionMessageToolCallChunk>>,
78}
79
80impl Default for ChatCompletionStreamResponseDelta {
81 fn default() -> Self {
82 Self {
83 content: None,
84 function_call: None,
85 refusal: None,
86 role: None,
87 tool_calls: None,
88 }
89 }
90}