Skip to main content

ChainRequest

Struct ChainRequest 

Source
pub struct ChainRequest {
Show 17 fields pub model: String, pub stages: Vec<ChainStage>, pub motion_tail_frames: u32, pub width: u32, pub height: u32, pub fps: u32, pub seed: Option<u64>, pub steps: u32, pub guidance: f64, pub strength: f64, pub output_format: OutputFormat, pub placement: Option<DevicePlacement>, pub prompt: Option<String>, pub total_frames: Option<u32>, pub clip_frames: Option<u32>, pub source_image: Option<Vec<u8>>, pub enable_audio: Option<bool>,
}
Expand description

Chained generation request. Server accepts either the canonical form (stages non-empty) or the auto-expand form (prompt + total_frames + clip_frames); ChainRequest::normalise collapses the latter into the former so downstream code only deals with stages.

Fields§

§model: String§stages: Vec<ChainStage>

Canonical stages list. Empty triggers auto-expand from prompt/total_frames/clip_frames.

§motion_tail_frames: u32

Pixel frames of motion-tail overlap between consecutive stages. 0 = no overlap (simple concat). >0 = the final K pixel frames of stage N’s latents are threaded into stage N+1’s conditioning, and stage N+1’s leading K output frames are dropped at stitch time.

Defaults to 17 (matches the CLI --motion-tail and SPA defaults): 1 + 16 lands on the LTX-2 VAE’s 1 + 8k causal-grid for a clean re-encode of the carryover RGB frames. Values that do not satisfy 1 + 8k will fail the receiving stage’s tail re-encode at the VAE. Must be strictly less than each stage’s frames.

§width: u32§height: u32§fps: u32§seed: Option<u64>

Chain base seed. Per-stage seeds are derived as base_seed ^ ((stage_idx as u64) << 32) by the orchestrator so the whole chain is reproducible from a single seed value.

§steps: u32§guidance: f64§strength: f64

Denoising strength for stages[0].source_image. Ignored when the first stage has no source image. Continuation stages are always full-strength conditioned via motion-tail latents.

§output_format: OutputFormat§placement: Option<DevicePlacement>§prompt: Option<String>

Auto-expand: single prompt replicated across all stages.

§total_frames: Option<u32>

Auto-expand: total pixel frames the stitched output should cover.

§clip_frames: Option<u32>

Auto-expand: per-clip frame count. Defaults to 97 (LTX-2 19B/22B distilled cap). Must be 8k+1.

§source_image: Option<Vec<u8>>

Auto-expand: starting image for stages[0].

§enable_audio: Option<bool>

Generate per-stage audio and mux it into the final stitched output. Only meaningful for AV-capable families (LTX-2 / LTX-2.3); the server rejects Some(true) for non-AV models. None means “no preference” and resolves to off — chains opt in to audio explicitly so existing callers don’t suddenly start producing audio they didn’t ask for.

Implementations§

Source§

impl ChainRequest

Source

pub fn normalise(self) -> Result<Self>

Collapse the auto-expand form into a canonical Vec<ChainStage> and validate the result. Called once on the server side immediately after JSON parsing, before any engine work kicks off.

Post-conditions on a successful return:

  • self.stages is non-empty.
  • Each stage’s frames is 8k+1 and > 0.
  • self.stages.len() <= MAX_CHAIN_STAGES.
  • All auto-expand fields are None (caller must use self.stages).
Source

pub fn estimated_total_frames(&self) -> u32

Predicted stitched frame count before any top-level total_frames trim. Used by UIs for the footer summary and by the server to size the final buffer.

Per-boundary rule:

  • smooth: drop leading motion_tail_frames of the incoming clip
  • cut: no trim
  • fade: replace 2 * fade_len frames (trailing of prior + leading of next) with fade_len blended frames → net -fade_len

Trait Implementations§

Source§

impl Clone for ChainRequest

Source§

fn clone(&self) -> ChainRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for ChainRequest

Source§

impl Debug for ChainRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ChainRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&ChainRequest> for ChainScript

Source§

fn from(req: &ChainRequest) -> Self

Converts to this type from the input type.
Source§

impl Serialize for ChainRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToSchema for ChainRequest

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference utoipa::openapi::schema::Schemas for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

Source§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,