pub struct ParametersBuilder { /* private fields */ }
Expand description
Builder for Parameters
.
Implementations§
Source§impl ParametersBuilder
impl ParametersBuilder
Sourcepub fn result_format<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn result_format<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
返回数据的格式。推荐优先设置为“message“
Sourcepub fn translation_options(&mut self, value: TranslationOptions) -> &mut Self
pub fn translation_options(&mut self, value: TranslationOptions) -> &mut Self
当您使用翻译模型时需要配置的翻译参数。
pub fn incremental_output<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
pub fn tools<VALUE: Into<Vec<FunctionCall>>>( &mut self, value: VALUE, ) -> &mut Self
Sourcepub fn parallel_tool_calls<VALUE: Into<bool>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn parallel_tool_calls<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
是否开启并行工具调用。参数为true时开启,为false时不开启。并行工具调用详情请参见:并行工具调用。
pub fn thinking_budget<VALUE: Into<usize>>(&mut self, value: VALUE) -> &mut Self
pub fn enable_search<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
Sourcepub fn search_options<VALUE: Into<SearchOptions>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn search_options<VALUE: Into<SearchOptions>>( &mut self, value: VALUE, ) -> &mut Self
联网搜索的策略。仅当enable_search为true时生效。
Sourcepub fn enable_thinking<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn enable_thinking<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
只支持 qwen3, 对 QwQ 与 DeepSeek-R1 模型无效。
pub fn response_format<VALUE: Into<ResponseFormat>>( &mut self, value: VALUE, ) -> &mut Self
Sourcepub fn repetition_penalty<VALUE: Into<f64>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn repetition_penalty<VALUE: Into<f64>>( &mut self, value: VALUE, ) -> &mut Self
模型生成时连续序列中的重复度。提高repetition_penalty时可以降低模型生成的重复度,1.0表示不做惩罚。没有严格的取值范围,只要大于0即可。
Sourcepub fn presence_penalty<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn presence_penalty<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
控制模型生成文本时的内容重复度。
取值范围:[-2.0, 2.0]。正数会减少重复度,负数会增加重复度。
适用场景:
- 较高的presence_penalty适用于要求多样性、趣味性或创造性的场景,如创意写作或头脑风暴。
- 较低的presence_penalty适用于要求一致性或专业术语的场景,如技术文档或其他正式文档。
Sourcepub fn vl_high_resolution_images<VALUE: Into<bool>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn vl_high_resolution_images<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
是否提高输入图片的默认Token上限。输入图片的默认Token上限为1280,配置为true时输入图片的Token上限为16384。
Sourcepub fn vl_enable_image_hw_output<VALUE: Into<bool>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn vl_enable_image_hw_output<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self
是否返回图像缩放后的尺寸。模型会对输入的图像进行缩放处理,配置为 True 时会返回图像缩放后的高度和宽度,开启流式输出时,该信息在最后一个数据块(chunk)中返回。支持Qwen-VL模型。
Sourcepub fn watermark<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn watermark<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
是否在图像右下角添加 “Qwen-Image” 水印。默认为 false。
Sourcepub fn negative_prompt<VALUE: Into<String>>(
&mut self,
value: VALUE,
) -> &mut Self
pub fn negative_prompt<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self
反向提示词,用来描述不希望在画面中看到的内容,可以对画面进行限制。 支持中英文,长度上限500个字符,每个汉字/字母占一个字符,超过部分会自动截断。
示例:低分辨率、错误、最差质量、低质量、残缺、多余的手指、比例不良等。
Sourcepub fn seed<VALUE: Into<i32>>(&mut self, value: VALUE) -> &mut Self
pub fn seed<VALUE: Into<i32>>(&mut self, value: VALUE) -> &mut Self
随机数种子,取值范围[0,2147483647]。 使用相同的seed参数值可使生成内容保持相对稳定。若不提供,算法将自动使用随机数种子。
注意:模型生成过程具有概率性,即使使用相同的seed,也不能保证每次生成结果完全一致。
Sourcepub fn build(&self) -> Result<Parameters, ParametersBuilderError>
pub fn build(&self) -> Result<Parameters, ParametersBuilderError>
Source§impl ParametersBuilder
impl ParametersBuilder
Trait Implementations§
Source§impl Clone for ParametersBuilder
impl Clone for ParametersBuilder
Source§fn clone(&self) -> ParametersBuilder
fn clone(&self) -> ParametersBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ParametersBuilder
impl RefUnwindSafe for ParametersBuilder
impl Send for ParametersBuilder
impl Sync for ParametersBuilder
impl Unpin for ParametersBuilder
impl UnwindSafe for ParametersBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more