vellum_ai 1.2.4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +28 -0
  4. data/lib/vellum_ai/types/audio_input.rb +75 -0
  5. data/lib/vellum_ai/types/code_executor_input.rb +64 -0
  6. data/lib/vellum_ai/types/deployment_read.rb +3 -8
  7. data/lib/vellum_ai/types/document_input.rb +75 -0
  8. data/lib/vellum_ai/types/environment_enum.rb +0 -3
  9. data/lib/vellum_ai/types/image_input.rb +75 -0
  10. data/lib/vellum_ai/types/named_scenario_input_audio_variable_value_request.rb +76 -0
  11. data/lib/vellum_ai/types/named_scenario_input_document_variable_value_request.rb +76 -0
  12. data/lib/vellum_ai/types/named_scenario_input_image_variable_value_request.rb +76 -0
  13. data/lib/vellum_ai/types/named_scenario_input_request.rb +64 -0
  14. data/lib/vellum_ai/types/named_scenario_input_video_variable_value_request.rb +76 -0
  15. data/lib/vellum_ai/types/named_test_case_audio_variable_value.rb +75 -0
  16. data/lib/vellum_ai/types/named_test_case_audio_variable_value_request.rb +76 -0
  17. data/lib/vellum_ai/types/named_test_case_document_variable_value.rb +74 -0
  18. data/lib/vellum_ai/types/named_test_case_document_variable_value_request.rb +76 -0
  19. data/lib/vellum_ai/types/named_test_case_image_variable_value.rb +74 -0
  20. data/lib/vellum_ai/types/named_test_case_image_variable_value_request.rb +75 -0
  21. data/lib/vellum_ai/types/named_test_case_variable_value.rb +64 -0
  22. data/lib/vellum_ai/types/named_test_case_variable_value_request.rb +64 -0
  23. data/lib/vellum_ai/types/named_test_case_video_variable_value.rb +74 -0
  24. data/lib/vellum_ai/types/named_test_case_video_variable_value_request.rb +75 -0
  25. data/lib/vellum_ai/types/node_execution_span_attributes.rb +11 -2
  26. data/lib/vellum_ai/types/scenario_input.rb +64 -0
  27. data/lib/vellum_ai/types/scenario_input_audio_variable_value.rb +74 -0
  28. data/lib/vellum_ai/types/scenario_input_document_variable_value.rb +74 -0
  29. data/lib/vellum_ai/types/scenario_input_image_variable_value.rb +74 -0
  30. data/lib/vellum_ai/types/scenario_input_video_variable_value.rb +74 -0
  31. data/lib/vellum_ai/types/slim_deployment_read.rb +3 -8
  32. data/lib/vellum_ai/types/slim_workflow_deployment.rb +3 -8
  33. data/lib/vellum_ai/types/span_link.rb +3 -3
  34. data/lib/vellum_ai/types/span_link_type_enum.rb +10 -1
  35. data/lib/vellum_ai/types/test_case_audio_variable_value.rb +84 -0
  36. data/lib/vellum_ai/types/test_case_document_variable_value.rb +84 -0
  37. data/lib/vellum_ai/types/test_case_image_variable_value.rb +84 -0
  38. data/lib/vellum_ai/types/test_case_variable_value.rb +64 -0
  39. data/lib/vellum_ai/types/test_case_video_variable_value.rb +84 -0
  40. data/lib/vellum_ai/types/video_input.rb +75 -0
  41. data/lib/vellum_ai/types/workflow_deployment_read.rb +3 -8
  42. data/lib/vellum_ai/types/workflow_push_deployment_config_request.rb +9 -2
  43. data/lib/vellum_ai/types/workflow_request_audio_input_request.rb +75 -0
  44. data/lib/vellum_ai/types/workflow_request_document_input_request.rb +75 -0
  45. data/lib/vellum_ai/types/workflow_request_image_input_request.rb +75 -0
  46. data/lib/vellum_ai/types/workflow_request_input_request.rb +64 -0
  47. data/lib/vellum_ai/types/workflow_request_video_input_request.rb +75 -0
  48. data/lib/vellum_ai/workflow_sandboxes/client.rb +6 -8
  49. data/lib/vellum_ai/workflows/client.rb +12 -4
  50. metadata +30 -2
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ScenarioInputVideoVariableValue
8
+ # @return [String]
9
+ attr_reader :type
10
+ # @return [Vellum::VellumVideo]
11
+ attr_reader :value
12
+ # @return [String]
13
+ attr_reader :input_variable_id
14
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
15
+ attr_reader :additional_properties
16
+ # @return [Object]
17
+ attr_reader :_field_set
18
+ protected :_field_set
19
+
20
+ OMIT = Object.new
21
+
22
+ # @param type [String]
23
+ # @param value [Vellum::VellumVideo]
24
+ # @param input_variable_id [String]
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [Vellum::ScenarioInputVideoVariableValue]
27
+ def initialize(type:, value:, input_variable_id:, additional_properties: nil)
28
+ @type = type
29
+ @value = value
30
+ @input_variable_id = input_variable_id
31
+ @additional_properties = additional_properties
32
+ @_field_set = { "type": type, "value": value, "input_variable_id": input_variable_id }
33
+ end
34
+ # Deserialize a JSON object to an instance of ScenarioInputVideoVariableValue
35
+ #
36
+ # @param json_object [String]
37
+ # @return [Vellum::ScenarioInputVideoVariableValue]
38
+ def self.from_json(json_object:)
39
+ struct = JSON.parse(json_object, object_class: OpenStruct)
40
+ parsed_json = JSON.parse(json_object)
41
+ type = parsed_json["type"]
42
+ unless parsed_json["value"].nil?
43
+ value = parsed_json["value"].to_json
44
+ value = Vellum::VellumVideo.from_json(json_object: value)
45
+ else
46
+ value = nil
47
+ end
48
+ input_variable_id = parsed_json["input_variable_id"]
49
+ new(
50
+ type: type,
51
+ value: value,
52
+ input_variable_id: input_variable_id,
53
+ additional_properties: struct
54
+ )
55
+ end
56
+ # Serialize an instance of ScenarioInputVideoVariableValue to a JSON object
57
+ #
58
+ # @return [String]
59
+ def to_json
60
+ @_field_set&.to_json
61
+ end
62
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
63
+ # hash and check each fields type against the current object's property
64
+ # definitions.
65
+ #
66
+ # @param obj [Object]
67
+ # @return [Void]
68
+ def self.validate_raw(obj:)
69
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
70
+ Vellum::VellumVideo.validate_raw(obj: obj.value)
71
+ obj.input_variable_id.is_a?(String) != false || raise("Passed value for field obj.input_variable_id is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end
@@ -8,6 +8,7 @@ require "ostruct"
8
8
  require "json"
9
9
 
10
10
  module Vellum
11
+ # A subset of a Prompt Deployment's full details.
11
12
  class SlimDeploymentRead
12
13
  # @return [String]
13
14
  attr_reader :id
@@ -21,10 +22,7 @@ module Vellum
21
22
  # * `ACTIVE` - Active
22
23
  # * `ARCHIVED` - Archived
23
24
  attr_reader :status
24
- # @return [Vellum::EnvironmentEnum] The environment this deployment is used in
25
- # * `DEVELOPMENT` - Development
26
- # * `STAGING` - Staging
27
- # * `PRODUCTION` - Production
25
+ # @return [Vellum::EnvironmentEnum] Deprecated. The value returned will always be 'PRODUCTION'.
28
26
  attr_reader :environment
29
27
  # @return [DateTime]
30
28
  attr_reader :last_deployed_on
@@ -47,10 +45,7 @@ module Vellum
47
45
  # @param status [Vellum::EntityStatus] The current status of the deployment
48
46
  # * `ACTIVE` - Active
49
47
  # * `ARCHIVED` - Archived
50
- # @param environment [Vellum::EnvironmentEnum] The environment this deployment is used in
51
- # * `DEVELOPMENT` - Development
52
- # * `STAGING` - Staging
53
- # * `PRODUCTION` - Production
48
+ # @param environment [Vellum::EnvironmentEnum] Deprecated. The value returned will always be 'PRODUCTION'.
54
49
  # @param last_deployed_on [DateTime]
55
50
  # @param input_variables [Array<Vellum::VellumVariable>]
56
51
  # @param description [String] A human-readable description of the deployment
@@ -8,6 +8,7 @@ require "ostruct"
8
8
  require "json"
9
9
 
10
10
  module Vellum
11
+ # A subset of a Workflow Deployment's full details.
11
12
  class SlimWorkflowDeployment
12
13
  # @return [String]
13
14
  attr_reader :id
@@ -19,10 +20,7 @@ module Vellum
19
20
  # * `ACTIVE` - Active
20
21
  # * `ARCHIVED` - Archived
21
22
  attr_reader :status
22
- # @return [Vellum::EnvironmentEnum] The environment this workflow deployment is used in
23
- # * `DEVELOPMENT` - Development
24
- # * `STAGING` - Staging
25
- # * `PRODUCTION` - Production
23
+ # @return [Vellum::EnvironmentEnum] Deprecated. The value returned will always be 'PRODUCTION'.
26
24
  attr_reader :environment
27
25
  # @return [DateTime]
28
26
  attr_reader :created
@@ -49,10 +47,7 @@ module Vellum
49
47
  # @param status [Vellum::EntityStatus] The current status of the workflow deployment
50
48
  # * `ACTIVE` - Active
51
49
  # * `ARCHIVED` - Archived
52
- # @param environment [Vellum::EnvironmentEnum] The environment this workflow deployment is used in
53
- # * `DEVELOPMENT` - Development
54
- # * `STAGING` - Staging
55
- # * `PRODUCTION` - Production
50
+ # @param environment [Vellum::EnvironmentEnum] Deprecated. The value returned will always be 'PRODUCTION'.
56
51
  # @param created [DateTime]
57
52
  # @param last_deployed_on [DateTime]
58
53
  # @param input_variables [Array<Vellum::VellumVariable>] The input variables this Workflow Deployment expects to receive values for when
@@ -8,7 +8,7 @@ module Vellum
8
8
  class SpanLink
9
9
  # @return [String]
10
10
  attr_reader :trace_id
11
- # @return [Vellum::SPAN_LINK_TYPE_ENUM]
11
+ # @return [Vellum::SpanLinkTypeEnum]
12
12
  attr_reader :type
13
13
  # @return [Vellum::ParentContext]
14
14
  attr_reader :span_context
@@ -21,7 +21,7 @@ module Vellum
21
21
  OMIT = Object.new
22
22
 
23
23
  # @param trace_id [String]
24
- # @param type [Vellum::SPAN_LINK_TYPE_ENUM]
24
+ # @param type [Vellum::SpanLinkTypeEnum]
25
25
  # @param span_context [Vellum::ParentContext]
26
26
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
27
  # @return [Vellum::SpanLink]
@@ -68,7 +68,7 @@ module Vellum
68
68
  # @return [Void]
69
69
  def self.validate_raw(obj:)
70
70
  obj.trace_id.is_a?(String) != false || raise("Passed value for field obj.trace_id is not the expected type, validation failed.")
71
- obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
71
+ obj.type.is_a?(Vellum::SpanLinkTypeEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
72
72
  Vellum::ParentContext.validate_raw(obj: obj.span_context)
73
73
  end
74
74
  end
@@ -1,5 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vellum
4
- SPAN_LINK_TYPE_ENUM = String
4
+ # * `TRIGGERED_BY` - TRIGGERED_BY
5
+ # * `PREVIOUS_SPAN` - PREVIOUS_SPAN
6
+ # * `ROOT_SPAN` - ROOT_SPAN
7
+ class SpanLinkTypeEnum
8
+
9
+ TRIGGERED_BY = "TRIGGERED_BY"
10
+ PREVIOUS_SPAN = "PREVIOUS_SPAN"
11
+ ROOT_SPAN = "ROOT_SPAN"
12
+
13
+ end
5
14
  end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_audio"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # An audio value for a variable in a Test Case.
8
+ class TestCaseAudioVariableValue
9
+ # @return [String]
10
+ attr_reader :variable_id
11
+ # @return [String]
12
+ attr_reader :name
13
+ # @return [String]
14
+ attr_reader :type
15
+ # @return [Vellum::VellumAudio]
16
+ attr_reader :value
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
25
+ # @param variable_id [String]
26
+ # @param name [String]
27
+ # @param type [String]
28
+ # @param value [Vellum::VellumAudio]
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Vellum::TestCaseAudioVariableValue]
31
+ def initialize(variable_id:, name: OMIT, type:, value:, additional_properties: nil)
32
+ @variable_id = variable_id
33
+ @name = name if name != OMIT
34
+ @type = type
35
+ @value = value
36
+ @additional_properties = additional_properties
37
+ @_field_set = { "variable_id": variable_id, "name": name, "type": type, "value": value }.reject do | _k, v |
38
+ v == OMIT
39
+ end
40
+ end
41
+ # Deserialize a JSON object to an instance of TestCaseAudioVariableValue
42
+ #
43
+ # @param json_object [String]
44
+ # @return [Vellum::TestCaseAudioVariableValue]
45
+ def self.from_json(json_object:)
46
+ struct = JSON.parse(json_object, object_class: OpenStruct)
47
+ parsed_json = JSON.parse(json_object)
48
+ variable_id = parsed_json["variable_id"]
49
+ name = parsed_json["name"]
50
+ type = parsed_json["type"]
51
+ unless parsed_json["value"].nil?
52
+ value = parsed_json["value"].to_json
53
+ value = Vellum::VellumAudio.from_json(json_object: value)
54
+ else
55
+ value = nil
56
+ end
57
+ new(
58
+ variable_id: variable_id,
59
+ name: name,
60
+ type: type,
61
+ value: value,
62
+ additional_properties: struct
63
+ )
64
+ end
65
+ # Serialize an instance of TestCaseAudioVariableValue to a JSON object
66
+ #
67
+ # @return [String]
68
+ def to_json
69
+ @_field_set&.to_json
70
+ end
71
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
72
+ # hash and check each fields type against the current object's property
73
+ # definitions.
74
+ #
75
+ # @param obj [Object]
76
+ # @return [Void]
77
+ def self.validate_raw(obj:)
78
+ obj.variable_id.is_a?(String) != false || raise("Passed value for field obj.variable_id is not the expected type, validation failed.")
79
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
80
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
81
+ Vellum::VellumAudio.validate_raw(obj: obj.value)
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_document"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A document value for a variable in a Test Case.
8
+ class TestCaseDocumentVariableValue
9
+ # @return [String]
10
+ attr_reader :variable_id
11
+ # @return [String]
12
+ attr_reader :name
13
+ # @return [String]
14
+ attr_reader :type
15
+ # @return [Vellum::VellumDocument]
16
+ attr_reader :value
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
25
+ # @param variable_id [String]
26
+ # @param name [String]
27
+ # @param type [String]
28
+ # @param value [Vellum::VellumDocument]
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Vellum::TestCaseDocumentVariableValue]
31
+ def initialize(variable_id:, name: OMIT, type:, value:, additional_properties: nil)
32
+ @variable_id = variable_id
33
+ @name = name if name != OMIT
34
+ @type = type
35
+ @value = value
36
+ @additional_properties = additional_properties
37
+ @_field_set = { "variable_id": variable_id, "name": name, "type": type, "value": value }.reject do | _k, v |
38
+ v == OMIT
39
+ end
40
+ end
41
+ # Deserialize a JSON object to an instance of TestCaseDocumentVariableValue
42
+ #
43
+ # @param json_object [String]
44
+ # @return [Vellum::TestCaseDocumentVariableValue]
45
+ def self.from_json(json_object:)
46
+ struct = JSON.parse(json_object, object_class: OpenStruct)
47
+ parsed_json = JSON.parse(json_object)
48
+ variable_id = parsed_json["variable_id"]
49
+ name = parsed_json["name"]
50
+ type = parsed_json["type"]
51
+ unless parsed_json["value"].nil?
52
+ value = parsed_json["value"].to_json
53
+ value = Vellum::VellumDocument.from_json(json_object: value)
54
+ else
55
+ value = nil
56
+ end
57
+ new(
58
+ variable_id: variable_id,
59
+ name: name,
60
+ type: type,
61
+ value: value,
62
+ additional_properties: struct
63
+ )
64
+ end
65
+ # Serialize an instance of TestCaseDocumentVariableValue to a JSON object
66
+ #
67
+ # @return [String]
68
+ def to_json
69
+ @_field_set&.to_json
70
+ end
71
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
72
+ # hash and check each fields type against the current object's property
73
+ # definitions.
74
+ #
75
+ # @param obj [Object]
76
+ # @return [Void]
77
+ def self.validate_raw(obj:)
78
+ obj.variable_id.is_a?(String) != false || raise("Passed value for field obj.variable_id is not the expected type, validation failed.")
79
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
80
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
81
+ Vellum::VellumDocument.validate_raw(obj: obj.value)
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_image"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # An image value for a variable in a Test Case.
8
+ class TestCaseImageVariableValue
9
+ # @return [String]
10
+ attr_reader :variable_id
11
+ # @return [String]
12
+ attr_reader :name
13
+ # @return [String]
14
+ attr_reader :type
15
+ # @return [Vellum::VellumImage]
16
+ attr_reader :value
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
25
+ # @param variable_id [String]
26
+ # @param name [String]
27
+ # @param type [String]
28
+ # @param value [Vellum::VellumImage]
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Vellum::TestCaseImageVariableValue]
31
+ def initialize(variable_id:, name: OMIT, type:, value:, additional_properties: nil)
32
+ @variable_id = variable_id
33
+ @name = name if name != OMIT
34
+ @type = type
35
+ @value = value
36
+ @additional_properties = additional_properties
37
+ @_field_set = { "variable_id": variable_id, "name": name, "type": type, "value": value }.reject do | _k, v |
38
+ v == OMIT
39
+ end
40
+ end
41
+ # Deserialize a JSON object to an instance of TestCaseImageVariableValue
42
+ #
43
+ # @param json_object [String]
44
+ # @return [Vellum::TestCaseImageVariableValue]
45
+ def self.from_json(json_object:)
46
+ struct = JSON.parse(json_object, object_class: OpenStruct)
47
+ parsed_json = JSON.parse(json_object)
48
+ variable_id = parsed_json["variable_id"]
49
+ name = parsed_json["name"]
50
+ type = parsed_json["type"]
51
+ unless parsed_json["value"].nil?
52
+ value = parsed_json["value"].to_json
53
+ value = Vellum::VellumImage.from_json(json_object: value)
54
+ else
55
+ value = nil
56
+ end
57
+ new(
58
+ variable_id: variable_id,
59
+ name: name,
60
+ type: type,
61
+ value: value,
62
+ additional_properties: struct
63
+ )
64
+ end
65
+ # Serialize an instance of TestCaseImageVariableValue to a JSON object
66
+ #
67
+ # @return [String]
68
+ def to_json
69
+ @_field_set&.to_json
70
+ end
71
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
72
+ # hash and check each fields type against the current object's property
73
+ # definitions.
74
+ #
75
+ # @param obj [Object]
76
+ # @return [Void]
77
+ def self.validate_raw(obj:)
78
+ obj.variable_id.is_a?(String) != false || raise("Passed value for field obj.variable_id is not the expected type, validation failed.")
79
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
80
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
81
+ Vellum::VellumImage.validate_raw(obj: obj.value)
82
+ end
83
+ end
84
+ end
@@ -8,6 +8,10 @@ require_relative "test_case_search_results_variable_value"
8
8
  require_relative "test_case_error_variable_value"
