Class: Vellum::ModelVersionRead
- Inherits:
-
Object
- Object
- Vellum::ModelVersionRead
- Defined in:
- lib/vellum_ai/types/model_version_read.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#build_config ⇒ Object
readonly
Returns the value of attribute build_config.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#exec_config ⇒ Object
readonly
Returns the value of attribute exec_config.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ ModelVersionRead
Deserialize a JSON object to an instance of ModelVersionRead.
-
.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:, created:, label:, provider:, external_id:, build_config:, exec_config:, status: nil, additional_properties: nil) ⇒ ModelVersionRead constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionRead to a JSON object.
Constructor Details
#initialize(id:, created:, label:, provider:, external_id:, build_config:, exec_config:, status: nil, additional_properties: nil) ⇒ ModelVersionRead
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 38 def initialize(id:, created:, label:, provider:, external_id:, build_config:, exec_config:, status: nil, additional_properties: nil) # @type [String] Vellum-generated ID that uniquely identifies this model version. @id = id # @type [DateTime] Timestamp of when this model version was created. @created = created # @type [String] Human-friendly name for this model version. @label = label # @type [PROVIDER_ENUM] Which LLM provider this model version is associated with. # - `ANTHROPIC` - Anthropic # - `AWS_BEDROCK` - AWS Bedrock # - `AZURE_OPENAI` - Azure OpenAI # - `COHERE` - Cohere # - `GOOGLE` - Google # - `HOSTED` - Hosted # - `MOSAICML` - MosaicML # - `OPENAI` - OpenAI # - `FIREWORKS_AI` - Fireworks AI # - `HUGGINGFACE` - HuggingFace # - `MYSTIC` - Mystic # - `PYQ` - Pyq # - `REPLICATE` - Replicate @provider = provider # @type [String] The unique id of this model version as it exists in the above provider's system. @external_id = external_id # @type [ModelVersionBuildConfig] Configuration used to build this model version. @build_config = build_config # @type [ModelVersionExecConfig] Configuration used to execute this model version. @exec_config = exec_config # @type [MODEL_VERSION_READ_STATUS_ENUM] @status = status # @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.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def additional_properties @additional_properties end |
#build_config ⇒ Object (readonly)
Returns the value of attribute build_config.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def build_config @build_config end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def created @created end |
#exec_config ⇒ Object (readonly)
Returns the value of attribute exec_config.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def exec_config @exec_config end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def external_id @external_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def label @label end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def provider @provider end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 12 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ ModelVersionRead
Deserialize a JSON object to an instance of ModelVersionRead
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 77 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct.id created = DateTime.parse(parsed_json["created"]) label = struct.label provider = PROVIDER_ENUM.key(parsed_json["provider"]) || parsed_json["provider"] external_id = struct.external_id if parsed_json["build_config"].nil? build_config = nil else build_config = parsed_json["build_config"].to_json build_config = ModelVersionBuildConfig.from_json(json_object: build_config) end if parsed_json["exec_config"].nil? exec_config = nil else exec_config = parsed_json["exec_config"].to_json exec_config = ModelVersionExecConfig.from_json(json_object: exec_config) end status = MODEL_VERSION_READ_STATUS_ENUM.key(parsed_json["status"]) || parsed_json["status"] new(id: id, created: created, label: label, provider: provider, external_id: external_id, build_config: build_config, exec_config: exec_config, status: status, 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.
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 122 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.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.") obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.provider.is_a?(PROVIDER_ENUM) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.") ModelVersionBuildConfig.validate_raw(obj: obj.build_config) ModelVersionExecConfig.validate_raw(obj: obj.exec_config) obj.status&.is_a?(MODEL_VERSION_READ_STATUS_ENUM) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of ModelVersionRead to a JSON object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/vellum_ai/types/model_version_read.rb', line 105 def to_json(*_args) { "id": @id, "created": @created, "label": @label, "provider": PROVIDER_ENUM[@provider] || @provider, "external_id": @external_id, "build_config": @build_config, "exec_config": @exec_config, "status": MODEL_VERSION_READ_STATUS_ENUM[@status] || @status }.to_json end |