Class: Assistant::WebFetchToolBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/services/assistant/web_fetch_tool_builder.rb

Overview

Builds the fetch_url RubyLLM::Tool for retrieving web page content.

The fetch itself is delegated to Heatwave::Crawler (mode: :auto):
direct HTTP → dedicated Amazon scrape → Oxylabs render → Oxylabs
residential, with main-content (readability) extraction to Markdown
before the 60K content cap. PDF URLs are handled here because they are
LLM-specific: the bytes are handed to Claude for full-text extraction.

Usage (via ChatToolBuilder):
tools = Assistant::WebFetchToolBuilder.tools

Class Method Summary collapse

Class Method Details

.toolsArray<RubyLLM::Tool>

Returns the fetch_url tool(s).

Returns:

  • (Array<RubyLLM::Tool>)

    the fetch_url tool(s)



18
19
20
21
22
23
# File 'app/services/assistant/web_fetch_tool_builder.rb', line 18

def tools
  @tools ||= [build_fetch_url_tool]
rescue StandardError => e
  Rails.logger.warn("[WebFetchToolBuilder] Failed to build web_fetch tools: #{e.message}")
  []
end