summaryrefslogtreecommitdiffhomepage
path: root/lib/dispatch/adapter/message.rb
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-03-31 20:22:45 +0900
committerAdam Malczewski <[email protected]>2026-03-31 20:22:45 +0900
commit3e32dec579fbdedec8c7ddb881207b25bb342e60 (patch)
tree9db02b8f744fa2c1203b78e6c84a62f770bc1e73 /lib/dispatch/adapter/message.rb
parenta1eed75083df6afd4895a4438309319d2a9e5523 (diff)
downloaddispatch-adapter-copilot-3e32dec579fbdedec8c7ddb881207b25bb342e60.tar.gz
dispatch-adapter-copilot-3e32dec579fbdedec8c7ddb881207b25bb342e60.zip
imp
Diffstat (limited to 'lib/dispatch/adapter/message.rb')
-rw-r--r--lib/dispatch/adapter/message.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/dispatch/adapter/message.rb b/lib/dispatch/adapter/message.rb
new file mode 100644
index 0000000..eb51c99
--- /dev/null
+++ b/lib/dispatch/adapter/message.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+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:)
+ end
+ end
+
+ ImageBlock = Struct.new(:type, :source, :media_type, keyword_init: true) do
+ def initialize(source:, media_type:, type: "image")
+ super(type:, source:, media_type:)
+ end
+ end
+
+ ToolUseBlock = Struct.new(:type, :id, :name, :arguments, keyword_init: true) do
+ def initialize(id:, name:, arguments:, type: "tool_use")
+ super(type:, id:, name:, arguments:)
+ end
+ end
+
+ ToolResultBlock = Struct.new(:type, :tool_use_id, :content, :is_error, keyword_init: true) do
+ def initialize(tool_use_id:, content:, is_error: false, type: "tool_result")
+ super(type:, tool_use_id:, content:, is_error:)
+ end
+ end
+ end
+end