vellum_ai 1.1.1 → 1.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c60bb87b4e771a019eaa0a772a90533ac33d355f1652063b71cdcbf3e9694ee4
4
- data.tar.gz: e62e6a6781fead3185fc64facb1365e11ab2d3235b630d7ae72347b62ef63649
3
+ metadata.gz: 841d875870666fa871285accb4516134253fa0d7b5043e32a87e60ec633e8c39
4
+ data.tar.gz: b52d5b47500d3750fde0e21c56a4e984077a7878e95fc8e292689a559b2fc2eb
5
5
  SHA512:
6
- metadata.gz: d98d1b22ede4c0caf3791cd4838bd775fd43366cfa9ba6f01a0e4b70d3ddd9e6a01ff94bddf1de80b7b4925b63e82c6fe82d935511b1110e0cb3209b17308f3e
7
- data.tar.gz: 74891a4a32674ad1dc3ad62feabc0a1dc7494dc344feb7496a236503f0f0377da5255972a00a69da2d2f019cbf70dd43f97dedcadfee96b76f622c6ff46cbeb1
6
+ metadata.gz: 41daeb1d91830eb951a97a16129330a56fea9c3fcef1cbdd6eafbb9da954955fd82689d761536a5403e9952021c8b3d7faa9f225d33f4c2528e373fba5161b0a
7
+ data.tar.gz: cf9e25869295d2e4f9ed65543a9de22745db4b03f3bced8163a4479ab7b2b7ec81550a027ac94d4fdeddd457f5bb38a4968626c0a670d96157ee0a7f745d5542
data/lib/requests.rb CHANGED
@@ -56,7 +56,7 @@ end
56
56
  end
57
57
  # @return [Hash{String => String}]
58
58
  def get_headers
