Skip to content
Merged
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: 12 additions & 0 deletions async-openai/src/types/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ pub struct RunObject {
/// The list of [File](https://platform.openai.com/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run.
pub file_ids: Vec<String>,

/// Usage information for the [run](https://platform.openai.com/docs/api-reference/runs/step-object#runs/object-usage).
/// Usage information is available when the run reaches a terminal state.
pub usage: Option<RunUsage>,

pub metadata: Option<HashMap<String, serde_json::Value>>,
}

Expand Down Expand Up @@ -107,6 +111,14 @@ pub enum LastErrorCode {
RateLimitExceeded,
}

#[derive(Clone, Serialize, Debug, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub struct RunUsage {
pub completion_tokens: usize,
pub prompt_tokens: usize,
pub total_tokens: usize,
}

#[derive(Clone, Serialize, Default, Debug, Deserialize, Builder, PartialEq)]
#[builder(name = "CreateRunRequestArgs")]
#[builder(pattern = "mutable")]
Expand Down