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
14 changes: 12 additions & 2 deletions async-openai/src/types/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ pub struct Usage {
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct Response {
/// Unix timestamp (in seconds) when this Response was created.
pub created_at: u64,
pub created_at: f64,

/// Error object if the API failed to generate a response.
#[serde(skip_serializing_if = "Option::is_none")]
Expand All @@ -1351,7 +1351,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<Instructions>,

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

#[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