vellum_ai 1.1.2 → 1.1.4

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.
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Vellum
6
+ class VellumVideo
7
+ # @return [String] A valid data URL containing the video data.
8
+ attr_reader :src
9
+ # @return [Hash{String => Object}]
10
+ attr_reader :metadata
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param src [String] A valid data URL containing the video data.
20
+ # @param metadata [Hash{String => Object}]
21
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
+ # @return [Vellum::VellumVideo]
23
+ def initialize(src:, metadata: OMIT, additional_properties: nil)
24
+ @src = src
25
+ @metadata = metadata if metadata != OMIT
26
+ @additional_properties = additional_properties
27
+ @_field_set = { "src": src, "metadata": metadata }.reject do | _k, v |
28
+ v == OMIT
29
+ end
30
+ end
31
+ # Deserialize a JSON object to an instance of VellumVideo
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Vellum::VellumVideo]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ src = parsed_json["src"]
39
+ metadata = parsed_json["metadata"]
40
+ new(
41
+ src: src,
42
+ metadata: metadata,
43
+ additional_properties: struct
44
+ )
45
+ end
46
+ # Serialize an instance of VellumVideo to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json
50
+ @_field_set&.to_json
51
+ end
52
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
53
+ # hash and check each fields type against the current object's property
54
+ # definitions.
55
+ #
56
+ # @param obj [Object]
57
+ # @return [Void]
58
+ def self.validate_raw(obj:)
59
+ obj.src.is_a?(String) != false || raise("Passed value for field obj.src is not the expected type, validation failed.")
60
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+ require "ostruct"
3
+ require "json"
4
+
5
+ module Vellum
6
+ class VellumVideoRequest
7
+ # @return [String] A valid data URL containing the video data.
8
+ attr_reader :src
9
+ # @return [Hash{String => Object}]
10
+ attr_reader :metadata
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param src [String] A valid data URL containing the video data.
20
+ # @param metadata [Hash{String => Object}]
21
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
22
+ # @return [Vellum::VellumVideoRequest]
23
+ def initialize(src:, metadata: OMIT, additional_properties: nil)
24
+ @src = src
25
+ @metadata = metadata if metadata != OMIT
26
+ @additional_properties = additional_properties
27
+ @_field_set = { "src": src, "metadata": metadata }.reject do | _k, v |
28
+ v == OMIT
29
+ end
30
+ end
31
+ # Deserialize a JSON object to an instance of VellumVideoRequest
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Vellum::VellumVideoRequest]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ src = parsed_json["src"]
39
+ metadata = parsed_json["metadata"]
40
+ new(
41
+ src: src,
42
+ metadata: metadata,
43
+ additional_properties: struct
44
+ )
45
+ end
46
+ # Serialize an instance of VellumVideoRequest to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json
50
+ @_field_set&.to_json
51
+ end
52
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
53
+ # hash and check each fields type against the current object's property
54
+ # definitions.
55
+ #
56
+ # @param obj [Object]
57
+ # @return [Void]
58
+ def self.validate_raw(obj:)
59
+ obj.src.is_a?(String) != false || raise("Passed value for field obj.src is not the expected type, validation failed.")
60
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A video value that is used in a chat message.
8
+ class VideoChatMessageContent
9
+ # @return [String]
10
+ attr_reader :type
11
+ # @return [Vellum::VellumVideo]
12
+ attr_reader :value
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param type [String]
22
+ # @param value [Vellum::VellumVideo]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Vellum::VideoChatMessageContent]
25
+ def initialize(type:, value:, additional_properties: nil)
26
+ @type = type
27
+ @value = value
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "type": type, "value": value }
30
+ end
31
+ # Deserialize a JSON object to an instance of VideoChatMessageContent
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Vellum::VideoChatMessageContent]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ type = parsed_json["type"]
39
+ unless parsed_json["value"].nil?
40
+ value = parsed_json["value"].to_json
41
+ value = Vellum::VellumVideo.from_json(json_object: value)
42
+ else
43
+ value = nil
44
+ end
45
+ new(
46
+ type: type,
47
+ value: value,
48
+ additional_properties: struct
49
+ )
50
+ end
51
+ # Serialize an instance of VideoChatMessageContent to a JSON object
52
+ #
53
+ # @return [String]
54
+ def to_json
55
+ @_field_set&.to_json
56
+ end
57
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
58
+ # hash and check each fields type against the current object's property
59
+ # definitions.
60
+ #
61
+ # @param obj [Object]
62
+ # @return [Void]
63
+ def self.validate_raw(obj:)
64
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
65
+ Vellum::VellumVideo.validate_raw(obj: obj.value)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video_request"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A video value that is used in a chat message.
8
+ class VideoChatMessageContentRequest
9
+ # @return [String]
10
+ attr_reader :type
11
+ # @return [Vellum::VellumVideoRequest]
12
+ attr_reader :value
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param type [String]
22
+ # @param value [Vellum::VellumVideoRequest]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Vellum::VideoChatMessageContentRequest]
25
+ def initialize(type:, value:, additional_properties: nil)
26
+ @type = type
27
+ @value = value
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "type": type, "value": value }
30
+ end
31
+ # Deserialize a JSON object to an instance of VideoChatMessageContentRequest
32
+ #
33
+ # @param json_object [String]
34
+ # @return [Vellum::VideoChatMessageContentRequest]
35
+ def self.from_json(json_object:)
36
+ struct = JSON.parse(json_object, object_class: OpenStruct)
37
+ parsed_json = JSON.parse(json_object)
38
+ type = parsed_json["type"]
39
+ unless parsed_json["value"].nil?
40
+ value = parsed_json["value"].to_json
41
+ value = Vellum::VellumVideoRequest.from_json(json_object: value)
42
+ else
43
+ value = nil
44
+ end
45
+ new(
46
+ type: type,
47
+ value: value,
48
+ additional_properties: struct
49
+ )
50
+ end
51
+ # Serialize an instance of VideoChatMessageContentRequest to a JSON object
52
+ #
53
+ # @return [String]
54
+ def to_json
55
+ @_field_set&.to_json
56
+ end
57
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
58
+ # hash and check each fields type against the current object's property
59
+ # definitions.
60
+ #
61
+ # @param obj [Object]
62
+ # @return [Void]
63
+ def self.validate_raw(obj:)
64
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
65
+ Vellum::VellumVideoRequest.validate_raw(obj: obj.value)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+ require_relative "prompt_block_state"
3
+ require_relative "ephemeral_prompt_cache_config"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Vellum
8
+ # A block that represents an video file in a prompt template.
9
+ class VideoPromptBlock
10
+ # @return [String]
11
+ attr_reader :block_type
12
+ # @return [Vellum::PromptBlockState]
13
+ attr_reader :state
14
+ # @return [Vellum::EphemeralPromptCacheConfig]
15
+ attr_reader :cache_config
16
+ # @return [String]
17
+ attr_reader :src
18
+ # @return [Hash{String => Object}]
19
+ attr_reader :metadata
20
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
21
+ attr_reader :additional_properties
22
+ # @return [Object]
23
+ attr_reader :_field_set
24
+ protected :_field_set
25
+
26
+ OMIT = Object.new
27
+
28
+ # @param block_type [String]
29
+ # @param state [Vellum::PromptBlockState]
30
+ # @param cache_config [Vellum::EphemeralPromptCacheConfig]
31
+ # @param src [String]
32
+ # @param metadata [Hash{String => Object}]
33
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
34
+ # @return [Vellum::VideoPromptBlock]
35
+ def initialize(block_type:, state: OMIT, cache_config: OMIT, src:, metadata: OMIT, additional_properties: nil)
36
+ @block_type = block_type
37
+ @state = state if state != OMIT
38
+ @cache_config = cache_config if cache_config != OMIT
39
+ @src = src
40
+ @metadata = metadata if metadata != OMIT
41
+ @additional_properties = additional_properties
42
+ @_field_set = { "block_type": block_type, "state": state, "cache_config": cache_config, "src": src, "metadata": metadata }.reject do | _k, v |
43
+ v == OMIT
44
+ end
45
+ end
46
+ # Deserialize a JSON object to an instance of VideoPromptBlock
47
+ #
48
+ # @param json_object [String]
49
+ # @return [Vellum::VideoPromptBlock]
50
+ def self.from_json(json_object:)
51
+ struct = JSON.parse(json_object, object_class: OpenStruct)
52
+ parsed_json = JSON.parse(json_object)
53
+ block_type = parsed_json["block_type"]
54
+ state = parsed_json["state"]
55
+ unless parsed_json["cache_config"].nil?
56
+ cache_config = parsed_json["cache_config"].to_json
57
+ cache_config = Vellum::EphemeralPromptCacheConfig.from_json(json_object: cache_config)
58
+ else
59
+ cache_config = nil
60
+ end
61
+ src = parsed_json["src"]
62
+ metadata = parsed_json["metadata"]
63
+ new(
64
+ block_type: block_type,
65
+ state: state,
66
+ cache_config: cache_config,
67
+ src: src,
68
+ metadata: metadata,
69
+ additional_properties: struct
70
+ )
71
+ end
72
+ # Serialize an instance of VideoPromptBlock to a JSON object
73
+ #
74
+ # @return [String]
75
+ def to_json
76
+ @_field_set&.to_json
77
+ end
78
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
79
+ # hash and check each fields type against the current object's property
80
+ # definitions.
81
+ #
82
+ # @param obj [Object]
83
+ # @return [Void]
84
+ def self.validate_raw(obj:)
85
+ obj.block_type.is_a?(String) != false || raise("Passed value for field obj.block_type is not the expected type, validation failed.")
86
+ obj.state&.is_a?(Vellum::PromptBlockState) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
87
+ obj.cache_config.nil? || Vellum::EphemeralPromptCacheConfig.validate_raw(obj: obj.cache_config)
88
+ obj.src.is_a?(String) != false || raise("Passed value for field obj.src is not the expected type, validation failed.")
89
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A base Vellum primitive value representing a video.
8
+ class VideoVellumValue
9
+ # @return [String]
10
+ attr_reader :type
11
+ # @return [Vellum::VellumVideo]
12
+ attr_reader :value
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param type [String]
22
+ # @param value [Vellum::VellumVideo]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Vellum::VideoVellumValue]
25
+ def initialize(type:, value: OMIT, additional_properties: nil)
26
+ @type = type
27
+ @value = value if value != OMIT
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "type": type, "value": value }.reject do | _k, v |
30
+ v == OMIT
31
+ end
32
+ end
33
+ # Deserialize a JSON object to an instance of VideoVellumValue
34
+ #
35
+ # @param json_object [String]
36
+ # @return [Vellum::VideoVellumValue]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
41
+ unless parsed_json["value"].nil?
42
+ value = parsed_json["value"].to_json
43
+ value = Vellum::VellumVideo.from_json(json_object: value)
44
+ else
45
+ value = nil
46
+ end
47
+ new(
48
+ type: type,
49
+ value: value,
50
+ additional_properties: struct
51
+ )
52
+ end
53
+ # Serialize an instance of VideoVellumValue to a JSON object
54
+ #
55
+ # @return [String]
56
+ def to_json
57
+ @_field_set&.to_json
58
+ end
59
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
60
+ # hash and check each fields type against the current object's property
61
+ # definitions.
62
+ #
63
+ # @param obj [Object]
64
+ # @return [Void]
65
+ def self.validate_raw(obj:)
66
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
67
+ obj.value.nil? || Vellum::VellumVideo.validate_raw(obj: obj.value)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ require_relative "vellum_video_request"
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vellum
7
+ # A base Vellum primitive value representing a video.
8
+ class VideoVellumValueRequest
9
+ # @return [String]
10
+ attr_reader :type
11
+ # @return [Vellum::VellumVideoRequest]
12
+ attr_reader :value
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param type [String]
22
+ # @param value [Vellum::VellumVideoRequest]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Vellum::VideoVellumValueRequest]
25
+ def initialize(type:, value: OMIT, additional_properties: nil)
26
+ @type = type
27
+ @value = value if value != OMIT
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "type": type, "value": value }.reject do | _k, v |
30
+ v == OMIT
31
+ end
32
+ end
33
+ # Deserialize a JSON object to an instance of VideoVellumValueRequest
34
+ #
35
+ # @param json_object [String]
36
+ # @return [Vellum::VideoVellumValueRequest]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
41
+ unless parsed_json["value"].nil?
42
+ value = parsed_json["value"].to_json
43
+ value = Vellum::VellumVideoRequest.from_json(json_object: value)
44
+ else
45
+ value = nil
46
+ end
47
+ new(
48
+ type: type,
49
+ value: value,
50
+ additional_properties: struct
51
+ )
52
+ end
53
+ # Serialize an instance of VideoVellumValueRequest to a JSON object
54
+ #
55
+ # @return [String]
56
+ def to_json
57
+ @_field_set&.to_json
58
+ end
59
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
60
+ # hash and check each fields type against the current object's property
61
+ # definitions.
62
+ #
63
+ # @param obj [Object]
64
+ # @return [Void]
65
+ def self.validate_raw(obj:)
66
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
67
+ obj.value.nil? || Vellum::VellumVideoRequest.validate_raw(obj: obj.value)
68
+ end
69
+ end
70
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative "vellum_workflow_execution_event"
3
3
  require_relative "workflow_execution_span_attributes"
