Skip to navigation

Enum LlmFinalizer

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -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.

pub enum LlmFinalizer {
    Sync(Box<dyn FnOnce() -> Value + Send>),
    Fallible(Box<dyn FnOnce() -> Result<Value, FlowError> + Send>),
    Async(Box<dyn FnOnce() -> Pin<Box<dyn Future<Output = Result<Value, FlowError>> + Send>> + Send>),
}

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

Sync(Box<dyn FnOnce() -> Value + Send>)

Sync(Box<dyn FnOnce() -> Value + Send>)

Returns the aggregate directly.

Fallible(Box<dyn FnOnce() -> Result<Value, FlowError> + Send>)

Fallible(Box<dyn FnOnce() -> Result<Value, FlowError> + Send>)

Returns the aggregate or a failure.

Async(Box<dyn FnOnce() -> Pin<Box<dyn Future<Output = Result<Value, FlowError>> + Send>> + Send>)

Async(Box<dyn FnOnce() -> Pin<Box<dyn Future<Output = Result<Value, FlowError>> + Send>> + Send>)

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) -> LlmFinalizerwhere
    F: FnOnce() -> Fut + Send + 'static,
    Fut: Future<Output = Result<Value, FlowError>> + Send + 'static,

Wrap a future-returning closure as an asynchronous finalizer.

Trait Implementations

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

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

from

fn from(finalizer: F) -> LlmFinalizer