openai_struct/models/
chat_completion_request_user_message.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 ChatCompletionRequestUserMessage : Messages sent by an end user, containing prompts or additional context information.
12
13#[allow(unused_imports)]
14use serde_json::Value;
15
16/// # on openapi.yaml
17///
18/// ```yaml
19/// ChatCompletionRequestUserMessage:
20///   type: object
21///   title: User message
22///   description: |
23///     Messages sent by an end user, containing prompts or additional context
24///     information.
25///   properties:
26///     content:
27///       description: |
28///         The contents of the user message.
29///       oneOf:
30///         - type: string
31///           description: The text contents of the message.
32///           title: Text content
33///         - type: array
34///           description:
35///             An array of content parts with a defined type. Supported options
36///             differ based on the [model](/docs/models) being used to generate
37///             the response. Can contain text, image, or audio inputs.
38///           title: Array of content parts
39///           items:
40///             $ref: "#/components/schemas/ChatCompletionRequestUserMessageContentPart"
41///           minItems: 1
42///     role:
43///       type: string
44///       enum:
45///         - user
46///       description: The role of the messages author, in this case `user`.
47///       x-stainless-const: true
48///     name:
49///       type: string
50///       description: An optional name for the participant. Provides the model
51///         information to differentiate between participants of the same role.
52///   required:
53///     - content
54///     - role
55/// ```
56#[derive(Debug, Serialize, Deserialize, PartialEq)]
57pub struct ChatCompletionRequestUserMessage {
58    /// The contents of the user message.
59    #[serde(rename = "content")]
60    pub content: ChatCompletionRequestUserMessageContent,
61    /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
62    #[serde(rename = "name")]
63    pub name: Option<String>,
64}
65
66#[derive(Debug, Serialize, Deserialize, PartialEq)]
67#[serde(untagged)]
68pub enum ChatCompletionRequestUserMessageContent {
69    Text(String),
70    Array(Vec<crate::ChatCompletionRequestUserMessageContentPart>),
71}