Class: Toolchest::SamplingBuilder
- Inherits:
-
Object
- Object
- Toolchest::SamplingBuilder
- Defined in:
- lib/toolchest/sampling_builder.rb
Instance Attribute Summary collapse
-
#max_tokens_value ⇒ Object
readonly
Returns the value of attribute max_tokens_value.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#model_preferences_value ⇒ Object
readonly
Returns the value of attribute model_preferences_value.
-
#stop_sequences_value ⇒ Object
readonly
Returns the value of attribute stop_sequences_value.
-
#system_value ⇒ Object
readonly
Returns the value of attribute system_value.
-
#temperature_value ⇒ Object
readonly
Returns the value of attribute temperature_value.
Instance Method Summary collapse
- #assistant(text) ⇒ Object
-
#initialize ⇒ SamplingBuilder
constructor
A new instance of SamplingBuilder.
- #max_tokens(n) ⇒ Object
- #model_preferences(prefs) ⇒ Object
- #stop_sequences(seqs) ⇒ Object
- #system(text) ⇒ Object
- #temperature(t) ⇒ Object
- #user(text) ⇒ Object
Constructor Details
#initialize ⇒ SamplingBuilder
Returns a new instance of SamplingBuilder.
6 7 8 |
# File 'lib/toolchest/sampling_builder.rb', line 6 def initialize @messages = [] end |
Instance Attribute Details
#max_tokens_value ⇒ Object (readonly)
Returns the value of attribute max_tokens_value.
3 4 5 |
# File 'lib/toolchest/sampling_builder.rb', line 3 def max_tokens_value @max_tokens_value end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
3 4 5 |
# File 'lib/toolchest/sampling_builder.rb', line 3 def @messages end |
#model_preferences_value ⇒ Object (readonly)
Returns the value of attribute model_preferences_value.
3 4 5 |
# File 'lib/toolchest/sampling_builder.rb', line 3 def model_preferences_value @model_preferences_value end |
#stop_sequences_value ⇒ Object (readonly)
Returns the value of attribute stop_sequences_value.
3 4 5 |
# File 'lib/toolchest/sampling_builder.rb', line 3 def stop_sequences_value @stop_sequences_value end |
#system_value ⇒ Object (readonly)
Returns the value of attribute system_value.
3 4 5 |
# File 'lib/toolchest/sampling_builder.rb', line 3 def system_value @system_value end |
#temperature_value ⇒ Object (readonly)
Returns the value of attribute temperature_value.
3 4 5 |
# File 'lib/toolchest/sampling_builder.rb', line 3 def temperature_value @temperature_value end |
Instance Method Details
#assistant(text) ⇒ Object
18 19 20 |
# File 'lib/toolchest/sampling_builder.rb', line 18 def assistant(text) @messages << { role: "assistant", content: { type: "text", text: text } } end |
#max_tokens(n) ⇒ Object
22 23 24 |
# File 'lib/toolchest/sampling_builder.rb', line 22 def max_tokens(n) @max_tokens_value = n end |
#model_preferences(prefs) ⇒ Object
30 31 32 |
# File 'lib/toolchest/sampling_builder.rb', line 30 def model_preferences(prefs) @model_preferences_value = prefs end |
#stop_sequences(seqs) ⇒ Object
34 35 36 |
# File 'lib/toolchest/sampling_builder.rb', line 34 def stop_sequences(seqs) @stop_sequences_value = seqs end |
#system(text) ⇒ Object
10 11 12 |
# File 'lib/toolchest/sampling_builder.rb', line 10 def system(text) @system_value = text end |
#temperature(t) ⇒ Object
26 27 28 |
# File 'lib/toolchest/sampling_builder.rb', line 26 def temperature(t) @temperature_value = t end |
#user(text) ⇒ Object
14 15 16 |
# File 'lib/toolchest/sampling_builder.rb', line 14 def user(text) @messages << { role: "user", content: { type: "text", text: text } } end |