Class: Vellum::MlModelRead

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

Overview

An ML Model that your Workspace has access to.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, hosted_by:, introduced_on:, additional_properties: nil) ⇒ Vellum::MlModelRead

Parameters:

  • introduced_on (DateTime)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



92
93
94
95
96
97
98
99
# File 'lib/vellum_ai/types/ml_model_read.rb', line 92

def initialize(id:, name:, hosted_by:, introduced_on:, additional_properties: nil)
  @id = id
  @name = name
  @hosted_by = hosted_by
  @introduced_on = introduced_on
  @additional_properties = additional_properties
  @_field_set = { "id": id, "name": name, "hosted_by": hosted_by, "introduced_on": introduced_on }
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



49
50
51
# File 'lib/vellum_ai/types/ml_model_read.rb', line 49

def additional_properties
  @additional_properties
end

#hosted_by ⇒ Object (readonly)

  • SWISSCOM - Swisscom


45
46
47
# File 'lib/vellum_ai/types/ml_model_read.rb', line 45

def hosted_by
  @hosted_by
end

#id ⇒ String (readonly)

Returns:

  • (String)


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

def id
  @id
end

#introduced_on ⇒ DateTime (readonly)

Returns:

  • (DateTime)


47
48
49
# File 'lib/vellum_ai/types/ml_model_read.rb', line 47

def introduced_on
  @introduced_on
end

#name ⇒ String (readonly)

Returns The unique name of the ML Model.

Returns:

  • (String) —

    The unique name of the ML Model.



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

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::MlModelRead

Parameters:

  • json_object (String)

Returns:



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/vellum_ai/types/ml_model_read.rb', line 104

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  name = parsed_json["name"]
  hosted_by = parsed_json["hosted_by"]
  introduced_on = unless parsed_json["introduced_on"].nil?
  DateTime.parse(parsed_json["introduced_on"])
else
  nil
end
  new(
    id: id,
    name: name,
    hosted_by: hosted_by,
    introduced_on: introduced_on,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


135
136
137
138
139
140
# File 'lib/vellum_ai/types/ml_model_read.rb', line 135

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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.hosted_by.is_a?(Vellum::MlModelHostingInterface) != false || raise("Passed value for field obj.hosted_by is not the expected type, validation failed.")
  obj.introduced_on.is_a?(DateTime) != false || raise("Passed value for field obj.introduced_on is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


126
127
128
# File 'lib/vellum_ai/types/ml_model_read.rb', line 126

def to_json
  @_field_set&.to_json
end