Class: ClaudeAgentSDK::AssistantMessage
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Assistant message with content blocks
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#error ⇒ Object
Returns the value of attribute error.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#model ⇒ Object
Returns the value of attribute model.
-
#parent_tool_use_id ⇒ Object
Returns the value of attribute parent_tool_use_id.
-
#session_id ⇒ Object
Returns the value of attribute session_id.
-
#stop_reason ⇒ Object
Returns the value of attribute stop_reason.
-
#usage ⇒ Object
Returns the value of attribute usage.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#text ⇒ Object
(also: #to_s)
Concatenated text across every TextBlock in this message’s content.
Methods inherited from Type
#[], #[]=, from_hash, #initialize, #to_h, wrap
Constructor Details
This class inherits a constructor from ClaudeAgentSDK::Type
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ClaudeAgentSDK::Type
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def content @content end |
#error ⇒ Object
Returns the value of attribute error.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def error @error end |
#message_id ⇒ Object
Returns the value of attribute message_id.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def @message_id end |
#model ⇒ Object
Returns the value of attribute model.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def model @model end |
#parent_tool_use_id ⇒ Object
Returns the value of attribute parent_tool_use_id.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def parent_tool_use_id @parent_tool_use_id end |
#session_id ⇒ Object
Returns the value of attribute session_id.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def session_id @session_id end |
#stop_reason ⇒ Object
Returns the value of attribute stop_reason.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def stop_reason @stop_reason end |
#usage ⇒ Object
Returns the value of attribute usage.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def usage @usage end |
#uuid ⇒ Object
Returns the value of attribute uuid.
231 232 233 |
# File 'lib/claude_agent_sdk/types.rb', line 231 def uuid @uuid end |
Instance Method Details
#text ⇒ Object Also known as: to_s
Concatenated text across every TextBlock in this message’s content. Returns “” when the message has no text (e.g., a pure tool_use turn).
236 237 238 |
# File 'lib/claude_agent_sdk/types.rb', line 236 def text Array(content).grep(TextBlock).map(&:text).join("\n\n") end |