4
+ require_relative "workflow_execution_usage_calculation_fulfilled_body"
4
5
  require "date"
5
6
  require "date"
6
7
  require "ostruct"
@@ -14,6 +15,8 @@ module Vellum
14
15
  attr_reader :events
15
16
  # @return [Vellum::WorkflowExecutionSpanAttributes]
16
17
  attr_reader :attributes
18
+ # @return [Vellum::WorkflowExecutionUsageCalculationFulfilledBody]
19
+ attr_reader :usage_result
17
20
  # @return [String]
18
21
  attr_reader :span_id
19
22
  # @return [DateTime]
@@ -33,22 +36,24 @@ module Vellum
33
36
  # @param name [String]
34
37
  # @param events [Array<Vellum::VellumWorkflowExecutionEvent>]
35
38
  # @param attributes [Vellum::WorkflowExecutionSpanAttributes]
39
+ # @param usage_result [Vellum::WorkflowExecutionUsageCalculationFulfilledBody]
36
40
  # @param span_id [String]
37
41
  # @param start_ts [DateTime]
38
42
  # @param end_ts [DateTime]
39
43
  # @param parent_span_id [String]
40
44
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
41
45
  # @return [Vellum::WorkflowExecutionSpan]
42
- def initialize(name:, events:, attributes:, span_id:, start_ts:, end_ts:, parent_span_id: OMIT, additional_properties: nil)
46
+ def initialize(name:, events:, attributes:, usage_result: OMIT, span_id:, start_ts:, end_ts:, parent_span_id: OMIT, additional_properties: nil)
43
47
  @name = name
