Class: Kward::Tools::WebSearch
- Defined in:
- lib/kward/tools/web_search.rb
Overview
Live web-search implementation with provider fallbacks.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#call(args, _conversation, cancellation: nil) ⇒ Object
Executes the tool and returns model-facing output text.
-
#initialize(web_search:) ⇒ WebSearch
constructor
Builds the tool schema and stores the execution dependency.
Methods inherited from Base
Constructor Details
#initialize(web_search:) ⇒ WebSearch
Builds the tool schema and stores the execution dependency.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/kward/tools/web_search.rb', line 11 def initialize(web_search:) @web_search = web_search super( "web_search", "Search the live web with bounded results.", properties: { queries: { type: "array", description: "1-4 distinct queries; avoid near-duplicates.", items: { type: "string" }, minItems: 1, maxItems: 4 }, max_results: { type: "integer", description: "Results per query; default 5, max 20." }, provider: { type: "string", enum: Kward::WebSearch::PROVIDERS, description: "Provider override; default auto." }, recency_filter: { type: "string", enum: %w[day week month year], description: "Recency filter." }, domain_filter: { type: "array", description: "Domains to include; prefix '-' to exclude.", items: { type: "string" } } }, required: ["queries"] ) end |
Instance Method Details
#call(args, _conversation, cancellation: nil) ⇒ Object
Executes the tool and returns model-facing output text.
49 50 51 |
# File 'lib/kward/tools/web_search.rb', line 49 def call(args, _conversation, cancellation: nil) @web_search.search(args) end |