Skip to main content

trace_node

Function trace_node 

Source
pub async fn trace_node<F, Fut, I, O>(
    name: &str,
    run_type: RunType,
    inputs: I,
    f: F,
) -> Result<O>
where F: FnOnce(I) -> Fut, Fut: Future<Output = Result<O>>, I: Serialize, O: Serialize,
Expand description

Helper function to trace a node execution

This function wraps a node execution with tracing:

  1. Creates a tracer with serialized inputs
  2. Posts the run to LangSmith (start_time, inputs)
  3. Executes the function
  4. Updates the run with outputs and end_time
  5. Handles errors appropriately