Class: Anthropic::Models::Beta::BetaRawMessageDeltaEvent

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/anthropic/models/beta/beta_raw_message_delta_event.rb,
sig/anthropic/models/beta/beta_raw_message_delta_event.rbs

Defined Under Namespace

Classes: Delta

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(context_management:, delta:, usage:, input_transformations: nil, type: :message_delta) ⇒ Object

Some parameter documentations has been truncated, see Anthropic::Models::Beta::BetaRawMessageDeltaEvent for more details.

Parameters:



# File 'lib/anthropic/models/beta/beta_raw_message_delta_event.rb', line 67


Instance Attribute Details

#context_managementAnthropic::Models::Beta::BetaContextManagementResponse?

Information about context management strategies applied during the request

Parameters:

  • value (Anthropic::Beta::BetaContextManagementResponse, nil)

Returns:



11
# File 'lib/anthropic/models/beta/beta_raw_message_delta_event.rb', line 11

required :context_management, -> { Anthropic::Beta::BetaContextManagementResponse }, nil?: true

#deltaAnthropic::Models::Beta::BetaRawMessageDeltaEvent::Delta

Parameters:

  • value (Anthropic::Beta::BetaRawMessageDeltaEvent::Delta)

Returns:



16
# File 'lib/anthropic/models/beta/beta_raw_message_delta_event.rb', line 16

required :delta, -> { Anthropic::Beta::BetaRawMessageDeltaEvent::Delta }

#input_transformationsArray<Anthropic::Models::Beta::BetaThinkingDroppedInputTransformation>?

Changes the API made to the request's input before showing it to the model: one entry per change, in request order. Today the only entry type is thinking_dropped — a thinking, redacted_thinking or connector_text block from the request's messages that was removed from the prompt instead of being shown to the model because it failed a binding check. More entry types may be added over time; ignore types you do not recognize.

Requires anthropic-beta: thinking-binding-controls-2026-08-01. Present on every such response from a model that supports extended thinking, as [] when nothing was changed; without the beta, blocks are removed all the same but nothing is reported. Removed blocks contribute nothing to usage.input_tokens. When streaming, the array is final in message_start; the final message_delta event carries it only when a server-side model fallback happened mid-stream, in which case it holds the serving model's entries and replaces the one in message_start.

Parameters:

  • value (::Array[Anthropic::Beta::BetaThinkingDroppedInputTransformation], nil)

Returns:



61
62
63
64
65
# File 'lib/anthropic/models/beta/beta_raw_message_delta_event.rb', line 61

optional :input_transformations,
-> {
  Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaThinkingDroppedInputTransformation]
},
nil?: true

#typeSymbol, :message_delta

Parameters:

  • value (:message_delta)

Returns:

  • (Symbol, :message_delta)


21
# File 'lib/anthropic/models/beta/beta_raw_message_delta_event.rb', line 21

required :type, const: :message_delta

#usageAnthropic::Models::Beta::BetaMessageDeltaUsage

Billing and rate-limit usage.

Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in usage will not match one-to-one with the exact visible content of an API request or response.

For example, output_tokens will be non-zero, even for an empty string response from Claude.

Total input tokens in a request is the summation of input_tokens, cache_creation_input_tokens, and cache_read_input_tokens.

Parameters:

  • value (Anthropic::Beta::BetaMessageDeltaUsage)

Returns:



41
# File 'lib/anthropic/models/beta/beta_raw_message_delta_event.rb', line 41

required :usage, -> { Anthropic::Beta::BetaMessageDeltaUsage }

Instance Method Details

#to_hash{

Returns:

  • ({)


34
# File 'sig/anthropic/models/beta/beta_raw_message_delta_event.rbs', line 34

def to_hash: -> {