Class: Vellum::ModelVersionSandboxSnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/model_version_sandbox_snapshot.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, prompt_index: nil, prompt_id: nil, sandbox_id: nil, additional_properties: nil) ⇒ ModelVersionSandboxSnapshot

Parameters:

  • id (String)

    The ID of the sandbox snapshot.

  • prompt_index (Integer) (defaults to: nil)

    The index of the prompt in the sandbox snapshot.

  • prompt_id (String) (defaults to: nil)

    The id of the prompt in the sandbox snapshot.

  • sandbox_id (String) (defaults to: nil)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesObject (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

#idObject (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_idObject (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_indexObject (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_idObject (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

Parameters:

  • json_object (JSON)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (JSON)


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