Class: Boxcars::Calculator
- Inherits:
-
EngineBoxcar
- Object
- Boxcar
- EngineBoxcar
- Boxcars::Calculator
- Defined in:
- lib/boxcars/boxcar/calculator.rb
Overview
A Boxcar that interprets a prompt and executes ruby code to do math
Constant Summary collapse
- CALCDESC =
the description of this engine boxcar
"useful for when you need to answer questions about math"
Instance Attribute Summary
Attributes inherited from EngineBoxcar
#engine, #prompt, #stop, #top_k
Attributes inherited from Boxcar
#description, #name, #parameters, #return_direct
Instance Method Summary collapse
-
#initialize(engine: nil, prompt: nil, **kwargs) ⇒ Calculator
constructor
A new instance of Calculator.
Methods inherited from EngineBoxcar
#apply, #call, #check_output_keys, #extract_code, #generate, #input_key, #input_keys, #output_key, #output_keys, #predict, #prediction_additional, #prediction_input, #prediction_variables
Methods inherited from Boxcar
#apply, assi, #call, #conduct, hist, #input_keys, #load, #output_keys, #run, #save, #schema, syst, user, #validate_inputs, #validate_outputs
Constructor Details
#initialize(engine: nil, prompt: nil, **kwargs) ⇒ Calculator
Returns a new instance of Calculator.
13 14 15 16 17 18 19 |
# File 'lib/boxcars/boxcar/calculator.rb', line 13 def initialize(engine: nil, prompt: nil, **kwargs) the_prompt = prompt || my_prompt kwargs[:stop] ||= ["```output"] kwargs[:name] ||= "Calculator" kwargs[:description] ||= CALCDESC super(engine: engine, prompt: the_prompt, **kwargs) end |