diff --git a/src/pipeline.rs b/src/pipeline.rs index 226b5e7..7f14e1b 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -472,7 +472,37 @@ impl Pipeline { model_id, route_source ); - match provider.chat_stream(req.clone()).await { + // Merge per-model/server config (same as run_inner). + let mut req_call = req.clone(); + if let Some(m_cfg) = live.cfg.models.iter().find(|m| m.id == model_id) { + if req_call.params.temperature.is_none() { + req_call.params.temperature = m_cfg.temperature; + } + if req_call.params.top_p.is_none() { + req_call.params.top_p = m_cfg.top_p; + } + if req_call.params.max_tokens.is_none() { + req_call.params.max_tokens = m_cfg.max_tokens; + } + if req_call.params.think_budget.is_none() { + req_call.params.think_budget = m_cfg.think_budget; + } + } else if let Some(s_cfg) = live.cfg.cmf.servers.iter().find(|s| s.id == model_id) { + if req_call.params.temperature.is_none() { + req_call.params.temperature = s_cfg.temperature; + } + if req_call.params.top_p.is_none() { + req_call.params.top_p = s_cfg.top_p; + } + if req_call.params.max_tokens.is_none() { + req_call.params.max_tokens = s_cfg.max_tokens; + } + if req_call.params.think_budget.is_none() { + req_call.params.think_budget = s_cfg.think_budget; + } + } + + match provider.chat_stream(req_call).await { Ok(stream) => { let info = RouteInfo { task_label: decision.task_label.clone(), diff --git a/src/providers/openai.rs b/src/providers/openai.rs index 33aeed1..a559bbb 100644 --- a/src/providers/openai.rs +++ b/src/providers/openai.rs @@ -51,6 +51,8 @@ impl OpenAiProvider { if let Some(tb) = req.params.think_budget { body["think_budget"] = tb.into(); body["reasoning_effort"] = tb.into(); + // cortiq serve uses enable_thinking (bool): 0 = off, >0 = on + body["enable_thinking"] = (tb > 0).into(); } if !req.tools.is_empty() { body["tools"] = serde_json::Value::Array(req.tools.clone());