pub struct RequestOptions {
pub temperature: Option<f64>,
pub top_p: Option<f64>,
pub seed: Option<u64>,
pub tool_choice: Option<ToolChoice>,
pub stop_sequences: Option<Vec<String>>,
pub prefill: Option<String>,
pub reasoning: Option<ReasoningConfig>,
pub max_reasoning_tokens: Option<u32>,
pub extra: Option<Map<String, Value>>,
}Expand description
Agent 每轮 LLM 调用的生成参数覆盖。
用户只需设置需要覆盖的字段。
未设置的字段保持默认值(None),apply() 时会被跳过。
§Agent 保留字段
以下字段由 Agent 层自动注入,apply() 不会覆盖:
model— 来自ResolvedModelmessages— 来自对话历史tools— 来自ToolExecutor
§示例
ⓘ
let opts = RequestOptions::new()
.temperature(0.1)
.reasoning(ReasoningConfig::High);
let agent = AgentBuilder::new(model)
.request_options(opts)
.build();Fields§
§temperature: Option<f64>§top_p: Option<f64>§seed: Option<u64>§tool_choice: Option<ToolChoice>§stop_sequences: Option<Vec<String>>§prefill: Option<String>§reasoning: Option<ReasoningConfig>§max_reasoning_tokens: Option<u32>§extra: Option<Map<String, Value>>Implementations§
Source§impl RequestOptions
impl RequestOptions
Sourcepub fn apply(&self, req: &mut ChatRequest)
pub fn apply(&self, req: &mut ChatRequest)
将非默认值覆盖到基础 ChatRequest 上。
跳过字段: model、messages、tools(由 Agent 层注入)
跳过规则: None、空 String、空 Vec、false 等默认值不覆盖
Source§impl RequestOptions
impl RequestOptions
pub fn temperature(self, t: f64) -> Self
pub fn top_p(self, p: f64) -> Self
pub fn seed(self, s: u64) -> Self
pub fn tool_choice(self, choice: ToolChoice) -> Self
pub fn stop_sequences(self, seqs: Vec<String>) -> Self
pub fn prefill(self, text: String) -> Self
pub fn reasoning(self, r: ReasoningConfig) -> Self
pub fn max_reasoning_tokens(self, max: u32) -> Self
pub fn extra(self, extra: Map<String, Value>) -> Self
Trait Implementations§
Source§impl Clone for RequestOptions
impl Clone for RequestOptions
Source§fn clone(&self) -> RequestOptions
fn clone(&self) -> RequestOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RequestOptions
impl Debug for RequestOptions
Source§impl Default for RequestOptions
impl Default for RequestOptions
Source§fn default() -> RequestOptions
fn default() -> RequestOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RequestOptions
impl RefUnwindSafe for RequestOptions
impl Send for RequestOptions
impl Sync for RequestOptions
impl Unpin for RequestOptions
impl UnsafeUnpin for RequestOptions
impl UnwindSafe for RequestOptions
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