59
- headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.1.1' }
59
+ headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.1.3' }
60
60
  headers["X-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
61
61
  headers
62
62
  end
@@ -107,7 +107,7 @@ end
107
107
  end
108
108
  # @return [Hash{String => String}]
109
109
  def get_headers
110
- headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.1.1' }
110
+ headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.1.3' }
111
111
  headers["X-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
112
112
  headers
113
113
  end
data/lib/types_export.rb CHANGED
@@ -27,14 +27,16 @@ require_relative "vellum_ai/types/api_version_enum"
27
27
  require_relative "vellum_ai/types/array_chat_message_content"
28
28
  require_relative "vellum_ai/types/string_chat_message_content"
29
29
  require_relative "vellum_ai/types/function_call_chat_message_content"
30
- require_relative "vellum_ai/types/image_chat_message_content"
31
30
  require_relative "vellum_ai/types/audio_chat_message_content"
31
+ require_relative "vellum_ai/types/video_chat_message_content"
32
+ require_relative "vellum_ai/types/image_chat_message_content"
32
33
  require_relative "vellum_ai/types/document_chat_message_content"
33
34
  require_relative "vellum_ai/types/array_chat_message_content_item"
34
35
  require_relative "vellum_ai/types/string_chat_message_content_request"
35
36
  require_relative "vellum_ai/types/function_call_chat_message_content_request"
36
- require_relative "vellum_ai/types/image_chat_message_content_request"
37
37
  require_relative "vellum_ai/types/audio_chat_message_content_request"
38
+ require_relative "vellum_ai/types/video_chat_message_content_request"
39
+ require_relative "vellum_ai/types/image_chat_message_content_request"
38
40
  require_relative "vellum_ai/types/document_chat_message_content_request"
39
41
  require_relative "vellum_ai/types/array_chat_message_content_item_request"
40
42
  require_relative "vellum_ai/types/array_chat_message_content_request"
@@ -331,6 +333,7 @@ require_relative "vellum_ai/types/price"
331
333
  require_relative "vellum_ai/types/processing_failure_reason_enum"
332
334
  require_relative "vellum_ai/types/variable_prompt_block"
333
335
  require_relative "vellum_ai/types/rich_text_prompt_block"
336
+ require_relative "vellum_ai/types/video_prompt_block"
334
337
  require_relative "vellum_ai/types/prompt_block"
335
338
  require_relative "vellum_ai/types/prompt_block_state"
336
339
  require_relative "vellum_ai/types/prompt_deployment_expand_meta_request"
@@ -528,11 +531,15 @@ require_relative "vellum_ai/types/vellum_sdk_error"
528
531
  require_relative "vellum_ai/types/vellum_sdk_error_code_enum"
529
532
  require_relative "vellum_ai/types/workflow_execution_span"
530
533
  require_relative "vellum_ai/types/vellum_span"
534
+ require_relative "vellum_ai/types/video_vellum_value"
531
535
  require_relative "vellum_ai/types/vellum_value"
536
+ require_relative "vellum_ai/types/video_vellum_value_request"
532
537
  require_relative "vellum_ai/types/vellum_value_request"
533
538
  require_relative "vellum_ai/types/vellum_variable"
534
539
  require_relative "vellum_ai/types/vellum_variable_extensions"
535
540
  require_relative "vellum_ai/types/vellum_variable_type"
541
+ require_relative "vellum_ai/types/vellum_video"
542
+ require_relative "vellum_ai/types/vellum_video_request"
536
543
  require_relative "vellum_ai/types/workflow_execution_initiated_event"
537
544
  require_relative "vellum_ai/types/workflow_execution_streaming_event"
538
545
  require_relative "vellum_ai/types/workflow_execution_fulfilled_event"
@@ -566,6 +573,7 @@ require_relative "vellum_ai/types/workflow_execution_span_attributes"
566
573
  require_relative "vellum_ai/types/workflow_execution_streaming_body"
567
574
  require_relative "vellum_ai/types/workflow_execution_usage_calculation_error"
568
575
  require_relative "vellum_ai/types/workflow_execution_usage_calculation_error_code_enum"
576
+ require_relative "vellum_ai/types/workflow_execution_usage_calculation_fulfilled_body"
569
577
  require_relative "vellum_ai/types/workflow_execution_usage_result"
570
578
  require_relative "vellum_ai/types/workflow_execution_view_online_eval_metric_result"
571
579
  require_relative "vellum_ai/types/workflow_execution_workflow_result_event"
@@ -2,8 +2,9 @@
2
2
  require "json"
3
3
  require_relative "string_chat_message_content"
4
4
  require_relative "function_call_chat_message_content"
5
- require_relative "image_chat_message_content"
6
5
  require_relative "audio_chat_message_content"
6
+ require_relative "video_chat_message_content"
7
+ require_relative "image_chat_message_content"
7
8
  require_relative "document_chat_message_content"
8
9
 
9
10
  module Vellum
@@ -37,9 +38,9 @@ end
37
38
  # noop
38
39
  end
39
40
  begin
40
- Vellum::ImageChatMessageContent.validate_raw(obj: struct)
41
+ Vellum::AudioChatMessageContent.validate_raw(obj: struct)
41
42
  unless struct.nil?
42
- return Vellum::ImageChatMessageContent.from_json(json_object: struct)
43
+ return Vellum::AudioChatMessageContent.from_json(json_object: struct)
43
44
  else
44
45
  return nil
45
46
  end
@@ -47,9 +48,19 @@ end
47
48
  # noop
48
49
  end
49
50
  begin
50
- Vellum::AudioChatMessageContent.validate_raw(obj: struct)
51
+ Vellum::VideoChatMessageContent.validate_raw(obj: struct)
51
52
  unless struct.nil?
52
- return Vellum::AudioChatMessageContent.from_json(json_object: struct)
53
+ return Vellum::VideoChatMessageContent.from_json(json_object: struct)
54
+ else
55
+ return nil
56
+ end
57
+ rescue StandardError
58
+ # noop
59
+ end
60
+ begin
61
+ Vellum::ImageChatMessageContent.validate_raw(obj: struct)
62
+ unless struct.nil?
63
+ return Vellum::ImageChatMessageContent.from_json(json_object: struct)
53
64
  else
54
65
  return nil
55
66
  end
@@ -86,12 +97,17 @@ end
86
97
  # noop
87
98
  end
88
99
  begin
89
- return Vellum::ImageChatMessageContent.validate_raw(obj: obj)
100
+ return Vellum::AudioChatMessageContent.validate_raw(obj: obj)
90
101
  rescue StandardError
91
102
  # noop
92
103
  end
93
104
  begin
94
- return Vellum::AudioChatMessageContent.validate_raw(obj: obj)
105
+ return Vellum::VideoChatMessageContent.validate_raw(obj: obj)
106
+ rescue StandardError
107
+ # noop
108
+ end
109
+ begin
110
+ return Vellum::ImageChatMessageContent.validate_raw(obj: obj)
95
111
  rescue StandardError
96
112
  # noop
97
113
  end
@@ -2,8 +2,9 @@
2
2
  require "json"
3
3
  require_relative "string_chat_message_content_request"
4
4
  require_relative "function_call_chat_message_content_request"
5
- require_relative "image_chat_message_content_request"
6
5
  require_relative "audio_chat_message_content_request"
6
+ require_relative "video_chat_message_content_request"
7
+ require_relative "image_chat_message_content_request"
7
8
  require_relative "document_chat_message_content_request"
8
9
 
9
10
  module Vellum
@@ -37,9 +38,9 @@ end
37
38
  # noop
38
39
  end
39
40
  begin
40
- Vellum::ImageChatMessageContentRequest.validate_raw(obj: struct)
41
+ Vellum::AudioChatMessageContentRequest.validate_raw(obj: struct)
41
42
  unless struct.nil?
42
- return Vellum::ImageChatMessageContentRequest.from_json(json_object: struct)
43
+ return Vellum::AudioChatMessageContentRequest.from_json(json_object: struct)
43
44
  else
44
45
  return nil
45
46
  end
@@ -47,9 +48,19 @@ end
47
48
  # noop
48
49
  end
49
50
  begin
50
- Vellum::AudioChatMessageContentRequest.validate_raw(obj: struct)
51
+ Vellum::VideoChatMessageContentRequest.validate_raw(obj: struct)
51
52
  unless struct.nil?
52
- return Vellum::AudioChatMessageContentRequest.from_json(json_object: struct)
53
+ return Vellum::VideoChatMessageContentRequest.from_json(json_object: struct)
54
+ else
55
+ return nil
56
+ end
57
+ rescue StandardError
58
+ # noop
59
+ end
60
+ begin
61
+ Vellum::ImageChatMessageContentRequest.validate_raw(obj: struct)
62
+ unless struct.nil?
63
+ return Vellum::ImageChatMessageContentRequest.from_json(json_object: struct)
53
64
  else
54
65
  return nil
55
66
  end
@@ -86,12 +97,17 @@ end
86
97
  # noop
87
98
  end
88
99
  begin
89
- return Vellum::ImageChatMessageContentRequest.validate_raw(obj: obj)
100
+ return Vellum::AudioChatMessageContentRequest.validate_raw(obj: obj)
90
101
  rescue StandardError
91
102
  # noop
92
103
  end
93
104
  begin
94
- return Vellum::AudioChatMessageContentRequest.validate_raw(obj: obj)
105
+ return Vellum::VideoChatMessageContentRequest.validate_raw(obj: obj)
106
+ rescue StandardError
107
+ # noop
108
+ end
109
+ begin
110
+ return Vellum::ImageChatMessageContentRequest.validate_raw(obj: obj)
95
111
  rescue StandardError
96
112
  # noop
97
113
  end
@@ -3,8 +3,9 @@ require "json"
3
3
  require_relative "string_chat_message_content"
4
4
  require_relative "function_call_chat_message_content"
5
5
  require_relative "array_chat_message_content"
6
- require_relative "image_chat_message_content"
7
6
  require_relative "audio_chat_message_content"
7
+ require_relative "video_chat_message_content"
8
+ require_relative "image_chat_message_content"
8
9
  require_relative "document_chat_message_content"
9
10
 
10
11
  module Vellum
@@ -48,9 +49,9 @@ end
48
49
  # noop
49
50
  end
50
51
  begin
51
- Vellum::ImageChatMessageContent.validate_raw(obj: struct)
52
+ Vellum::AudioChatMessageContent.validate_raw(obj: struct)
52
53
  unless struct.nil?
53
- return Vellum::ImageChatMessageContent.from_json(json_object: struct)
54
+ return Vellum::AudioChatMessageContent.from_json(json_object: struct)
54
55
  else
55
56
  return nil
56
57
  end
@@ -58,9 +59,19 @@ end
58
59
  # noop
59
60
  end
60
61
  begin
61
- Vellum::AudioChatMessageContent.validate_raw(obj: struct)
62
+ Vellum::VideoChatMessageContent.validate_raw(obj: struct)
62
63
  unless struct.nil?
63
- return Vellum::AudioChatMessageContent.from_json(json_object: struct)
64
+ return Vellum::VideoChatMessageContent.from_json(json_object: struct)
65
+ else
66
+ return nil
67
+ end
68
+ rescue StandardError
69
+ # noop
70
+ end
71
+ begin
72
+ Vellum::ImageChatMessageContent.validate_raw(obj: struct)
73
+ unless struct.nil?
74
+ return Vellum::ImageChatMessageContent.from_json(json_object: struct)
64
75
  else
65
76
  return nil
66
77
  end
@@ -102,12 +113,17 @@ end
102
113
  # noop
103
114
  end
104
115
  begin
105
- return Vellum::ImageChatMessageContent.validate_raw(obj: obj)
116
+ return Vellum::AudioChatMessageContent.validate_raw(obj: obj)
106
117
  rescue StandardError
107
118
  # noop
108
119
  end
109
120
  begin
110
- return Vellum::AudioChatMessageContent.validate_raw(obj: obj)
121
+ return Vellum::VideoChatMessageContent.validate_raw(obj: obj)
122
+ rescue StandardError
123
+ # noop
124
+ end
125
+ begin
126
+ return Vellum::ImageChatMessageContent.validate_raw(obj: obj)
111
127
  rescue StandardError
112
128
  # noop
113
129
  end
@@ -3,8 +3,9 @@ require "json"
3
3
  require_relative "string_chat_message_content_request"
4
4
  require_relative "function_call_chat_message_content_request"
5
5
  require_relative "array_chat_message_content_request"
6
- require_relative "image_chat_message_content_request"
7
6
  require_relative "audio_chat_message_content_request"
7
+ require_relative "video_chat_message_content_request"
8
+ require_relative "image_chat_message_content_request"
8
9
  require_relative "document_chat_message_content_request"
9
10
 
10
11
  module Vellum
@@ -48,9 +49,9 @@ end
48
49
  # noop
49
50
  end
50
51
  begin
51
- Vellum::ImageChatMessageContentRequest.validate_raw(obj: struct)
52
+ Vellum::AudioChatMessageContentRequest.validate_raw(obj: struct)
52
53
  unless struct.nil?
53
- return Vellum::ImageChatMessageContentRequest.from_json(json_object: struct)
54
+ return Vellum::AudioChatMessageContentRequest.from_json(json_object: struct)
54
55
  else
55
56
  return nil
56
57
  end
@@ -58,9 +59,19 @@ end
58
59
  # noop
59
60
  end
60
61
  begin
61
- Vellum::AudioChatMessageContentRequest.validate_raw(obj: struct)
62
+ Vellum::VideoChatMessageContentRequest.validate_raw(obj: struct)
62
63
  unless struct.nil?
63
- return Vellum::AudioChatMessageContentRequest.from_json(json_object: struct)
64
+ return Vellum::VideoChatMessageContentRequest.from_json(json_object: struct)
65
+ else
66
+ return nil
67
+ end
68
+ rescue StandardError
69
+ # noop
70
+ end
71
+ begin
72
+ Vellum::ImageChatMessageContentRequest.validate_raw(obj: struct)
73
+ unless struct.nil?
74
+ return Vellum::ImageChatMessageContentRequest.from_json(json_object: struct)
64
75
  else
65
76
  return nil
66
77
  end
@@ -102,12 +113,17 @@ end
102
113
  # noop
103
114
  end
104
115
  begin
105
- return Vellum::ImageChatMessageContentRequest.validate_raw(obj: obj)
116
+ return Vellum::AudioChatMessageContentRequest.validate_raw(obj: obj)
106
117
  rescue StandardError
107
118
  # noop
108
119
  end
109
120
  begin
110
- return Vellum::AudioChatMessageContentRequest.validate_raw(obj: obj)
121
+ return Vellum::VideoChatMessageContentRequest.validate_raw(obj: obj)
122
+ rescue StandardError
123
+ # noop
124
+ end
125
+ begin
126
+ return Vellum::ImageChatMessageContentRequest.validate_raw(obj: obj)
111
127
  rescue StandardError
112
128
  # noop
113
129
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative "vellum_node_execution_event"
3
3
  require_relative "node_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::NodeExecutionSpanAttributes]
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::VellumNodeExecutionEvent>]
35
38
  # @param attributes [Vellum::NodeExecutionSpanAttributes]
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::NodeExecutionSpan]
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::NodeExecutionSpanAttributes.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.")
@@ -4,8 +4,9 @@ require_relative "jinja_prompt_block"
4
4
  require_relative "chat_message_prompt_block"
