pub struct DecodeInput {
pub request_id: Option<RequestId>,
pub input_ids: TensorRef,
pub kv_cache: Arc<dyn KvCacheHandle>,
pub recurrent_state: Option<Arc<dyn RecurrentStateHandle>>,
pub position_ids: Option<TensorRef>,
pub metadata: HashMap<String, Value>,
pub logits_policy: LogitsReturnPolicy,
}Expand description
Input for decode phase (generating one token at a time)
Fields§
§request_id: Option<RequestId>Stable product request identity for plan-runtime resources.
input_ids: TensorRefInput token ID for current step [batch_size, 1]
kv_cache: Arc<dyn KvCacheHandle>Existing KV cache from previous steps
recurrent_state: Option<Arc<dyn RecurrentStateHandle>>Existing recurrent state from previous steps, when used.
position_ids: Option<TensorRef>Position IDs for current step [batch_size, 1] (optional)
metadata: HashMap<String, Value>Request metadata that can affect model execution.
logits_policy: LogitsReturnPolicyHow the model may return final-position logits for this request.
Implementations§
Source§impl DecodeInput
impl DecodeInput
Sourcepub fn new(input_ids: TensorRef, kv_cache: Arc<dyn KvCacheHandle>) -> Self
pub fn new(input_ids: TensorRef, kv_cache: Arc<dyn KvCacheHandle>) -> Self
Create new decode input
Sourcepub fn with_request_id(self, request_id: RequestId) -> Self
pub fn with_request_id(self, request_id: RequestId) -> Self
Attach the product request identity to this decode step.
Sourcepub fn with_position_ids(self, positions: TensorRef) -> Self
pub fn with_position_ids(self, positions: TensorRef) -> Self
Add position IDs
Sourcepub fn with_recurrent_state(
self,
recurrent_state: Arc<dyn RecurrentStateHandle>,
) -> Self
pub fn with_recurrent_state( self, recurrent_state: Arc<dyn RecurrentStateHandle>, ) -> Self
Attach recurrent state for state-space or hybrid layers.
Sourcepub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self
Attach request metadata.
pub fn with_logits_policy(self, policy: LogitsReturnPolicy) -> Self
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Get batch size
Trait Implementations§
Source§impl Clone for DecodeInput
impl Clone for DecodeInput
Source§fn clone(&self) -> DecodeInput
fn clone(&self) -> DecodeInput
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for DecodeInput
impl !UnwindSafe for DecodeInput
impl Freeze for DecodeInput
impl Send for DecodeInput
impl Sync for DecodeInput
impl Unpin for DecodeInput
impl UnsafeUnpin for DecodeInput
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