Class: Boxcars::XMLZeroShot

Inherits:
XMLTrain show all
Defined in:
lib/boxcars/train/xml_zero_shot.rb

Overview

A Train using the zero-shot react method and only XML in the prompt.

Instance Attribute Summary collapse

Attributes inherited from Train

#answer_prefix, #early_stopping_method, #engine_prefix, #final_answer_prefix, #max_iterations, #name_to_boxcar_map, #observation_prefix, #question_prefix, #return_intermediate_steps, #return_values, #thought_prefix, #using_xml

Attributes inherited from EngineBoxcar

#engine, #prompt, #stop, #top_k

Attributes inherited from Boxcar

#description, #name, #parameters, #return_direct

Instance Method Summary collapse

Methods inherited from XMLTrain

#boxcars_xml, #build_output, #close_tag, #extract_boxcar_and_input, #init_prefixes, #prediction_additional

Methods inherited from Train

#boxcar_descriptions, #boxcar_names, #call, #construct_scratchpad, #extract_boxcar_and_input, #finish_boxcar_name, #get_boxcar_result, #get_next_action, #init_prefixes, #input_keys, #key_and_value_text, #next_actions, #observation_text, #output_keys, #plan, #pre_return, #prepare_for_new_call, #question_text, #return_stopped_response, #should_continue?, #validate_prompt

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(boxcars:, engine: nil, name: 'Zero Shot XML', description: 'Zero Shot Train wiht XML', prompt: nil, **kwargs) ⇒ XMLZeroShot

Returns a new instance of XMLZeroShot.

Parameters:

  • boxcars (Array<Boxcars::Boxcar>)

    The boxcars to run.

  • engine (Boxcars::Engine) (defaults to: nil)

    The engine to use for this train.

  • name (String) (defaults to: 'Zero Shot XML')

    The name of the train. Defaults to ‘Zero Shot’.

  • description (String) (defaults to: 'Zero Shot Train wiht XML')

    The description of the train. Defaults to ‘Zero Shot Train’.

  • prompt (Boxcars::Prompt) (defaults to: nil)

    The prompt to use. Defaults to the built-in prompt.

  • kwargs (Hash)

    Additional arguments to pass to the train. wants_next_actions: true



18
19
20
21
22
23
# File 'lib/boxcars/train/xml_zero_shot.rb', line 18

def initialize(boxcars:, engine: nil, name: 'Zero Shot XML', description: 'Zero Shot Train wiht XML', prompt: nil, **kwargs)
  @engine_prefix = ''
  @wants_next_actions = kwargs.fetch(:wants_next_actions, false)
  prompt ||= my_prompt
  super(engine: engine, boxcars: boxcars, prompt: prompt, name: name, description: description, **kwargs)
end

Instance Attribute Details

#boxcarsObject (readonly)

Returns the value of attribute boxcars.



9
10
11
# File 'lib/boxcars/train/xml_zero_shot.rb', line 9

def boxcars
  @boxcars
end

#wants_next_actionsObject

Returns the value of attribute wants_next_actions.



10
11
12
# File 'lib/boxcars/train/xml_zero_shot.rb', line 10

def wants_next_actions
  @wants_next_actions
end