Upgrade async-openai (0.31.1 -> 0.32.1) and adapt, adding support for gpt-image-1.5

This commit is contained in:
Slavi Pantaleev
2025-12-21 12:23:25 +02:00
parent ae8e878817
commit 08c689a889
4 changed files with 9 additions and 5 deletions

9
Cargo.lock generated
View File

@@ -179,9 +179,9 @@ dependencies = [
[[package]]
name = "async-openai"
version = "0.31.1"
version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cc4c602409022b854d89332fae01a6c69a4122fdd0ec66a071b9b5c3a87750b"
checksum = "e0827dbb7b06f98bf01e4aa4a4913adb17b4d1d6d4e82c0e905a84e5dcc95270"
dependencies = [
"async-openai-macros",
"backoff",
@@ -190,6 +190,7 @@ dependencies = [
"derive_builder 0.20.2",
"eventsource-stream",
"futures",
"getrandom 0.3.4",
"rand 0.9.2",
"reqwest 0.12.25",
"reqwest-eventsource 0.6.0",
@@ -207,9 +208,9 @@ dependencies = [
[[package]]
name = "async-openai-macros"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0289cba6d5143bfe8251d57b4a8cac036adf158525a76533a7082ba65ec76398"
checksum = "81872a8e595e8ceceab71c6ba1f9078e313b452a1e31934e6763ef5d308705e4"
dependencies = [
"proc-macro2",
"quote",

View File

@@ -17,7 +17,7 @@ path = "src/lib.rs"
[dependencies]
anthropic = { git = "https://github.com/etkecc/anthropic-rs.git", branch = "fix-content-block-image" }
anyhow = "1.0.*"
async-openai = { version = "0.31.1", features = ["audio", "chat-completion", "image"] }
async-openai = { version = "0.32.1", features = ["audio", "chat-completion", "image"] }
base64 = "0.22.*"
chrono = { version = "0.4.*", default-features = false, features = ["std", "now"] }
# We'd rather not depend on this, but we cannot use the ruma-events EventContent macro without it.

View File

@@ -178,6 +178,7 @@ impl ImageGenerationConfig {
"dall-e-2" => Ok(async_openai::types::images::ImageModel::DallE2),
"dall-e-3" => Ok(async_openai::types::images::ImageModel::DallE3),
"gpt-image-1" => Ok(async_openai::types::images::ImageModel::GptImage1),
"gpt-image-1.5" => Ok(async_openai::types::images::ImageModel::GptImage1dot5),
"gpt-image-1-mini" => Ok(async_openai::types::images::ImageModel::GptImage1Mini),
other => Ok(async_openai::types::images::ImageModel::Other(other.to_owned())),
}

View File

@@ -305,6 +305,7 @@ impl ControllerTrait for Controller {
// In fact, specifying the response format results in an error.
ImageModel::GptImage1 => None,
ImageModel::GptImage1Mini => None,
ImageModel::GptImage1dot5 => None,
ImageModel::Other(_) => Some(ImageResponseFormat::B64Json),
};
@@ -411,6 +412,7 @@ impl ControllerTrait for Controller {
// In fact, specifying the response format results in an error.
ImageModel::GptImage1 => None,
ImageModel::GptImage1Mini => None,
ImageModel::GptImage1dot5 => None,
ImageModel::Other(_) => Some(ImageResponseFormat::B64Json),
};