Allow per-sample model overrides in thread/sample (#62419)

## Why

Clients sampling a thread could only use the source thread's model.

## What changed

Add an optional `model` field to the experimental `thread/sample`
request. Omitting it or passing `null` inherits the source thread's
model. When an override is supplied, the server uses the selected
model's capabilities to decide whether to apply the requested
reasoning effort.

## Testing

Add an app-server integration test that checks model selection and
reasoning effort for the overridden sample, then verifies that a
subsequent sample and a follow-up turn use the source model.

GitOrigin-RevId: f5c54ca3d693d31e1f3e0628a520583330a5d56d
This commit is contained in:
Keyan Zhang
2026-11-19 03:37:31 +00:00
committed by copyberry
parent cf881a627d
commit 0bc1e7db9a
4 changed files with 101 additions and 2 deletions
@@ -20,6 +20,10 @@ pub struct ThreadSampleParams {
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub allow_in_progress_turn: bool,
pub prompt: String,
/// Override the model for this sample.
/// Omit or pass `null` to inherit the source thread's model.
#[ts(optional = nullable)]
pub model: Option<String>,
/// Applied only when the provider and model support cache-preserving reasoning-effort updates.
#[ts(optional = nullable)]
pub effort: Option<ReasoningEffort>,