Skip to content

withResponseSpan

const withResponseSpan: <TOutput>(fn, ...args) => 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>

args

[DeepPartial<CreateSpanOptions<ResponseSpanData>>, | Trace | Span<any>]

Promise<TOutput>