44
48
  @events = events
45
49
  @attributes = attributes
50
+ @usage_result = usage_result if usage_result != OMIT
46
51
  @span_id = span_id
47
52
  @start_ts = start_ts
48
53
  @end_ts = end_ts
49
54
  @parent_span_id = parent_span_id if parent_span_id != OMIT
50
55
  @additional_properties = additional_properties
51
- @_field_set = { "name": name, "events": events, "attributes": attributes, "span_id": span_id, "start_ts": start_ts, "end_ts": end_ts, "parent_span_id": parent_span_id }.reject do | _k, v |
56
+ @_field_set = { "name": name, "events": events, "attributes": attributes, "usage_result": usage_result, "span_id": span_id, "start_ts": start_ts, "end_ts": end_ts, "parent_span_id": parent_span_id }.reject do | _k, v |
52
57
  v == OMIT
53
58
  end
54
59
  end
@@ -70,6 +75,12 @@ end
70
75
  else
71
76
  attributes = nil
72
77
  end
78
+ unless parsed_json["usage_result"].nil?
79
+ usage_result = parsed_json["usage_result"].to_json
80
+ usage_result = Vellum::WorkflowExecutionUsageCalculationFulfilledBody.from_json(json_object: usage_result)
81
+ else
82
+ usage_result = nil
83
+ end
73
84
  span_id = parsed_json["span_id"]
