ParametersBuilder

Struct ParametersBuilder 

Source
pub struct ParametersBuilder { /* private fields */ }
Expand description

Builder for Parameters.

Implementations§

Source§

impl ParametersBuilder

Source

pub fn result_format<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

返回数据的格式。推荐优先设置为“message“

Source

pub fn translation_options(&mut self, value: TranslationOptions) -> &mut Self

当您使用翻译模型时需要配置的翻译参数。

Source

pub fn incremental_output<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

Source

pub fn tools<VALUE: Into<Vec<FunctionCall>>>( &mut self, value: VALUE, ) -> &mut Self

Source

pub fn parallel_tool_calls<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

是否开启并行工具调用。参数为true时开启,为false时不开启。并行工具调用详情请参见:并行工具调用

Source

pub fn thinking_budget<VALUE: Into<usize>>(&mut self, value: VALUE) -> &mut Self

Source

pub fn search_options<VALUE: Into<SearchOptions>>( &mut self, value: VALUE, ) -> &mut Self

联网搜索的策略。仅当enable_search为true时生效。

Source

pub fn enable_thinking<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

只支持 qwen3, 对 QwQ 与 DeepSeek-R1 模型无效。

Source

pub fn response_format<VALUE: Into<ResponseFormat>>( &mut self, value: VALUE, ) -> &mut Self

Source

pub fn repetition_penalty<VALUE: Into<f64>>( &mut self, value: VALUE, ) -> &mut Self

模型生成时连续序列中的重复度。提高repetition_penalty时可以降低模型生成的重复度,1.0表示不做惩罚。没有严格的取值范围,只要大于0即可。

Source

pub fn presence_penalty<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self

控制模型生成文本时的内容重复度。

取值范围:[-2.0, 2.0]。正数会减少重复度,负数会增加重复度。

适用场景:

  • 较高的presence_penalty适用于要求多样性、趣味性或创造性的场景,如创意写作或头脑风暴。
  • 较低的presence_penalty适用于要求一致性或专业术语的场景,如技术文档或其他正式文档。
Source

pub fn vl_high_resolution_images<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

是否提高输入图片的默认Token上限。输入图片的默认Token上限为1280,配置为true时输入图片的Token上限为16384。

Source

pub fn vl_enable_image_hw_output<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

是否返回图像缩放后的尺寸。模型会对输入的图像进行缩放处理,配置为 True 时会返回图像缩放后的高度和宽度,开启流式输出时,该信息在最后一个数据块(chunk)中返回。支持Qwen-VL模型。

Source

pub fn watermark<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

是否在图像右下角添加 “Qwen-Image” 水印。默认为 false。

Source

pub fn negative_prompt<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self

反向提示词,用来描述不希望在画面中看到的内容,可以对画面进行限制。 支持中英文,长度上限500个字符,每个汉字/字母占一个字符,超过部分会自动截断。

示例:低分辨率、错误、最差质量、低质量、残缺、多余的手指、比例不良等。

Source

pub fn seed<VALUE: Into<i32>>(&mut self, value: VALUE) -> &mut Self

随机数种子,取值范围[0,2147483647]。 使用相同的seed参数值可使生成内容保持相对稳定。若不提供,算法将自动使用随机数种子。

注意:模型生成过程具有概率性,即使使用相同的seed,也不能保证每次生成结果完全一致。

Source

pub fn build(&self) -> Result<Parameters, ParametersBuilderError>

Builds a new Parameters.

§Errors

If a required field has not been initialized.

Source§

impl ParametersBuilder

Source

pub fn functions<V>(&mut self, value: V) -> &mut Self
where V: Into<Vec<FunctionCall>>,

Trait Implementations§

Source§

impl Clone for ParametersBuilder

Source§

fn clone(&self) -> ParametersBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ParametersBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,