pub struct CreateImageParametersBuilder { /* private fields */ }Expand description
Builder for CreateImageParameters.
Implementations§
Source§impl CreateImageParametersBuilder
impl CreateImageParametersBuilder
Sourcepub fn prompt<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn prompt<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
所需图像的文字描述。对于gpt-image-1最大长度为32000个字符,对于dall-e-2为1000个字符,对于dall-e-3为4000个字符。
Sourcepub fn background<VALUE: Into<BackgroundStyle>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn background<VALUE: Into<BackgroundStyle>>( &mut self, value: VALUE, ) -> &mut Self
允许为生成的图像设置背景透明度。此参数仅支持gpt-image-1。 必须是transparent、opaque或auto(默认值)之一。当使用auto时,模型将自动确定图像的最佳背景。 如果设置为transparent,输出格式需要支持透明度,因此应设置为png(默认值)或webp。
Sourcepub fn moderation<VALUE: Into<ModerationLevel>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn moderation<VALUE: Into<ModerationLevel>>( &mut self, value: VALUE, ) -> &mut Self
控制gpt-image-1生成图像的内容审核级别。必须是low(较少限制性过滤)或auto(默认值)。
Sourcepub fn n<VALUE: Into<u32>>(&mut self, value: VALUE) -> &mut Self
pub fn n<VALUE: Into<u32>>(&mut self, value: VALUE) -> &mut Self
要生成的图像数量。必须介于1到10之间。对于dall-e-3,仅支持n=1。
Sourcepub fn output_compression<VALUE: Into<u32>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn output_compression<VALUE: Into<u32>>( &mut self, value: VALUE, ) -> &mut Self
生成图像的压缩级别(0-100%)。此参数仅支持gpt-image-1与webp或jpeg输出格式,并默认为100。
Sourcepub fn output_format<VALUE: Into<OutputFormat>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn output_format<VALUE: Into<OutputFormat>>( &mut self, value: VALUE, ) -> &mut Self
返回生成图像的格式。此参数仅支持gpt-image-1。必须是png、jpeg或webp之一。
Sourcepub fn partial_images<VALUE: Into<u32>>(&mut self, value: VALUE) -> &mut Self
pub fn partial_images<VALUE: Into<u32>>(&mut self, value: VALUE) -> &mut Self
要生成的部分图像数量。此参数用于返回部分图像的流式响应。 值必须在0到3之间。设置为0时,响应将是单个图像在一个流事件中发送。
Sourcepub fn quality<VALUE: Into<ImageQuality>>(&mut self, value: VALUE) -> &mut Self
pub fn quality<VALUE: Into<ImageQuality>>(&mut self, value: VALUE) -> &mut Self
将生成的图像质量。hd创建具有更精细细节和更大一致性的图像。 gpt-image-1支持high、medium和low。dall-e-3支持hd和standard。dall-e-2只支持standard选项。
Sourcepub fn response_format<VALUE: Into<ResponseFormat>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn response_format<VALUE: Into<ResponseFormat>>( &mut self, value: VALUE, ) -> &mut Self
返回生成图像的格式。必须是url或b64_json之一。
Sourcepub fn size<VALUE: Into<ImageSize>>(&mut self, value: VALUE) -> &mut Self
pub fn size<VALUE: Into<ImageSize>>(&mut self, value: VALUE) -> &mut Self
生成图像的尺寸。对于gpt-image-1必须是1024x1024、1536x1024(横向)、1024x1536(纵向)或auto(默认值), 对于dall-e-2是256x256、512x512或1024x1024之一,对于dall-e-3是1024x1024、1792x1024或1024x1792之一。
Sourcepub fn style<VALUE: Into<ImageStyle>>(&mut self, value: VALUE) -> &mut Self
pub fn style<VALUE: Into<ImageStyle>>(&mut self, value: VALUE) -> &mut Self
生成图像的风格。此参数仅支持dall-e-3。必须是vivid或natural之一。 Vivid使模型倾向于生成超现实和戏剧性图像。 Natural使模型产生更自然、不太超现实的图像。
Sourcepub fn safety_identifier<VALUE: Into<String>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn safety_identifier<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
一个稳定标识符,用于帮助检测可能违反OpenAI使用政策的应用程序用户。
Sourcepub fn prompt_cache_key<VALUE: Into<String>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn prompt_cache_key<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
OpenAI用于缓存类似请求响应以优化缓存命中率。
Sourcepub fn user<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn user<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
表示您的最终用户的唯一标识符,可以帮助OpenAI监控和检测滥用行为。
Sourcepub fn build(
&self,
) -> Result<CreateImageParameters, CreateImageParametersBuilderError>
pub fn build( &self, ) -> Result<CreateImageParameters, CreateImageParametersBuilderError>
Trait Implementations§
Source§impl Clone for CreateImageParametersBuilder
impl Clone for CreateImageParametersBuilder
Source§fn clone(&self) -> CreateImageParametersBuilder
fn clone(&self) -> CreateImageParametersBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more