Class: Contai::ContaiConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/contai/generatable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContaiConfig

Returns a new instance of ContaiConfig.



67
68
69
70
71
72
73
# File 'lib/contai/generatable.rb', line 67

def initialize
  @prompt_fields = [:prompt]
  @output_field = :body
  @provider_type = :http
  @provider_options = {}
  @template = nil
end

Instance Attribute Details

#output_fieldObject

Returns the value of attribute output_field.



65
66
67
# File 'lib/contai/generatable.rb', line 65

def output_field
  @output_field
end

#prompt_fieldsObject

Returns the value of attribute prompt_fields.



65
66
67
# File 'lib/contai/generatable.rb', line 65

def prompt_fields
  @prompt_fields
end

#provider_optionsObject

Returns the value of attribute provider_options.



65
66
67
# File 'lib/contai/generatable.rb', line 65

def provider_options
  @provider_options
end

#provider_typeObject

Returns the value of attribute provider_type.



65
66
67
# File 'lib/contai/generatable.rb', line 65

def provider_type
  @provider_type
end

#template(tmpl) ⇒ Object

Returns the value of attribute template.



65
66
67
# File 'lib/contai/generatable.rb', line 65

def template
  @template
end

Instance Method Details

#output_to(field) ⇒ Object



79
80
81
# File 'lib/contai/generatable.rb', line 79

def output_to(field)
  @output_field = field
end

#prompt_from(*fields) ⇒ Object



75
76
77
# File 'lib/contai/generatable.rb', line 75

def prompt_from(*fields)
  @prompt_fields = fields
end

#provider(type, options = {}) ⇒ Object



83
84
85
86
# File 'lib/contai/generatable.rb', line 83

def provider(type, options = {})
  @provider_type = type
  @provider_options = options
end

#to_hObject



92
93
94
95
96
97
98
99
100
# File 'lib/contai/generatable.rb', line 92

def to_h
  {
    prompt_fields: @prompt_fields,
    output_field: @output_field,
    provider: @provider_type,
    provider_options: @provider_options,
    template: @template
  }
end