5
5
  require_relative "variable_prompt_block"
6
6
  require_relative "rich_text_prompt_block"
7
- require_relative "audio_prompt_block"
8
7
  require_relative "function_call_prompt_block"
8
+ require_relative "audio_prompt_block"
9
+ require_relative "video_prompt_block"
9
10
  require_relative "image_prompt_block"
10
11
  require_relative "document_prompt_block"
11
12
 
@@ -55,6 +56,16 @@ end
55
56
  return Vellum::RichTextPromptBlock.from_json(json_object: struct)
56
57
  else
57
58
  return nil
59
+ end
60
+ rescue StandardError
61
+ # noop
62
+ end
63
+ begin
64
+ Vellum::FunctionCallPromptBlock.validate_raw(obj: struct)
65
+ unless struct.nil?
66
+ return Vellum::FunctionCallPromptBlock.from_json(json_object: struct)
67
+ else
68
+ return nil
58
69
  end
59
70
  rescue StandardError
60
71
  # noop
@@ -70,9 +81,9 @@ end
70
81
  # noop
71
82
  end
72
83
  begin
73
- Vellum::FunctionCallPromptBlock.validate_raw(obj: struct)
84
+ Vellum::VideoPromptBlock.validate_raw(obj: struct)
74
85
  unless struct.nil?
