Class: Vellum::MlModelUsageWrapper

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ml_model_name:, ml_model_usage:, additional_properties: nil) ⇒ Vellum::MlModelUsageWrapper

Parameters:

  • ml_model_name (String)
  • ml_model_usage (Vellum::MlModelUsage)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



24
25
26
27
28
29
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 24

def initialize(ml_model_name:, ml_model_usage:, additional_properties: nil)
  @ml_model_name = ml_model_name
  @ml_model_usage = ml_model_usage
  @additional_properties = additional_properties
  @_field_set = { "ml_model_name": ml_model_name, "ml_model_usage": ml_model_usage }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



13
14
15
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 13

def additional_properties
  @additional_properties
end

#ml_model_nameString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 9

def ml_model_name
  @ml_model_name
end

#ml_model_usageVellum::MlModelUsage (readonly)



11
12
13
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 11

def ml_model_usage
  @ml_model_usage
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::MlModelUsageWrapper

Parameters:

  • json_object (String)

Returns:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 34

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  ml_model_name = parsed_json["ml_model_name"]
  unless parsed_json["ml_model_usage"].nil?
    ml_model_usage = parsed_json["ml_model_usage"].to_json
    ml_model_usage = Vellum::MlModelUsage.from_json(json_object: ml_model_usage)
  else
    ml_model_usage = nil
  end
  new(
    ml_model_name: ml_model_name,
    ml_model_usage: ml_model_usage,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


62
63
64
65
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 62

def self.validate_raw(obj:)
  obj.ml_model_name.is_a?(String) != false || raise("Passed value for field obj.ml_model_name is not the expected type, validation failed.")
  Vellum::MlModelUsage.validate_raw(obj: obj.ml_model_usage)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


53
54
55
# File 'lib/vellum_ai/types/ml_model_usage_wrapper.rb', line 53

def to_json
  @_field_set&.to_json
end