Class: Vellum::ModelVersionBuildConfig

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_model:, sandbox_snapshot: nil, prompt_version_id: nil, additional_properties: nil) ⇒ ModelVersionBuildConfig

Parameters:

  • base_model (String)

    The name of the base model used to create this model version, as identified by the LLM provider.

  • sandbox_snapshot (ModelVersionSandboxSnapshot) (defaults to: nil)

    Information about the sandbox snapshot that was used to create this model version, if applicable.

  • prompt_version_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
# 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_propertiesObject (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_modelObject (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_idObject (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_snapshotObject (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

Parameters:

  • json_object (JSON)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (JSON)


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