75
- return Vellum::FunctionCallPromptBlock.from_json(json_object: struct)
86
+ return Vellum::VideoPromptBlock.from_json(json_object: struct)
76
87
  else
77
88
  return nil
78
89
  end
@@ -128,13 +139,18 @@ end
128
139
  rescue StandardError
129
140
  # noop
130
141
  end
142
+ begin
143
+ return Vellum::FunctionCallPromptBlock.validate_raw(obj: obj)
144
+ rescue StandardError
145
+ # noop
146
+ end
131
147
  begin
132
148
  return Vellum::AudioPromptBlock.validate_raw(obj: obj)
133
149
  rescue StandardError
134
150
  # noop
135
151
  end
136
152
  begin
137
- return Vellum::FunctionCallPromptBlock.validate_raw(obj: obj)
153
+ return Vellum::VideoPromptBlock.validate_raw(obj: obj)
138
154
  rescue StandardError
139
155
  # noop
140
156
  end
@@ -3,8 +3,9 @@ require "json"
3
3
  require_relative "string_vellum_value"
4
4
  require_relative "number_vellum_value"
5
5
  require_relative "json_vellum_value"
6
- require_relative "image_vellum_value"
7
6
  require_relative "audio_vellum_value"
7
+ require_relative "video_vellum_value"
8
+ require_relative "image_vellum_value"
8
9
  require_relative "document_vellum_value"
