Skip to content

withResponseSpan

const withResponseSpan: <TOutput>(fn, options?, parent?) => Promise<TOutput>;

Create a new response span and automatically start and end it.

This span captures the details of a model response, primarily the response identifier. If you need to capture detailed generation information such as input/output messages, model configuration, or usage data, use generationSpan() instead.

Type Parameter

TOutput

Parameter Type

fn

(span) => Promise<TOutput>

options?

DeepPartial<CreateSpanOptions<ResponseSpanData>>

parent?

| Trace | Span<any>

Promise<TOutput>