pub struct SessionRpcModel<'a> { /* private fields */ }Expand description
session.model.* RPCs.
Implementations§
Source§impl<'a> SessionRpcModel<'a>
impl<'a> SessionRpcModel<'a>
Sourcepub async fn get_current(&self) -> Result<CurrentModel, Error>
pub async fn get_current(&self) -> Result<CurrentModel, Error>
Gets the session’s authoritative model snapshot, including the committed Auto preference and any newer unclaimed Auto preference waiting for a future user turn.
Wire method: session.model.getCurrent.
§Returns
The session’s authoritative model snapshot. Auto preference fields are configuration for the virtual auto model and do not change the selected model identifier. The context tier reflects Session.getContextTier(), restored from the session journal on resume.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn switch_to(
&self,
params: ModelSwitchToRequest,
) -> Result<ModelSwitchToResult, Error>
pub async fn switch_to( &self, params: ModelSwitchToRequest, ) -> Result<ModelSwitchToResult, Error>
Switches the session to a model and optional reasoning configuration.
Wire method: session.model.switchTo.
§Parameters
params- Target model identifier and optional reasoning effort, summary, capability overrides, and context tier.
§Returns
The model identifier active on the session after the switch.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn switch_auto_tier(
&self,
params: ModelSwitchAutoTierRequest,
) -> Result<ModelSwitchAutoTierResult, Error>
pub async fn switch_auto_tier( &self, params: ModelSwitchAutoTierRequest, ) -> Result<ModelSwitchAutoTierResult, Error>
Requests an Auto preference change without changing the session’s selected model. The latest unclaimed request wins; the runtime commits it only after a later prompt using the auto model mints a usable model and token pair. A pending response confirms that the request was accepted, not that it committed. Observe eventual success through session.model_change, failure through the ephemeral session.auto_tier_switch_failed event, or current unclaimed state through session.model.getCurrent.
Wire method: session.model.switchAutoTier.
§Parameters
params- An Auto preference request for the session. This updates Auto configuration only; it does not change the selected model toauto.
§Returns
Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn set_reasoning_effort(
&self,
params: ModelSetReasoningEffortRequest,
) -> Result<ModelSetReasoningEffortResult, Error>
pub async fn set_reasoning_effort( &self, params: ModelSetReasoningEffortRequest, ) -> Result<ModelSetReasoningEffortResult, Error>
Updates the session’s reasoning effort without changing the selected model.
Wire method: session.model.setReasoningEffort.
§Parameters
params- Reasoning effort level to apply to the currently selected model.
§Returns
Update the session’s reasoning effort without changing the selected model. Use switchTo instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn list(&self) -> Result<SessionModelList, Error>
pub async fn list(&self) -> Result<SessionModelList, Error>
Lists models available to this session using its own auth and integration context. Connected hosts (CLI TUI, GitHub App) should call this through the session client so remote sessions return the remote CLI’s available models rather than the caller’s.
Wire method: session.model.list.
§Returns
The list of models available to this session.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn list_with_params(
&self,
params: ModelListRequest,
) -> Result<SessionModelList, Error>
pub async fn list_with_params( &self, params: ModelListRequest, ) -> Result<SessionModelList, Error>
Lists models available to this session using its own auth and integration context. Connected hosts (CLI TUI, GitHub App) should call this through the session client so remote sessions return the remote CLI’s available models rather than the caller’s.
Wire method: session.model.list.
§Parameters
params- Optional listing options.
§Returns
The list of models available to this session.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Trait Implementations§
Source§impl<'a> Clone for SessionRpcModel<'a>
impl<'a> Clone for SessionRpcModel<'a>
Source§fn clone(&self) -> SessionRpcModel<'a>
fn clone(&self) -> SessionRpcModel<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more