Class: Roast::Cogs::Agent::Providers::Claude::ToolResult
- Inherits:
-
Object
- Object
- Roast::Cogs::Agent::Providers::Claude::ToolResult
- Defined in:
- lib/roast/cogs/agent/providers/claude/tool_result.rb
Constant Summary collapse
- TRUNCATE_LIMIT =
45
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
: (String | Array[Hash[Symbol, untyped]])?.
-
#is_error ⇒ Object
readonly
: bool.
-
#tool_name ⇒ Object
readonly
: Symbol?.
-
#tool_use_description ⇒ Object
readonly
: String?.
-
#tool_use_input ⇒ Object
readonly
: Hash[Symbol, untyped].
Instance Method Summary collapse
-
#format ⇒ Object
: () -> String.
-
#initialize(tool_use:, content:, is_error:) ⇒ ToolResult
constructor
: (tool_use: Messages::ToolUseMessage?, content: (String | Array[Hash[Symbol, untyped]])?, is_error: bool) -> void.
Constructor Details
#initialize(tool_use:, content:, is_error:) ⇒ ToolResult
: (tool_use: Messages::ToolUseMessage?, content: (String | Array[Hash[Symbol, untyped]])?, is_error: bool) -> void
26 27 28 29 30 31 32 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 26 def initialize(tool_use:, content:, is_error:) @tool_name = tool_use&.name || :unknown @tool_use_input = tool_use&.input || {} #: Hash[Symbol, untyped] @tool_use_description = @tool_use_input[:description] #: String? @content = content @is_error = is_error end |
Instance Attribute Details
#content ⇒ Object (readonly)
: (String | Array[Hash[Symbol, untyped]])?
20 21 22 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 20 def content @content end |
#is_error ⇒ Object (readonly)
: bool
23 24 25 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 23 def is_error @is_error end |
#tool_name ⇒ Object (readonly)
: Symbol?
11 12 13 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 11 def tool_name @tool_name end |
#tool_use_description ⇒ Object (readonly)
: String?
17 18 19 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 17 def tool_use_description @tool_use_description end |
#tool_use_input ⇒ Object (readonly)
: Hash[Symbol, untyped]
14 15 16 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 14 def tool_use_input @tool_use_input end |
Instance Method Details
#format ⇒ Object
: () -> String
35 36 37 38 39 40 41 42 |
# File 'lib/roast/cogs/agent/providers/claude/tool_result.rb', line 35 def format return error_line if is_error format_method_name = "format_#{tool_name}".to_sym return send(format_method_name) if respond_to?(format_method_name, true) format_unknown end |