Skip to content

createResponseSpan

function createResponseSpan(options?, parent?): Span<ResponseSpanData>

Create a new response span. The span will not be started automatically, you should either use withResponseSpan() or call span.start() and span.end() manually.

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 createGenerationSpan() instead.

Parameter Type Description

options?

DeepPartial<CreateSpanOptions<ResponseSpanData>>

Optional span creation options, including span data and identifiers.

parent?

| Span<any> | Trace

The parent span or trace. If not provided, the current trace/span will be used automatically.

Span<ResponseSpanData>

The newly created response span.