Class: Vellum::ModelVersionExecConfigParameters
- Inherits:
-
Object
- Object
- Vellum::ModelVersionExecConfigParameters
- Defined in:
- lib/vellum_ai/types/model_version_exec_config_parameters.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#custom_parameters ⇒ Object
readonly
Returns the value of attribute custom_parameters.
-
#frequency_penalty ⇒ Object
readonly
Returns the value of attribute frequency_penalty.
-
#logit_bias ⇒ Object
readonly
Returns the value of attribute logit_bias.
-
#max_tokens ⇒ Object
readonly
Returns the value of attribute max_tokens.
-
#presence_penalty ⇒ Object
readonly
Returns the value of attribute presence_penalty.
-
#stop ⇒ Object
readonly
Returns the value of attribute stop.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
-
#top_k ⇒ Object
readonly
Returns the value of attribute top_k.
-
#top_p ⇒ Object
readonly
Returns the value of attribute top_p.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ ModelVersionExecConfigParameters
Deserialize a JSON object to an instance of ModelVersionExecConfigParameters.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(top_p:, frequency_penalty:, presence_penalty:, temperature: nil, max_tokens: nil, logit_bias: nil, stop: nil, top_k: nil, custom_parameters: nil, additional_properties: nil) ⇒ ModelVersionExecConfigParameters constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionExecConfigParameters to a JSON object.
Constructor Details
#initialize(top_p:, frequency_penalty:, presence_penalty:, temperature: nil, max_tokens: nil, logit_bias: nil, stop: nil, top_k: nil, custom_parameters: nil, additional_properties: nil) ⇒ ModelVersionExecConfigParameters
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 21 def initialize(top_p:, frequency_penalty:, presence_penalty:, temperature: nil, max_tokens: nil, logit_bias: nil, stop: nil, top_k: nil, custom_parameters: nil, additional_properties: nil) # @type [Float] @temperature = temperature # @type [Integer] @max_tokens = max_tokens # @type [Float] @top_p = top_p # @type [Float] @frequency_penalty = frequency_penalty # @type [Float] @presence_penalty = presence_penalty # @type [Hash{String => String}] @logit_bias = logit_bias # @type [Array<String>] @stop = stop # @type [Float] @top_k = top_k # @type [Hash{String => String}] @custom_parameters = custom_parameters # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def additional_properties @additional_properties end |
#custom_parameters ⇒ Object (readonly)
Returns the value of attribute custom_parameters.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def custom_parameters @custom_parameters end |
#frequency_penalty ⇒ Object (readonly)
Returns the value of attribute frequency_penalty.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def frequency_penalty @frequency_penalty end |
#logit_bias ⇒ Object (readonly)
Returns the value of attribute logit_bias.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def logit_bias @logit_bias end |
#max_tokens ⇒ Object (readonly)
Returns the value of attribute max_tokens.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def max_tokens @max_tokens end |
#presence_penalty ⇒ Object (readonly)
Returns the value of attribute presence_penalty.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def presence_penalty @presence_penalty end |
#stop ⇒ Object (readonly)
Returns the value of attribute stop.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def stop @stop end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def temperature @temperature end |
#top_k ⇒ Object (readonly)
Returns the value of attribute top_k.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def top_k @top_k end |
#top_p ⇒ Object (readonly)
Returns the value of attribute top_p.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 7 def top_p @top_p end |
Class Method Details
.from_json(json_object:) ⇒ ModelVersionExecConfigParameters
Deserialize a JSON object to an instance of ModelVersionExecConfigParameters
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 49 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) temperature = struct.temperature max_tokens = struct.max_tokens top_p = struct.top_p frequency_penalty = struct.frequency_penalty presence_penalty = struct.presence_penalty logit_bias = struct.logit_bias stop = struct.stop top_k = struct.top_k custom_parameters = struct.custom_parameters new(temperature: temperature, max_tokens: max_tokens, top_p: top_p, frequency_penalty: frequency_penalty, presence_penalty: presence_penalty, logit_bias: logit_bias, stop: stop, top_k: top_k, custom_parameters: custom_parameters, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 86 def self.validate_raw(obj:) obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.") obj.max_tokens&.is_a?(Integer) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.") obj.top_p.is_a?(Float) != false || raise("Passed value for field obj.top_p is not the expected type, validation failed.") obj.frequency_penalty.is_a?(Float) != false || raise("Passed value for field obj.frequency_penalty is not the expected type, validation failed.") obj.presence_penalty.is_a?(Float) != false || raise("Passed value for field obj.presence_penalty is not the expected type, validation failed.") obj.logit_bias&.is_a?(Hash) != false || raise("Passed value for field obj.logit_bias is not the expected type, validation failed.") obj.stop&.is_a?(Array) != false || raise("Passed value for field obj.stop is not the expected type, validation failed.") obj.top_k&.is_a?(Float) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.") obj.custom_parameters&.is_a?(Hash) != false || raise("Passed value for field obj.custom_parameters is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionExecConfigParameters to a JSON object
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/vellum_ai/types/model_version_exec_config_parameters.rb', line 68 def to_json(*_args) { "temperature": @temperature, "max_tokens": @max_tokens, "top_p": @top_p, "frequency_penalty": @frequency_penalty, "presence_penalty": @presence_penalty, "logit_bias": @logit_bias, "stop": @stop, "top_k": @top_k, "custom_parameters": @custom_parameters }.to_json end |