9
9
  require_relative "test_case_function_call_variable_value"
10
10
  require_relative "test_case_array_variable_value"
11
+ require_relative "test_case_audio_variable_value"
12
+ require_relative "test_case_image_variable_value"
13
+ require_relative "test_case_video_variable_value"
14
+ require_relative "test_case_document_variable_value"
11
15
 
12
16
  module Vellum
13
17
  class TestCaseVariableValue
@@ -95,6 +99,46 @@ end
95
99
  return Vellum::TestCaseArrayVariableValue.from_json(json_object: struct)
96
100
  else
97
101
  return nil
102
+ end
103
+ rescue StandardError
104
+ # noop
105
+ end
106
+ begin
107
+ Vellum::TestCaseAudioVariableValue.validate_raw(obj: struct)
108
+ unless struct.nil?
109
+ return Vellum::TestCaseAudioVariableValue.from_json(json_object: struct)
110
+ else
111
+ return nil
112
+ end
113
+ rescue StandardError
114
+ # noop
115
+ end
116
+ begin
117
+ Vellum::TestCaseImageVariableValue.validate_raw(obj: struct)
118
+ unless struct.nil?
119
+ return Vellum::TestCaseImageVariableValue.from_json(json_object: struct)
120
+ else
121
+ return nil
122
+ end
123
+ rescue StandardError
124
+ # noop
125
+ end
126
+ begin
127
+ Vellum::TestCaseVideoVariableValue.validate_raw(obj: struct)
128
+ unless struct.nil?
129
+ return Vellum::TestCaseVideoVariableValue.from_json(json_object: struct)
130
+ else
131
+ return nil
132
+ end
133
+ rescue StandardError
134
+ # noop
135
+ end
136
+ begin
137
+ Vellum::TestCaseDocumentVariableValue.validate_raw(obj: struct)
138
+ unless struct.nil?
139
+ return Vellum::TestCaseDocumentVariableValue.from_json(json_object: struct)
140
+ else
141
+ return nil
98
142
  end
