Method: Langchain::ToolResponse#initialize

Defined in:
lib/langchain/tool_response.rb

#initialize(content: nil, image_url: nil) ⇒ ToolResponse

Initializes a new ToolResponse.

Parameters:

  • content (String) (defaults to: nil)

    The text content of the response.

  • image_url (String, nil) (defaults to: nil)

    Optional URL to an image.

Raises:

  • (ArgumentError)


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