Class: Boxcars::URLText
Overview
A Boxcar that reads text from a URL.
Constant Summary collapse
- DESC =
Default description for this boxcar.
"useful when you want to get text from a URL."
Constants inherited from Boxcar
Boxcar::SCHEMA_KEY_ALIASES, Boxcar::TYPE_ALIASES
Instance Attribute Summary
Attributes inherited from Boxcar
#description, #name, #parameters, #return_direct
Instance Method Summary collapse
-
#call(inputs:) ⇒ Hash
Execute one URL text fetch using the normalized Boxcar input contract.
-
#initialize(name: "FetchURL", description: DESC) ⇒ URLText
constructor
Create a URL text extraction boxcar.
Methods inherited from Boxcar
#apply, assi, #conduct, #conduct_result, hist, #input_keys, #output_keys, #parameters_json_schema, #run, #run_result, #schema, syst, #tool_call_name, #tool_definition, #tool_spec, user, #validate_inputs, #validate_outputs
Constructor Details
Instance Method Details
#call(inputs:) ⇒ Hash
Execute one URL text fetch using the normalized Boxcar input contract.
19 20 21 22 23 |
# File 'lib/boxcars/boxcar/url_text.rb', line 19 def call(inputs:) url = inputs[:question] parsed_url = URI.parse(url) { answer: do_encoding(get_answer(parsed_url)) } end |