diff options
Diffstat (limited to 'lib/dispatch/adapter/interface/message.rb')
| -rw-r--r-- | lib/dispatch/adapter/interface/message.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/dispatch/adapter/interface/message.rb b/lib/dispatch/adapter/interface/message.rb index eb51c99..dfe7301 100644 --- a/lib/dispatch/adapter/interface/message.rb +++ b/lib/dispatch/adapter/interface/message.rb @@ -4,9 +4,14 @@ module Dispatch module Adapter Message = Struct.new(:role, :content, keyword_init: true) - TextBlock = Struct.new(:type, :text, keyword_init: true) do - def initialize(text:, type: "text") - super(type:, text:) + # +cache_control+ values: + # nil — no cache breakpoint (default) + # { type: :ephemeral } — provider default TTL + # { type: :ephemeral, ttl: :"5m" } — short-lived cache + # { type: :ephemeral, ttl: :"1h" } — long-lived cache + TextBlock = Struct.new(:type, :text, :cache_control, keyword_init: true) do + def initialize(text:, cache_control: nil, type: "text") + super(type:, text:, cache_control:) end end @@ -27,5 +32,17 @@ module Dispatch super(type:, tool_use_id:, content:, is_error:) end end + + ThinkingBlock = Struct.new(:type, :thinking, :signature, keyword_init: true) do + def initialize(thinking:, signature: nil, type: "thinking") + super(type:, thinking:, signature:) + end + end + + RedactedThinkingBlock = Struct.new(:type, :data, keyword_init: true) do + def initialize(data:, type: "redacted_thinking") + super(type:, data:) + end + end end end |
