AnthropicStreamResponse

data class AnthropicStreamResponse(val type: String, val index: Int? = null, val contentBlock: AnthropicContent? = null, val delta: AnthropicStreamDelta? = null, val message: AnthropicResponse? = null, val usage: AnthropicUsage? = null, val error: AnthropicStreamError? = null)(source)

Represents a response from the Anthropic stream API.

This data class encapsulates the structure of a streamed response, including its type, any delta updates to the content, and the complete message data when applicable.

Constructors

Link copied to clipboard
constructor(type: String, index: Int? = null, contentBlock: AnthropicContent? = null, delta: AnthropicStreamDelta? = null, message: AnthropicResponse? = null, usage: AnthropicUsage? = null, error: AnthropicStreamError? = null)

Properties

Link copied to clipboard

The content block data for "content_block_start" events, containing tool use information.

Link copied to clipboard

An optional incremental update to the message content, represented as AnthropicStreamDelta.

Link copied to clipboard

Optional error information if an error occurred during streaming.

Link copied to clipboard
val index: Int? = null

The index of the content block in streaming responses. Present in content block events.

Link copied to clipboard

An optional complete response message, represented as AnthropicResponse.

Link copied to clipboard

The type of the response (e.g., "content_block_start", "content_block_delta", "message_delta").

Link copied to clipboard
val usage: AnthropicUsage? = null

Optional usage statistics for the response, including token counts.