AnthropicResponse

data class AnthropicResponse(val id: String, val type: String, val role: String, val content: List<AnthropicResponseContent>, val model: String, val stopReason: String? = null, val usage: AnthropicUsage? = null)(source)

Represents the response structure from an Anthropic API call.

This class encapsulates essential data returned from the API, including information about the response's unique identifier, type, role, content, the model used, and additional metadata such as stop reason and usage statistics.

Constructors

Link copied to clipboard
constructor(id: String, type: String, role: String, content: List<AnthropicResponseContent>, model: String, stopReason: String? = null, usage: AnthropicUsage? = null)

Properties

Link copied to clipboard

A list of content units within the response, which can represent text or tool usage instructions.

Link copied to clipboard
val id: String

A unique identifier for the response.

Link copied to clipboard

The name or identifier of the model utilized to generate this response.

Link copied to clipboard

Indicates the role of the entity generating the response, such as "assistant" or "system".

Link copied to clipboard
val stopReason: String? = null

Optional. The reason why the generation process was stopped, if applicable.

Link copied to clipboard

The type of the response.

Link copied to clipboard
val usage: AnthropicUsage? = null

Optional. Usage statistics for the response, including details such as token counts.