Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion async-openai/src/types/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,16 @@ pub struct Usage {
pub total_tokens: u32,
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(untagged)]
pub enum ResponseInstructions {
/// if string is provided
Single(String),

/// if multiple instructions are provided
Multiple(Vec<InputMessage>),
}

/// The complete response returned by the Responses API.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct Response {
Expand All @@ -1345,7 +1355,7 @@ pub struct Response {

/// Instructions that were inserted as the first item in context.
#[serde(skip_serializing_if = "Option::is_none")]
pub instructions: Option<String>,
pub instructions: Option<ResponseInstructions>,

/// The value of `max_output_tokens` that was honored.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down