9
10
  require_relative "function_call_vellum_value"
10
11
  require_relative "error_vellum_value"
@@ -54,9 +55,9 @@ end
54
55
  # noop
55
56
  end
56
57
  begin
57
- Vellum::ImageVellumValue.validate_raw(obj: struct)
58
+ Vellum::AudioVellumValue.validate_raw(obj: struct)
58
59
  unless struct.nil?
59
- return Vellum::ImageVellumValue.from_json(json_object: struct)
60
+ return Vellum::AudioVellumValue.from_json(json_object: struct)
60
61
  else
61
62
  return nil
62
63
  end
@@ -64,9 +65,19 @@ end
64
65
  # noop
65
66
  end
66
67
  begin
67
- Vellum::AudioVellumValue.validate_raw(obj: struct)
68
+ Vellum::VideoVellumValue.validate_raw(obj: struct)
68
69
  unless struct.nil?
69
- return Vellum::AudioVellumValue.from_json(json_object: struct)
70
+ return Vellum::VideoVellumValue.from_json(json_object: struct)
71
+ else
72
+ return nil
73
+ end
74
+ rescue StandardError
75
+ # noop
76
+ end
77
+ begin
78
+ Vellum::ImageVellumValue.validate_raw(obj: struct)
79
+ unless struct.nil?
80
+ return Vellum::ImageVellumValue.from_json(json_object: struct)
70
81
  else
71
82
  return nil
72
83
  end
@@ -168,12 +179,17 @@ end
168
179
  # noop
169
180
  end
170
181
  begin
171
- return Vellum::ImageVellumValue.validate_raw(obj: obj)
182
+ return Vellum::AudioVellumValue.validate_raw(obj: obj)
172
183
  rescue StandardError
173
184
  # noop
174
185
  end
175
186
  begin