74
85
  start_ts = unless parsed_json["start_ts"].nil?
75
86
  DateTime.parse(parsed_json["start_ts"])
@@ -86,6 +97,7 @@ end
86
97
  name: name,
87
98
  events: events,
88
99
  attributes: attributes,
100
+ usage_result: usage_result,
89
101
  span_id: span_id,
90
102
  start_ts: start_ts,
91
103
  end_ts: end_ts,
@@ -109,6 +121,7 @@ end
109
121
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
110
122
  obj.events.is_a?(Array) != false || raise("Passed value for field obj.events is not the expected type, validation failed.")
111
123
  Vellum::WorkflowExecutionSpanAttributes.validate_raw(obj: obj.attributes)
124
+ obj.usage_result.nil? || Vellum::WorkflowExecutionUsageCalculationFulfilledBody.validate_raw(obj: obj.usage_result)
112
125
  obj.span_id.is_a?(String) != false || raise("Passed value for field obj.span_id is not the expected type, validation failed.")
113
126
  obj.start_ts.is_a?(DateTime) != false || raise("Passed value for field obj.start_ts is not the expected type, validation failed.")
114
127
  obj.end_ts.is_a?(DateTime) != false || raise("Passed value for field obj.end_ts is not the expected type, validation failed.")
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+ require_relative "ml_model_usage_wrapper"
3
+ require_relative "price"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Vellum
8
+ class WorkflowExecutionUsageCalculationFulfilledBody
9
+ # @return [Array<Vellum::MlModelUsageWrapper>]
10
+ attr_reader :usage
11
+ # @return [Array<Vellum::Price>]
12
+ attr_reader :cost
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param usage [Array<Vellum::MlModelUsageWrapper>]
22
+ # @param cost [Array<Vellum::Price>]
23
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
24
+ # @return [Vellum::WorkflowExecutionUsageCalculationFulfilledBody]
25
+ def initialize(usage:, cost:, additional_properties: nil)
26
+ @usage = usage
27
+ @cost = cost
28
+ @additional_properties = additional_properties
29
+ @_field_set = { "usage": usage, "cost": cost }
30
+ end
31
+ # Deserialize a JSON object to an instance of
32
+ # WorkflowExecutionUsageCalculationFulfilledBody
33
+ #
34
+ # @param json_object [String]
35
+ # @return [Vellum::WorkflowExecutionUsageCalculationFulfilledBody]
36
+ def self.from_json(json_object:)
37
+ struct = JSON.parse(json_object, object_class: OpenStruct)
38
+ parsed_json = JSON.parse(json_object)
39
+ usage = parsed_json["usage"]&.map do | item |
40
+ item = item.to_json
41
+ Vellum::MlModelUsageWrapper.from_json(json_object: item)
42
+ end
43
+ cost = parsed_json["cost"]&.map do | item |
44
+ item = item.to_json
45
+ Vellum::Price.from_json(json_object: item)
46
+ end
47
+ new(
48
+ usage: usage,
49
+ cost: cost,
50
+ additional_properties: struct
51
+ )
52
+ end
53
+ # Serialize an instance of WorkflowExecutionUsageCalculationFulfilledBody to a
54
+ # JSON object
55
+ #
56
+ # @return [String]
57
+ def to_json
58
+ @_field_set&.to_json
59
+ end
60
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
61
+ # hash and check each fields type against the current object's property
62
+ # definitions.
63
+ #
64
+ # @param obj [Object]
65
+ # @return [Void]
66
+ def self.validate_raw(obj:)
67
+ obj.usage.is_a?(Array) != false || raise("Passed value for field obj.usage is not the expected type, validation failed.")
68
+ obj.cost.is_a?(Array) != false || raise("Passed value for field obj.cost is not the expected type, validation failed.")
69
+ end
70
+ end
71
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vellum_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vellum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-07 00:00:00.000000000 Z
11
+ date: 2025-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -674,7 +674,14 @@ files:
674
674
  - lib/vellum_ai/types/vellum_variable.rb
