Class: Vellum::ModelVersionExecConfig
- Inherits:
-
Object
- Object
- Vellum::ModelVersionExecConfig
- Defined in:
- lib/vellum_ai/types/model_version_exec_config.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#input_variables ⇒ Object
readonly
Returns the value of attribute input_variables.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#prompt_block_data ⇒ Object
readonly
Returns the value of attribute prompt_block_data.
-
#prompt_syntax_version ⇒ Object
readonly
Returns the value of attribute prompt_syntax_version.
-
#prompt_template ⇒ Object
readonly
Returns the value of attribute prompt_template.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ ModelVersionExecConfig
Deserialize a JSON object to an instance of ModelVersionExecConfig.
-
.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(parameters:, input_variables:, prompt_template: nil, prompt_block_data: nil, prompt_syntax_version: nil, additional_properties: nil) ⇒ ModelVersionExecConfig constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionExecConfig to a JSON object.
Constructor Details
#initialize(parameters:, input_variables:, prompt_template: nil, prompt_block_data: nil, prompt_syntax_version: nil, additional_properties: nil) ⇒ ModelVersionExecConfig
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 20 def initialize(parameters:, input_variables:, prompt_template: nil, prompt_block_data: nil, prompt_syntax_version: nil, additional_properties: nil) # @type [ModelVersionExecConfigParameters] The generation parameters that are passed to the LLM provider at runtime. @parameters = parameters # @type [Array<VellumVariable>] Input variables specified in the prompt template. @input_variables = input_variables # @type [String] The template used to generate prompts for this model version. @prompt_template = prompt_template # @type [PromptTemplateBlockData] @prompt_block_data = prompt_block_data # @type [Integer] @prompt_syntax_version = prompt_syntax_version # @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.
10 11 12 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 10 def additional_properties @additional_properties end |
#input_variables ⇒ Object (readonly)
Returns the value of attribute input_variables.
10 11 12 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 10 def input_variables @input_variables end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
10 11 12 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 10 def parameters @parameters end |
#prompt_block_data ⇒ Object (readonly)
Returns the value of attribute prompt_block_data.
10 11 12 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 10 def prompt_block_data @prompt_block_data end |
#prompt_syntax_version ⇒ Object (readonly)
Returns the value of attribute prompt_syntax_version.
10 11 12 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 10 def prompt_syntax_version @prompt_syntax_version end |
#prompt_template ⇒ Object (readonly)
Returns the value of attribute prompt_template.
10 11 12 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 10 def prompt_template @prompt_template end |
Class Method Details
.from_json(json_object:) ⇒ ModelVersionExecConfig
Deserialize a JSON object to an instance of ModelVersionExecConfig
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 40 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["parameters"].nil? parameters = nil else parameters = parsed_json["parameters"].to_json parameters = ModelVersionExecConfigParameters.from_json(json_object: parameters) end input_variables = parsed_json["input_variables"].map do |v| v = v.to_json VellumVariable.from_json(json_object: v) end prompt_template = struct.prompt_template if parsed_json["prompt_block_data"].nil? prompt_block_data = nil else prompt_block_data = parsed_json["prompt_block_data"].to_json prompt_block_data = PromptTemplateBlockData.from_json(json_object: prompt_block_data) end prompt_syntax_version = struct.prompt_syntax_version new(parameters: parameters, input_variables: input_variables, prompt_template: prompt_template, prompt_block_data: prompt_block_data, prompt_syntax_version: prompt_syntax_version, 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.
82 83 84 85 86 87 88 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 82 def self.validate_raw(obj:) ModelVersionExecConfigParameters.validate_raw(obj: obj.parameters) obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.") obj.prompt_template&.is_a?(String) != false || raise("Passed value for field obj.prompt_template is not the expected type, validation failed.") obj.prompt_block_data.nil? || PromptTemplateBlockData.validate_raw(obj: obj.prompt_block_data) obj.prompt_syntax_version&.is_a?(Integer) != false || raise("Passed value for field obj.prompt_syntax_version is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionExecConfig to a JSON object
68 69 70 71 72 73 74 75 76 |
# File 'lib/vellum_ai/types/model_version_exec_config.rb', line 68 def to_json(*_args) { "parameters": @parameters, "input_variables": @input_variables, "prompt_template": @prompt_template, "prompt_block_data": @prompt_block_data, "prompt_syntax_version": @prompt_syntax_version }.to_json end |