Skip to navigation

Enum LlmFinalizer

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.

#[non_exhaustive]pub enum LlmFinalizer {
    Sync(LlmFinalizerFn),
    Fallible(LlmFallibleFinalizerFn),
    Async(LlmAsyncFinalizerFn),
}

Finalizer used to synthesize the aggregate streaming response payload.

A failed finalizer yields a null aggregate with no data fallback and marks the END event ERROR. Any FnOnce() -> Json converts into the infallible form.

Variants (Non-exhaustive)

Sync(LlmFinalizerFn)

Sync(LlmFinalizerFn)

Returns the aggregate directly.

Fallible(LlmFallibleFinalizerFn)

Fallible(LlmFallibleFinalizerFn)

Returns the aggregate or a failure.

Async(LlmAsyncFinalizerFn)

Async(LlmAsyncFinalizerFn)

Awaited before the END publication, so a flush inside it does not wait on this stream or other unfinished terminal publications.

Implementations

impl LlmFinalizer

impl LlmFinalizer

new_async

pub fn new_async<F, Fut>(finalizer: F) -> Selfwhere
    F: FnOnce() -> Fut + Send + 'static,
    Fut: Future<Output = Result<Json>> + Send + 'static,

Wrap a future-returning closure as an asynchronous finalizer.

Trait Implementations

impl<F> From<F> for LlmFinalizerwhere F: FnOnce() -> Json + Send + 'static,

impl<F> From<F> for LlmFinalizerwhere
    F: FnOnce() -> Json + Send + 'static,

from

fn from(finalizer: F) -> Self