675
675
  - lib/vellum_ai/types/vellum_variable_extensions.rb
676
676
  - lib/vellum_ai/types/vellum_variable_type.rb
677
+ - lib/vellum_ai/types/vellum_video.rb
678
+ - lib/vellum_ai/types/vellum_video_request.rb
677
679
  - lib/vellum_ai/types/vellum_workflow_execution_event.rb
680
+ - lib/vellum_ai/types/video_chat_message_content.rb
681
+ - lib/vellum_ai/types/video_chat_message_content_request.rb
682
+ - lib/vellum_ai/types/video_prompt_block.rb
683
+ - lib/vellum_ai/types/video_vellum_value.rb
684
+ - lib/vellum_ai/types/video_vellum_value_request.rb
678
685
  - lib/vellum_ai/types/workflow_deployment_event_executions_response.rb
679
686
  - lib/vellum_ai/types/workflow_deployment_history_item.rb
680
687
  - lib/vellum_ai/types/workflow_deployment_parent_context.rb
@@ -711,6 +718,7 @@ files:
711
718
  - lib/vellum_ai/types/workflow_execution_streaming_event.rb
712
719
  - lib/vellum_ai/types/workflow_execution_usage_calculation_error.rb
713
720
  - lib/vellum_ai/types/workflow_execution_usage_calculation_error_code_enum.rb
721
+ - lib/vellum_ai/types/workflow_execution_usage_calculation_fulfilled_body.rb
714
722
  - lib/vellum_ai/types/workflow_execution_usage_result.rb
715
723
  - lib/vellum_ai/types/workflow_execution_view_online_eval_metric_result.rb
716
724
  - lib/vellum_ai/types/workflow_execution_workflow_result_event.rb