Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions async-openai/src/assistants/assistants_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use crate::{
/// Build assistants that can call models and use tools to perform tasks.
///
/// [Get started with the Assistants API](https://platform.openai.com/docs/assistants)
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
pub struct Assistants<'c, C: Config> {
client: &'c Client<C>,
pub(crate) request_options: RequestOptions,
Expand Down
3 changes: 3 additions & 0 deletions async-openai/src/assistants/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use crate::{
};

/// Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads).
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
pub struct Messages<'c, C: Config> {
/// The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) to create a message for.
pub thread_id: String,
Expand Down
2 changes: 2 additions & 0 deletions async-openai/src/assistants/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

mod assistants_;
mod messages;
mod runs;
Expand Down
3 changes: 3 additions & 0 deletions async-openai/src/assistants/runs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ use crate::types::assistants::AssistantEventStream;
/// Represents an execution run on a thread.
///
/// Related guide: [Assistants](https://platform.openai.com/docs/assistants/overview)
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
pub struct Runs<'c, C: Config> {
pub thread_id: String,
client: &'c Client<C>,
Expand Down
3 changes: 3 additions & 0 deletions async-openai/src/assistants/steps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use crate::{
};

/// Represents a step in execution of a run.
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
pub struct Steps<'c, C: Config> {
pub thread_id: String,
pub run_id: String,
Expand Down
3 changes: 3 additions & 0 deletions async-openai/src/assistants/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ use crate::types::assistants::AssistantEventStream;
/// Create threads that assistants can interact with.
///
/// Related guide: [Assistants](https://platform.openai.com/docs/assistants/overview)
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
pub struct Threads<'c, C: Config> {
client: &'c Client<C>,
pub(crate) request_options: RequestOptions,
Expand Down
10 changes: 10 additions & 0 deletions async-openai/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::image::Images;
#[cfg(feature = "moderation")]
use crate::moderation::Moderations;
#[cfg(feature = "assistant")]
#[allow(deprecated)]
use crate::Assistants;
#[cfg(feature = "audio")]
use crate::Audio;
Expand All @@ -55,6 +56,7 @@ use crate::Realtime;
#[cfg(feature = "responses")]
use crate::Responses;
#[cfg(feature = "assistant")]
#[allow(deprecated)]
use crate::Threads;
#[cfg(feature = "upload")]
use crate::Uploads;
Expand Down Expand Up @@ -213,12 +215,20 @@ impl<C: Config> Client<C> {

/// To call [Assistants] group related APIs using this client.
#[cfg(feature = "assistant")]
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[allow(deprecated)]
pub fn assistants(&self) -> Assistants<'_, C> {
Assistants::new(self)
}

/// To call [Threads] group related APIs using this client.
#[cfg(feature = "assistant")]
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[allow(deprecated)]
pub fn threads(&self) -> Threads<'_, C> {
Threads::new(self)
}
Expand Down
5 changes: 2 additions & 3 deletions async-openai/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ impl<'c, C: Config> Files<'c, C> {
}
}

/// Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 1 TB.
/// Upload a file that can be used across various endpoints. Individual files can be up to 512 MB,
/// and each project can store up to 2.5 TB of files in total. There is no organization-wide storage limit.
///
/// The Assistants API supports files up to 2 million tokens and of specific file types. See the [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for details.
///
/// The Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) models.
///
/// The Batch API only supports `.jsonl` files up to 200 MB in size. The input also has a specific required [format](https://platform.openai.com/docs/api-reference/batch/request-input).
///
/// Please [contact us](https://help.openai.com/) if you need to increase these storage limits.
#[crate::byot(
T0 = Clone,
R = serde::de::DeserializeOwned,
Expand Down
2 changes: 2 additions & 0 deletions async-openai/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use crate::{
admin::UserRoles, admin::Users,
};
#[cfg(feature = "assistant")]
#[allow(deprecated)]
use crate::{
assistants::Assistants, assistants::Messages, assistants::Runs, assistants::Steps,
assistants::Threads,
Expand All @@ -58,6 +59,7 @@ use crate::{
#[cfg(feature = "_api")]
macro_rules! impl_request_options_builder {
($type:ident) => {
#[allow(deprecated)]
impl<'c, C: crate::config::Config> crate::traits::RequestOptionsBuilder for $type<'c, C> {
fn options_mut(&mut self) -> &mut crate::RequestOptions {
&mut self.request_options
Expand Down
4 changes: 4 additions & 0 deletions async-openai/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ pub use admin::{
UserRoles, Users,
};
#[cfg(feature = "assistant")]
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[allow(deprecated)]
pub use assistants::{Assistants, Messages, Runs, Steps, Threads};
#[cfg(feature = "audio")]
pub use audio::{Audio, Speech, Transcriptions, Translations};
Expand Down
15 changes: 15 additions & 0 deletions async-openai/src/types/assistants/assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ pub enum AssistantVectorStoreChunkingStrategy {
}

/// Represents an `assistant` that can call the model and use tools.
#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[derive(Clone, Serialize, Debug, Deserialize, PartialEq)]
pub struct AssistantObject {
/// The identifier, which can be referenced in API endpoints.
Expand Down Expand Up @@ -170,6 +173,9 @@ pub enum AssistantTools {
Function(AssistantToolsFunction),
}

#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[derive(Clone, Serialize, Default, Debug, Deserialize, Builder, PartialEq)]
#[builder(name = "CreateAssistantRequestArgs")]
#[builder(pattern = "mutable")]
Expand Down Expand Up @@ -218,6 +224,9 @@ pub struct CreateAssistantRequest {
pub response_format: Option<AssistantsApiResponseFormatOption>,
}

#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[derive(Clone, Serialize, Default, Debug, Deserialize, Builder, PartialEq)]
#[builder(name = "ModifyAssistantRequestArgs")]
#[builder(pattern = "mutable")]
Expand Down Expand Up @@ -266,13 +275,19 @@ pub struct ModifyAssistantRequest {
pub response_format: Option<AssistantsApiResponseFormatOption>,
}

#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[derive(Clone, Serialize, Default, Debug, Deserialize, PartialEq)]
pub struct DeleteAssistantResponse {
pub id: String,
pub deleted: bool,
pub object: String,
}

#[deprecated(
note = "Assistants API is deprecated and will be removed in August 2026. Use the Responses API."
)]
#[derive(Clone, Serialize, Default, Debug, Deserialize, PartialEq)]
pub struct ListAssistantsResponse {
pub object: String,
Expand Down
2 changes: 2 additions & 0 deletions async-openai/src/types/assistants/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

mod api;
mod assistant;
mod impls;
Expand Down
10 changes: 7 additions & 3 deletions async-openai/src/types/files/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ pub struct CreateFileRequest {
/// The File object (not file name) to be uploaded.
pub file: FileInput,

/// The intended purpose of the uploaded file.
///
/// Use "assistants" for [Assistants](https://platform.openai.com/docs/api-reference/assistants) and [Message](https://platform.openai.com/docs/api-reference/messages) files, "vision" for Assistants image file inputs, "batch" for [Batch API](https://platform.openai.com/docs/guides/batch), "fine-tune" for [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning), "user_data" for flexible file type for any purpose, and "evals" for eval data sets.
/// The intended purpose of the uploaded file. One of:
/// - `assistants`: Used in the Assistants API
/// - `batch`: Used in the Batch API
/// - `fine-tune`: Used for fine-tuning
/// - `vision`: Images used for vision fine-tuning
/// - `user_data`: Flexible file type for any purpose
/// - `evals`: Used for eval data sets
pub purpose: FilePurpose,

/// The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted.
Expand Down
19 changes: 8 additions & 11 deletions async-openai/src/types/images/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,20 @@ impl AsyncTryFrom<CreateImageVariationRequest> for reqwest::multipart::Form {
form = form.text("model", model.to_string())
}

if request.n.is_some() {
form = form.text("n", request.n.unwrap().to_string())
if let Some(n) = request.n {
form = form.text("n", n.to_string())
}

if request.size.is_some() {
form = form.text("size", request.size.unwrap().to_string())
if let Some(size) = request.size {
form = form.text("size", size.to_string())
}

if request.response_format.is_some() {
form = form.text(
"response_format",
request.response_format.unwrap().to_string(),
)
if let Some(response_format) = request.response_format {
form = form.text("response_format", response_format.to_string())
}

if request.user.is_some() {
form = form.text("user", request.user.unwrap())
if let Some(user) = request.user {
form = form.text("user", user)
}
Ok(form)
}
Expand Down
18 changes: 12 additions & 6 deletions async-openai/src/types/videos/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,25 @@ impl AsyncTryFrom<CreateVideoRequest> for reqwest::multipart::Form {

form = form.text("prompt", request.prompt);

if request.size.is_some() {
form = form.text("size", request.size.unwrap().to_string());
if let Some(size) = request.size {
form = form.text("size", size.to_string());
}

if request.seconds.is_some() {
form = form.text("seconds", request.seconds.unwrap().to_string());
if let Some(seconds) = request.seconds {
form = form.text("seconds", seconds.to_string());
}

if request.input_reference.is_some() {
let image_part = create_file_part(request.input_reference.unwrap().source).await?;
if let Some(input_reference) = request.input_reference {
let image_part = create_file_part(input_reference.source).await?;
form = form.part("input_reference", image_part);
}

if let Some(character_ids) = request.character_ids {
for character_id in character_ids {
form = form.text("character_ids[]", character_id);
}
}

Ok(form)
}
}
2 changes: 2 additions & 0 deletions async-openai/src/types/videos/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub struct CreateVideoRequest {
pub seconds: Option<VideoSeconds>,
/// Optional image reference that guides generation.
pub input_reference: Option<ImageInput>,
/// Character IDs to include in the generation.
pub character_ids: Option<Vec<String>>,
}

#[derive(Clone, Default, Debug, Builder, PartialEq, Serialize)]
Expand Down
Loading
Loading