Skip to main content

function_node_from_state

Function function_node_from_state 

Source
pub fn function_node_from_state<Params, Out, F, Fut>(
    name: &str,
    f: F,
    cfg: NodeConfig,
) -> Result<Arc<dyn Node>, WorkflowError>
where Params: DeserializeOwned + JsonSchema + Send + 'static, Out: Serialize + JsonSchema + Send + 'static, F: Fn(InvocationContext, Params) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Out, AgentError>> + Send + 'static,
Expand description

A node whose Params struct is filled from session state, one field per state key (name the key with #[serde(rename = "key")]); a field named node_input receives the node’s input instead. The output schema is inferred from Out.