Class: Vellum::ModelVersionBuildConfig
- Inherits:
-
Object
- Object
- Vellum::ModelVersionBuildConfig
- Defined in:
- lib/vellum_ai/types/model_version_build_config.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#base_model ⇒ Object
readonly
Returns the value of attribute base_model.
-
#prompt_version_id ⇒ Object
readonly
Returns the value of attribute prompt_version_id.
-
#sandbox_snapshot ⇒ Object
readonly
Returns the value of attribute sandbox_snapshot.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ ModelVersionBuildConfig
Deserialize a JSON object to an instance of ModelVersionBuildConfig.
-
.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(base_model:, sandbox_snapshot: nil, prompt_version_id: nil, additional_properties: nil) ⇒ ModelVersionBuildConfig constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionBuildConfig to a JSON object.
Constructor Details
#initialize(base_model:, sandbox_snapshot: nil, prompt_version_id: nil, additional_properties: nil) ⇒ ModelVersionBuildConfig
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 15 def initialize(base_model:, sandbox_snapshot: nil, prompt_version_id: nil, additional_properties: nil) # @type [String] The name of the base model used to create this model version, as identified by the LLM provider. @base_model = base_model # @type [ModelVersionSandboxSnapshot] Information about the sandbox snapshot that was used to create this model version, if applicable. @sandbox_snapshot = sandbox_snapshot # @type [String] @prompt_version_id = prompt_version_id # @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.
8 9 10 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 8 def additional_properties @additional_properties end |
#base_model ⇒ Object (readonly)
Returns the value of attribute base_model.
8 9 10 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 8 def base_model @base_model end |
#prompt_version_id ⇒ Object (readonly)
Returns the value of attribute prompt_version_id.
8 9 10 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 8 def prompt_version_id @prompt_version_id end |
#sandbox_snapshot ⇒ Object (readonly)
Returns the value of attribute sandbox_snapshot.
8 9 10 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 8 def sandbox_snapshot @sandbox_snapshot end |
Class Method Details
.from_json(json_object:) ⇒ ModelVersionBuildConfig
Deserialize a JSON object to an instance of ModelVersionBuildConfig
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 30 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) base_model = struct.base_model if parsed_json["sandbox_snapshot"].nil? sandbox_snapshot = nil else sandbox_snapshot = parsed_json["sandbox_snapshot"].to_json sandbox_snapshot = ModelVersionSandboxSnapshot.from_json(json_object: sandbox_snapshot) end prompt_version_id = struct.prompt_version_id new(base_model: base_model, sandbox_snapshot: sandbox_snapshot, prompt_version_id: prompt_version_id, 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.
60 61 62 63 64 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 60 def self.validate_raw(obj:) obj.base_model.is_a?(String) != false || raise("Passed value for field obj.base_model is not the expected type, validation failed.") obj.sandbox_snapshot.nil? || ModelVersionSandboxSnapshot.validate_raw(obj: obj.sandbox_snapshot) obj.prompt_version_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionBuildConfig to a JSON object
48 49 50 51 52 53 54 |
# File 'lib/vellum_ai/types/model_version_build_config.rb', line 48 def to_json(*_args) { "base_model": @base_model, "sandbox_snapshot": @sandbox_snapshot, "prompt_version_id": @prompt_version_id }.to_json end |