Allow image_generation.size to be null for OpenAI and default it to that

The API spec for image creation and image editing says "string or null",
so we're allowing `null` now to trigger automatic selection.
This commit is contained in:
Slavi Pantaleev
2025-05-11 23:18:19 +03:00
parent 62f0f4fa0d
commit 264f683d6a
6 changed files with 20 additions and 20 deletions

View File

@@ -224,9 +224,11 @@ impl TryInto<OpenAIImageGenerationConfig> for ImageGenerationConfig {
fn try_into(self) -> Result<OpenAIImageGenerationConfig, Self::Error> {
let size = if let Some(size) = &self.size {
convert_string_to_enum::<async_openai::types::ImageSize>(size)?
Some(convert_string_to_enum::<async_openai::types::ImageSize>(
size,
)?)
} else {
async_openai::types::ImageSize::S1024x1024
None
};
let style = if let Some(style) = &self.style {