Class: Vellum::DeploymentRead

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created:, label:, name:, last_deployed_on:, input_variables:, active_model_version_ids:, status: nil, environment: nil, additional_properties: nil) ⇒ DeploymentRead

Parameters:

  • id (String)
  • created (DateTime)
  • label (String)

    A human-readable label for the deployment

  • name (String)

    A name that uniquely identifies this deployment within its workspace

  • status (ENTITY_STATUS) (defaults to: nil)

    The current status of the deployment

    • ‘ACTIVE` - Active

    • ‘ARCHIVED` - Archived

  • environment (ENVIRONMENT_ENUM) (defaults to: nil)

    The environment this deployment is used in

    • ‘DEVELOPMENT` - Development

    • ‘STAGING` - Staging

    • ‘PRODUCTION` - Production

  • last_deployed_on (DateTime)
  • input_variables (Array<VellumVariable>)
  • active_model_version_ids (Array<String>)

    Deprecated. The Prompt execution endpoints return a ‘prompt_version_id` that could be used instead.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vellum_ai/types/deployment_read.rb', line 30

def initialize(id:, created:, label:, name:, last_deployed_on:, input_variables:, active_model_version_ids:,
               status: nil, environment: nil, additional_properties: nil)
  # @type [String]
  @id = id
  # @type [DateTime]
  @created = created
  # @type [String] A human-readable label for the deployment
  @label = label
  # @type [String] A name that uniquely identifies this deployment within its workspace
  @name = name
  # @type [ENTITY_STATUS] The current status of the deployment
  #   - `ACTIVE` - Active
  #   - `ARCHIVED` - Archived
  @status = status
  # @type [ENVIRONMENT_ENUM] The environment this deployment is used in
  #   - `DEVELOPMENT` - Development
  #   - `STAGING` - Staging
  #   - `PRODUCTION` - Production
  @environment = environment
  # @type [DateTime]
  @last_deployed_on = last_deployed_on
  # @type [Array<VellumVariable>]
  @input_variables = input_variables
  # @type [Array<String>] Deprecated. The Prompt execution endpoints return a `prompt_version_id` that could be used instead.
  @active_model_version_ids = active_model_version_ids
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#active_model_version_idsObject (readonly)

Returns the value of attribute active_model_version_ids.



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

def active_model_version_ids
  @active_model_version_ids
end

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



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

def additional_properties
  @additional_properties
end

#createdObject (readonly)

Returns the value of attribute created.



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

def created
  @created
end

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#input_variablesObject (readonly)

Returns the value of attribute input_variables.



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

def input_variables
  @input_variables
end

#labelObject (readonly)

Returns the value of attribute label.



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

def label
  @label
end

#last_deployed_onObject (readonly)

Returns the value of attribute last_deployed_on.



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

def last_deployed_on
  @last_deployed_on
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ DeploymentRead

Deserialize a JSON object to an instance of DeploymentRead

Parameters:

  • json_object (JSON)

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/vellum_ai/types/deployment_read.rb', line 63

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
  name = struct.name
  status = ENTITY_STATUS.key(parsed_json["status"]) || parsed_json["status"]
  environment = ENVIRONMENT_ENUM.key(parsed_json["environment"]) || parsed_json["environment"]
  last_deployed_on = DateTime.parse(parsed_json["last_deployed_on"])
  input_variables = parsed_json["input_variables"].map do |v|
    v = v.to_json
    VellumVariable.from_json(json_object: v)
  end
  active_model_version_ids = struct.active_model_version_ids
  new(id: id, created: created, label: label, name: name, status: status, environment: environment,
      last_deployed_on: last_deployed_on, input_variables: input_variables, active_model_version_ids: active_model_version_ids, 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)


103
104
105
106
107
108
109
110
111
112
113
# File 'lib/vellum_ai/types/deployment_read.rb', line 103

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.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.status&.is_a?(ENTITY_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.environment&.is_a?(ENVIRONMENT_ENUM) != false || raise("Passed value for field obj.environment is not the expected type, validation failed.")
  obj.last_deployed_on.is_a?(DateTime) != false || raise("Passed value for field obj.last_deployed_on is not the expected type, validation failed.")
  obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.")
  obj.active_model_version_ids.is_a?(Array) != false || raise("Passed value for field obj.active_model_version_ids is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of DeploymentRead to a JSON object

Returns:

  • (JSON)


85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/vellum_ai/types/deployment_read.rb', line 85

def to_json(*_args)
  {
    "id": @id,
    "created": @created,
    "label": @label,
    "name": @name,
    "status": ENTITY_STATUS[@status] || @status,
    "environment": ENVIRONMENT_ENUM[@environment] || @environment,
    "last_deployed_on": @last_deployed_on,
    "input_variables": @input_variables,
    "active_model_version_ids": @active_model_version_ids
  }.to_json
end