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
18 changes: 16 additions & 2 deletions async-openai/src/types/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,9 +1364,9 @@ pub struct Response {
#[serde(skip_serializing_if = "Option::is_none")]
pub incomplete_details: Option<IncompleteDetails>,

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

/// The value of `max_output_tokens` that was honored.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -1447,13 +1447,27 @@ pub struct Response {
pub user: Option<String>,
}

/// Represents instructions inserted as the first item(s) in the model's context.
///
/// NOTE: When creating a response directly via the OpenAI API, only a string instruction can be specified.
/// However, when using prompts created through the OpenAI dashboard, both "developer" and "prompt" messages can be included.
/// "Prompt" messages may consist of both "user" and "assistant" message types.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(untagged, rename_all = "snake_case")]
pub enum Instructions {
String(String),
Array(Vec<InputItem>),
}

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum Status {
Completed,
Failed,
InProgress,
Incomplete,
Queued,
Cancelled,
}

/// Event types for streaming responses from the Responses API
Expand Down
Loading