Class: Langchain::ToolResponse
- Inherits:
-
Object
- Object
- Langchain::ToolResponse
- Defined in:
- lib/langchain/tool_response.rb
Overview
ToolResponse represents the standardized output of a tool. It can contain either text content or an image URL.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
Instance Method Summary collapse
-
#initialize(content: nil, image_url: nil) ⇒ ToolResponse
constructor
Initializes a new ToolResponse.
- #to_s ⇒ Object
Constructor Details
permalink #initialize(content: nil, image_url: nil) ⇒ ToolResponse
Initializes a new ToolResponse.
13 14 15 16 17 18 |
# File 'lib/langchain/tool_response.rb', line 13 def initialize(content: nil, image_url: nil) raise ArgumentError, "Either content or image_url must be provided" if content.nil? && image_url.nil? @content = content @image_url = image_url end |
Instance Attribute Details
permalink #content ⇒ Object (readonly)
Returns the value of attribute content.
7 8 9 |
# File 'lib/langchain/tool_response.rb', line 7 def content @content end |
permalink #image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
7 8 9 |
# File 'lib/langchain/tool_response.rb', line 7 def image_url @image_url end |
Instance Method Details
permalink #to_s ⇒ Object
[View source]
20 21 22 |
# File 'lib/langchain/tool_response.rb', line 20 def to_s content.to_s end |