99
143
  rescue StandardError
100
144
  # noop
@@ -148,6 +192,26 @@ end
148
192
  rescue StandardError
149
193
  # noop
150
194
  end
195
+ begin
196
+ return Vellum::TestCaseAudioVariableValue.validate_raw(obj: obj)
197
+ rescue StandardError
198
+ # noop
199
+ end
200
+ begin
201
+ return Vellum::TestCaseImageVariableValue.validate_raw(obj: obj)
202
+ rescue StandardError
203
+ # noop
204
+ end
205
+ begin
206
+ return Vellum::TestCaseVideoVariableValue.validate_raw(obj: obj)
207
+ rescue StandardError
208
+ # noop
209
+ end
210
+ begin
211
+ return Vellum::TestCaseDocumentVariableValue.validate_raw(obj: obj)
212
+ rescue StandardError
213
+ # noop
214
+ end
151
215
  raise("Passed value matched no type within the union, validation failed.")
152
216
  end
153
217
  end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A video value for a variable in a Test Case.
8
+ class TestCaseVideoVariableValue
9
+ # @return [String]
10
+ attr_reader :variable_id
11
+ # @return [String]
12
+ attr_reader :name
13
+ # @return [String]
14
+ attr_reader :type
15
+ # @return [Vellum::VellumVideo]
16
+ attr_reader :value
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
25
+ # @param variable_id [String]
26
+ # @param name [String]
27
+ # @param type [String]
28
+ # @param value [Vellum::VellumVideo]
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Vellum::TestCaseVideoVariableValue]
31
+ def initialize(variable_id:, name: OMIT, type:, value:, additional_properties: nil)
32
+ @variable_id = variable_id
33
+ @name = name if name != OMIT
34
+ @type = type
35
+ @value = value
36
+ @additional_properties = additional_properties
37
+ @_field_set = { "variable_id": variable_id, "name": name, "type": type, "value": value }.reject do | _k, v |
38
+ v == OMIT
39
+ end
40
+ end
41
+ # Deserialize a JSON object to an instance of TestCaseVideoVariableValue
42
+ #
43
+ # @param json_object [String]
44
+ # @return [Vellum::TestCaseVideoVariableValue]
45
+ def self.from_json(json_object:)
46
+ struct = JSON.parse(json_object, object_class: OpenStruct)
47
+ parsed_json = JSON.parse(json_object)
48
+ variable_id = parsed_json["variable_id"]
49
+ name = parsed_json["name"]
50
+ type = parsed_json["type"]
51
+ unless parsed_json["value"].nil?
52
+ value = parsed_json["value"].to_json
53
+ value = Vellum::VellumVideo.from_json(json_object: value)
54
+ else
55
+ value = nil
56
+ end
57
+ new(
58
+ variable_id: variable_id,
59
+ name: name,
60
+ type: type,
61
+ value: value,
62
+ additional_properties: struct
63
+ )
64
+ end
65
+ # Serialize an instance of TestCaseVideoVariableValue to a JSON object
66
+ #
67
+ # @return [String]
68
+ def to_json
69
+ @_field_set&.to_json
70
+ end
71
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
72
+ # hash and check each fields type against the current object's property
73
+ # definitions.
74
+ #
75
+ # @param obj [Object]
76
+ # @return [Void]
77
+ def self.validate_raw(obj:)
78
+ obj.variable_id.is_a?(String) != false || raise("Passed value for field obj.variable_id is not the expected type, validation failed.")
79
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
80
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
81
+ Vellum::VellumVideo.validate_raw(obj: obj.value)
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A user input representing a Vellum Video value
8
+ class VideoInput
9
+ # @return [String] The variable's name
10
+ attr_reader :name
11
+ # @return [String]
12
+ attr_reader :type
13
+ # @return [Vellum::VellumVideo]
14
+ attr_reader :value
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param name [String] The variable's name
24
+ # @param type [String]
25
+ # @param value [Vellum::VellumVideo]
26
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
+ # @return [Vellum::VideoInput]
28
+ def initialize(name:, type:, value:, additional_properties: nil)
29
+ @name = name
30
+ @type = type
31
+ @value = value
32
+ @additional_properties = additional_properties
33
+ @_field_set = { "name": name, "type": type, "value": value }
34
+ end
35
+ # Deserialize a JSON object to an instance of VideoInput
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Vellum::VideoInput]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ name = parsed_json["name"]
43
+ type = parsed_json["type"]
44
+ unless parsed_json["value"].nil?
45
+ value = parsed_json["value"].to_json
46
+ value = Vellum::VellumVideo.from_json(json_object: value)
47
+ else
48
+ value = nil
49
+ end
50
+ new(
51
+ name: name,
52
+ type: type,
53
+ value: value,
54
+ additional_properties: struct
55
+ )
56
+ end
57
+ # Serialize an instance of VideoInput to a JSON object
58
+ #
59
+ # @return [String]
60
+ def to_json
61
+ @_field_set&.to_json
62
+ end
63
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
64
+ # hash and check each fields type against the current object's property
65
+ # definitions.
66
+ #
67
+ # @param obj [Object]
68
+ # @return [Void]
69
+ def self.validate_raw(obj:)
70
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
71
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
72
+ Vellum::VellumVideo.validate_raw(obj: obj.value)
73
+ end
74
+ end
75
+ end