Avoid passing response_format to OpenAI's image generation API for the gpt-image-1 model
The API reference for `response_format` says: > This parameter isn't supported for gpt-image-1 which will always return base64-encoded images. Related to https://github.com/etkecc/baibot/issues/40
This commit is contained in:
@@ -36,6 +36,8 @@ use crate::{
|
||||
|
||||
use super::config::Config;
|
||||
|
||||
use super::OPENAI_IMAGE_MODEL_GPT_IMAGE_1;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Controller {
|
||||
config: Config,
|
||||
@@ -291,6 +293,7 @@ impl ControllerTrait for Controller {
|
||||
async_openai::types::ImageModel::DallE2 => Some(async_openai::types::ImageResponseFormat::B64Json),
|
||||
async_openai::types::ImageModel::DallE3 => Some(async_openai::types::ImageResponseFormat::B64Json),
|
||||
async_openai::types::ImageModel::Other(model_str) => match model_str.as_str() {
|
||||
OPENAI_IMAGE_MODEL_GPT_IMAGE_1 => None,
|
||||
_ => Some(async_openai::types::ImageResponseFormat::B64Json),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -16,6 +16,8 @@ use super::super::AgentInstantiationResult;
|
||||
use super::ConfigTrait;
|
||||
use super::controller::ControllerType;
|
||||
|
||||
pub const OPENAI_IMAGE_MODEL_GPT_IMAGE_1: &str = "gpt-image-1";
|
||||
|
||||
pub fn create_controller_from_yaml_value_config(
|
||||
agent_id: &str,
|
||||
config: serde_yaml::Value,
|
||||
|
||||
Reference in New Issue
Block a user