Skip to content

Commit

Permalink
Merge pull request #101 from dongri/json-format-runs
Browse files Browse the repository at this point in the history
Add response_format
  • Loading branch information
dongri authored Jul 20, 2024
2 parents 1d7edd5 + 349102f commit aaf0647
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/v1/run.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::thread::CreateThreadRequest;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;

use crate::impl_builder_methods;
Expand All @@ -15,6 +16,8 @@ pub struct CreateRunRequest {
pub tools: Option<Vec<HashMap<String, String>>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub response_format: Option<Value>, // 1: json!("auto"), 2: json!({"type": "json_object"})
}

impl CreateRunRequest {
Expand All @@ -25,6 +28,7 @@ impl CreateRunRequest {
instructions: None,
tools: None,
metadata: None,
response_format: None,
}
}
}
Expand All @@ -34,7 +38,8 @@ impl_builder_methods!(
model: String,
instructions: String,
tools: Vec<HashMap<String, String>>,
metadata: HashMap<String, String>
metadata: HashMap<String, String>,
response_format: Value
);

#[derive(Debug, Serialize, Clone)]
Expand Down

0 comments on commit aaf0647

Please sign in to comment.