Class: Anthropic::BetaFallbackState

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/helpers/refusal_fallback.rb,
sig/anthropic/helpers/refusal_fallback.rbs

Overview

Tracks which fallback a sequence of requests is pinned to.

Create one (Anthropic::BetaFallbackState.new) and pass it via the fallback_state request option on every request that should share the pin — the turns of one conversation, or any wider scope the stickiness should apply to; BetaRefusalFallbackMiddleware mutates it in place when a model refuses.

Instance Attribute Summary collapse

Instance Attribute Details

#indexInteger?

Index into the fallback chain the requests are pinned to.

nil (or -1) targets the original request params; the middleware sets it to the index of the fallback that accepted the request.

Returns:

  • (Integer, nil)


18
19
20
# File 'lib/anthropic/helpers/refusal_fallback.rb', line 18

def index
  @index
end