Class: Vellum::ModelVersionSandboxSnapshot
- Inherits:
-
Object
- Object
- Vellum::ModelVersionSandboxSnapshot
- Defined in:
- lib/vellum_ai/types/model_version_sandbox_snapshot.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#prompt_id ⇒ Object
readonly
Returns the value of attribute prompt_id.
-
#prompt_index ⇒ Object
readonly
Returns the value of attribute prompt_index.
-
#sandbox_id ⇒ Object
readonly
Returns the value of attribute sandbox_id.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ ModelVersionSandboxSnapshot
Deserialize a JSON object to an instance of ModelVersionSandboxSnapshot.
-
.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(id:, prompt_index: nil, prompt_id: nil, sandbox_id: nil, additional_properties: nil) ⇒ ModelVersionSandboxSnapshot constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionSandboxSnapshot to a JSON object.
Constructor Details
#initialize(id:, prompt_index: nil, prompt_id: nil, sandbox_id: nil, additional_properties: nil) ⇒ ModelVersionSandboxSnapshot
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 15 def initialize(id:, prompt_index: nil, prompt_id: nil, sandbox_id: nil, additional_properties: nil) # @type [String] The ID of the sandbox snapshot. @id = id # @type [Integer] The index of the prompt in the sandbox snapshot. @prompt_index = prompt_index # @type [String] The id of the prompt in the sandbox snapshot. @prompt_id = prompt_id # @type [String] @sandbox_id = sandbox_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.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 7 def additional_properties @additional_properties end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 7 def id @id end |
#prompt_id ⇒ Object (readonly)
Returns the value of attribute prompt_id.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 7 def prompt_id @prompt_id end |
#prompt_index ⇒ Object (readonly)
Returns the value of attribute prompt_index.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 7 def prompt_index @prompt_index end |
#sandbox_id ⇒ Object (readonly)
Returns the value of attribute sandbox_id.
7 8 9 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 7 def sandbox_id @sandbox_id end |
Class Method Details
.from_json(json_object:) ⇒ ModelVersionSandboxSnapshot
Deserialize a JSON object to an instance of ModelVersionSandboxSnapshot
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 32 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) id = struct.id prompt_index = struct.prompt_index prompt_id = struct.prompt_id sandbox_id = struct.sandbox_id new(id: id, prompt_index: prompt_index, prompt_id: prompt_id, sandbox_id: sandbox_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.
54 55 56 57 58 59 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 54 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.prompt_index&.is_a?(Integer) != false || raise("Passed value for field obj.prompt_index is not the expected type, validation failed.") obj.prompt_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_id is not the expected type, validation failed.") obj.sandbox_id&.is_a?(String) != false || raise("Passed value for field obj.sandbox_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionSandboxSnapshot to a JSON object
46 47 48 |
# File 'lib/vellum_ai/types/model_version_sandbox_snapshot.rb', line 46 def to_json(*_args) { "id": @id, "prompt_index": @prompt_index, "prompt_id": @prompt_id, "sandbox_id": @sandbox_id }.to_json end |