176
- return Vellum::AudioVellumValue.validate_raw(obj: obj)
187
+ return Vellum::VideoVellumValue.validate_raw(obj: obj)
188
+ rescue StandardError
189
+ # noop
190
+ end
191
+ begin
192
+ return Vellum::ImageVellumValue.validate_raw(obj: obj)
177
193
  rescue StandardError
178
194
  # noop
179
195
  end
@@ -3,8 +3,9 @@ require "json"
3
3
  require_relative "string_vellum_value_request"
4
4
  require_relative "number_vellum_value_request"
5
5
  require_relative "json_vellum_value_request"
6
- require_relative "image_vellum_value_request"
7
6
  require_relative "audio_vellum_value_request"
7
+ require_relative "video_vellum_value_request"
8
+ require_relative "image_vellum_value_request"
8
9
  require_relative "document_vellum_value_request"
9
10
  require_relative "function_call_vellum_value_request"
10
11
  require_relative "error_vellum_value_request"
@@ -54,9 +55,9 @@ end
54
55
  # noop
55
56
  end
56
57
  begin
57
- Vellum::ImageVellumValueRequest.validate_raw(obj: struct)
58
+ Vellum::AudioVellumValueRequest.validate_raw(obj: struct)
58
59
  unless struct.nil?
59
- return Vellum::ImageVellumValueRequest.from_json(json_object: struct)
60
+ return Vellum::AudioVellumValueRequest.from_json(json_object: struct)
60
61
  else
61
62
  return nil
62
63
  end
@@ -64,9 +65,19 @@ end
64
65
  # noop
65
66
  end
66
67
  begin
67
- Vellum::AudioVellumValueRequest.validate_raw(obj: struct)
68
+ Vellum::VideoVellumValueRequest.validate_raw(obj: struct)
68
69
  unless struct.nil?
69
- return Vellum::AudioVellumValueRequest.from_json(json_object: struct)
70
+ return Vellum::VideoVellumValueRequest.from_json(json_object: struct)
71
+ else
72
+ return nil
73
+ end
74
+ rescue StandardError
75
+ # noop
76
+ end
77
+ begin
78
+ Vellum::ImageVellumValueRequest.validate_raw(obj: struct)
79
+ unless struct.nil?
80
+ return Vellum::ImageVellumValueRequest.from_json(json_object: struct)
70
81
  else
71
82
  return nil
72
83
  end
@@ -168,12 +179,17 @@ end
168
179
  # noop
169
180
  end
170
181
  begin
171
- return Vellum::ImageVellumValueRequest.validate_raw(obj: obj)
182
+ return Vellum::AudioVellumValueRequest.validate_raw(obj: obj)
172
183
  rescue StandardError
173
184
  # noop
174
185
  end
175
186
  begin
176
- return Vellum::AudioVellumValueRequest.validate_raw(obj: obj)
187
+ return Vellum::VideoVellumValueRequest.validate_raw(obj: obj)
188
+ rescue StandardError
189
+ # noop
190
+ end
191
+ begin
192
+ return Vellum::ImageVellumValueRequest.validate_raw(obj: obj)
177
193
  rescue StandardError
178
194
  # noop
179
195
  end
@@ -9,8 +9,9 @@ module Vellum
9
9
  # * `ERROR` - ERROR
10
10
  # * `ARRAY` - ARRAY
11
11
  # * `FUNCTION_CALL` - FUNCTION_CALL
12
- # * `IMAGE` - IMAGE
13
12
  # * `AUDIO` - AUDIO
13
+ # * `VIDEO` - VIDEO
14
+ # * `IMAGE` - IMAGE
14
15
  # * `DOCUMENT` - DOCUMENT
15
16
  # * `NULL` - NULL
16
17
  # * `THINKING` - THINKING
@@ -24,8 +25,9 @@ module Vellum
24
25
  ERROR = "ERROR"
25
26
  ARRAY = "ARRAY"
26
27
  FUNCTION_CALL = "FUNCTION_CALL"
27
- IMAGE = "IMAGE"
28
28
  AUDIO = "AUDIO"
29
+ VIDEO = "VIDEO"
30
+ IMAGE = "IMAGE"
29
31
  DOCUMENT = "DOCUMENT"
30
32
  NULL = "NULL"
31
33
  THINKING = "THINKING"
@@ -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.1
4
+ version: 1.1.3
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-06 00:00:00.000000000 Z
11
+ date: 2025-08-09 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