vellum_ai 0.3.10 → 0.3.12

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +10 -0
  4. data/lib/vellum_ai/deployments/client.rb +10 -4
  5. data/lib/vellum_ai/document_indexes/client.rb +150 -0
  6. data/lib/vellum_ai/types/array_variable_value_item.rb +13 -0
  7. data/lib/vellum_ai/types/chat_message.rb +9 -4
  8. data/lib/vellum_ai/types/chat_message_request.rb +9 -4
  9. data/lib/vellum_ai/types/execution_array_vellum_value.rb +59 -0
  10. data/lib/vellum_ai/types/execution_chat_history_vellum_value.rb +59 -0
  11. data/lib/vellum_ai/types/execution_error_vellum_value.rb +61 -0
  12. data/lib/vellum_ai/types/execution_function_call_vellum_value.rb +61 -0
  13. data/lib/vellum_ai/types/execution_json_vellum_value.rb +55 -0
  14. data/lib/vellum_ai/types/execution_number_vellum_value.rb +55 -0
  15. data/lib/vellum_ai/types/execution_search_results_vellum_value.rb +59 -0
  16. data/lib/vellum_ai/types/execution_string_vellum_value.rb +55 -0
  17. data/lib/vellum_ai/types/execution_vellum_value.rb +168 -0
  18. data/lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb +19 -5
  19. data/lib/vellum_ai/types/generate_request.rb +2 -2
  20. data/lib/vellum_ai/types/image_variable_value.rb +52 -0
  21. data/lib/vellum_ai/types/initiated_workflow_node_result_event.rb +11 -4
  22. data/lib/vellum_ai/types/prompt_template_block_properties.rb +10 -4
  23. data/lib/vellum_ai/types/prompt_template_block_properties_request.rb +10 -4
  24. data/lib/vellum_ai/types/rejected_workflow_node_result_event.rb +11 -4
  25. data/lib/vellum_ai/types/streaming_workflow_node_result_event.rb +12 -5
  26. data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +1 -0
  27. data/lib/vellum_ai/types/workflow_result_event.rb +15 -4
  28. data/lib/vellum_ai.rb +6 -6
  29. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ee15857c4f6d078afa21d87b58baf72fa919289417db31edd4d749d76616dac
4
- data.tar.gz: 2b3ef152052326857531cfcea45ee4baa5ec17285aeceab9f1e1fb42719e08f7
3
+ metadata.gz: 16e4f69f639b8fdda67360f5283624c0f67a2868d7d71ab0cacbbd8050197ed4
4
+ data.tar.gz: 95e1664aaa790b617c49298cb1c30102f449c0a965a51caea203ce8323daa99f
5
5
  SHA512:
6
- metadata.gz: 46b1deb69aee31554a0fef8440a43de43027687f2be4d39c39491a3b0221852961a00759ad42837ce6d2ad16a0aea89ecd2a7671e387e70fa3ac91c1093c7879
7
- data.tar.gz: d9325756359ce00b83ba6fa59f6ae988e801c04e420645ae653e43f592a5ae702caac0ccc00c58e026c2ce4f92bd0490c99a6cf25c1865e689e3295d47a5440e
6
+ metadata.gz: 29494e01a5d2cbf75ecf48411dbb0626518933bc071d295c31120f28375f900fe0212bc606c2b3454a56d461b0f68ba6fca19626cc77fc00912f7511095ec1b3
7
+ data.tar.gz: f7a4d4a5295bb48e3438612a5510a3fccf277dc2858ecdc966fb7992510e2ecb66f415e8fc931b10a2688e100aec741a764c4210d7ba3b9ca7adbd6692e954ec
data/lib/requests.rb CHANGED
@@ -20,7 +20,7 @@ module Vellum
20
20
  @headers = {
21
21
  "X-Fern-Language": "Ruby",
22
22
  "X-Fern-SDK-Name": "Vellum",
23
- "X-Fern-SDK-Version": "0.3.10",
23
+ "X-Fern-SDK-Version": "0.3.12",
24
24
  "X_API_KEY": api_key.to_s
25
25
  }
26
26
  @conn = Faraday.new(headers: @headers) do |faraday|
@@ -46,7 +46,7 @@ module Vellum
46
46
  @headers = {
47
47
  "X-Fern-Language": "Ruby",
48
48
  "X-Fern-SDK-Name": "Vellum",
49
- "X-Fern-SDK-Version": "0.3.10",
49
+ "X-Fern-SDK-Version": "0.3.12",
50
50
  "X_API_KEY": api_key.to_s
51
51
  }
52
52
  @conn = Faraday.new(headers: @headers) do |faraday|
data/lib/types_export.rb CHANGED
@@ -49,6 +49,15 @@ require_relative "vellum_ai/types/execute_workflow_error_response"
49
49
  require_relative "vellum_ai/types/execute_workflow_response"
50
50
  require_relative "vellum_ai/types/execute_workflow_stream_error_response"
51
51
  require_relative "vellum_ai/types/execute_workflow_workflow_result_event"
52
+ require_relative "vellum_ai/types/execution_array_vellum_value"
53
+ require_relative "vellum_ai/types/execution_chat_history_vellum_value"
54
+ require_relative "vellum_ai/types/execution_error_vellum_value"
55
+ require_relative "vellum_ai/types/execution_function_call_vellum_value"
56
+ require_relative "vellum_ai/types/execution_json_vellum_value"
57
+ require_relative "vellum_ai/types/execution_number_vellum_value"
58
+ require_relative "vellum_ai/types/execution_search_results_vellum_value"
59
+ require_relative "vellum_ai/types/execution_string_vellum_value"
60
+ require_relative "vellum_ai/types/execution_vellum_value"
52
61
  require_relative "vellum_ai/types/finish_reason_enum"
53
62
  require_relative "vellum_ai/types/fulfilled_enum"
54
63
  require_relative "vellum_ai/types/fulfilled_execute_prompt_event"
@@ -77,6 +86,7 @@ require_relative "vellum_ai/types/generate_stream_result_data"
77
86
  require_relative "vellum_ai/types/image_chat_message_content"
78
87
  require_relative "vellum_ai/types/image_chat_message_content_request"
79
88
  require_relative "vellum_ai/types/image_enum"
89
+ require_relative "vellum_ai/types/image_variable_value"
80
90
  require_relative "vellum_ai/types/indexing_state_enum"
81
91
  require_relative "vellum_ai/types/initiated_enum"
82
92
  require_relative "vellum_ai/types/initiated_execute_prompt_event"
@@ -60,9 +60,11 @@ module Vellum
60
60
  # @param deployment_id [String] The ID of the deployment. Must provide either this or deployment_name.
61
61
  # @param deployment_name [String] The name of the deployment. Must provide either this or deployment_id.
62
62
  # @param inputs [Array<Hash>] The list of inputs defined in the Prompt's deployment with their corresponding values.Request of type Array<PromptDeploymentInputRequest>, as a Hash
63
+ # @param release_tag [String] Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
63
64
  # @param request_options [RequestOptions]
64
65
  # @return [DeploymentProviderPayloadResponse]
65
- def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, request_options: nil)
66
+ def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil,
67
+ request_options: nil)
66
68
  response = @request_client.conn.post do |req|
67
69
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
68
70
  req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
@@ -71,7 +73,8 @@ module Vellum
71
73
  **(request_options&.additional_body_parameters || {}),
72
74
  deployment_id: deployment_id,
73
75
  deployment_name: deployment_name,
74
- inputs: inputs
76
+ inputs: inputs,
77
+ release_tag: release_tag
75
78
  }.compact
76
79
  req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload"
77
80
  end
@@ -134,9 +137,11 @@ module Vellum
134
137
  # @param deployment_id [String] The ID of the deployment. Must provide either this or deployment_name.
135
138
  # @param deployment_name [String] The name of the deployment. Must provide either this or deployment_id.
136
139
  # @param inputs [Array<Hash>] The list of inputs defined in the Prompt's deployment with their corresponding values.Request of type Array<PromptDeploymentInputRequest>, as a Hash
140
+ # @param release_tag [String] Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
137
141
  # @param request_options [RequestOptions]
138
142
  # @return [DeploymentProviderPayloadResponse]
139
- def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, request_options: nil)
143
+ def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil,
144
+ request_options: nil)
140
145
  Async do
141
146
  response = @request_client.conn.post do |req|
142
147
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -146,7 +151,8 @@ module Vellum
146
151
  **(request_options&.additional_body_parameters || {}),
147
152
  deployment_id: deployment_id,
148
153
  deployment_name: deployment_name,
149
- inputs: inputs
154
+ inputs: inputs,
155
+ release_tag: release_tag
150
156
  }.compact
151
157
  req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload"
152
158
  end
@@ -95,6 +95,78 @@ module Vellum
95
95
  end
96
96
  DocumentIndexRead.from_json(json_object: response.body)
97
97
  end
98
+
99
+ # Used to fully update a Document Index given its ID.
100
+ #
101
+ # @param id [String] A UUID string identifying this document index.
102
+ # @param label [String] A human-readable label for the document index
103
+ # @param status [ENTITY_STATUS] The current status of the document index
104
+ # * `ACTIVE` - Active
105
+ # * `ARCHIVED` - Archived
106
+ # @param environment [ENVIRONMENT_ENUM] The environment this document index is used in
107
+ # * `DEVELOPMENT` - Development
108
+ # * `STAGING` - Staging
109
+ # * `PRODUCTION` - Production
110
+ # @param request_options [RequestOptions]
111
+ # @return [DocumentIndexRead]
112
+ def update(id:, label:, status: nil, environment: nil, request_options: nil)
113
+ response = @request_client.conn.put do |req|
114
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
115
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
116
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
117
+ req.body = {
118
+ **(request_options&.additional_body_parameters || {}),
119
+ label: label,
120
+ status: status,
121
+ environment: environment
122
+ }.compact
123
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
124
+ end
125
+ DocumentIndexRead.from_json(json_object: response.body)
126
+ end
127
+
128
+ # Used to delete a Document Index given its ID.
129
+ #
130
+ # @param id [String] A UUID string identifying this document index.
131
+ # @param request_options [RequestOptions]
132
+ # @return [Void]
133
+ def destroy(id:, request_options: nil)
134
+ @request_client.conn.delete do |req|
135
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
136
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
137
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
138
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
139
+ end
140
+ end
141
+
142
+ # Used to partial update a Document Index given its ID.
143
+ #
144
+ # @param id [String] A UUID string identifying this document index.
145
+ # @param label [String] A human-readable label for the document index
146
+ # @param status [ENTITY_STATUS] The current status of the document index
147
+ # * `ACTIVE` - Active
148
+ # * `ARCHIVED` - Archived
149
+ # @param environment [ENVIRONMENT_ENUM] The environment this document index is used in
150
+ # * `DEVELOPMENT` - Development
151
+ # * `STAGING` - Staging
152
+ # * `PRODUCTION` - Production
153
+ # @param request_options [RequestOptions]
154
+ # @return [DocumentIndexRead]
155
+ def partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil)
156
+ response = @request_client.conn.patch do |req|
157
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
158
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
159
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
160
+ req.body = {
161
+ **(request_options&.additional_body_parameters || {}),
162
+ label: label,
163
+ status: status,
164
+ environment: environment
165
+ }.compact
166
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
167
+ end
168
+ DocumentIndexRead.from_json(json_object: response.body)
169
+ end
98
170
  end
99
171
 
100
172
  class AsyncDocumentIndexesClient
@@ -189,5 +261,83 @@ module Vellum
189
261
  DocumentIndexRead.from_json(json_object: response.body)
190
262
  end
191
263
  end
264
+
265
+ # Used to fully update a Document Index given its ID.
266
+ #
267
+ # @param id [String] A UUID string identifying this document index.
268
+ # @param label [String] A human-readable label for the document index
269
+ # @param status [ENTITY_STATUS] The current status of the document index
270
+ # * `ACTIVE` - Active
271
+ # * `ARCHIVED` - Archived
272
+ # @param environment [ENVIRONMENT_ENUM] The environment this document index is used in
273
+ # * `DEVELOPMENT` - Development
274
+ # * `STAGING` - Staging
275
+ # * `PRODUCTION` - Production
276
+ # @param request_options [RequestOptions]
277
+ # @return [DocumentIndexRead]
278
+ def update(id:, label:, status: nil, environment: nil, request_options: nil)
279
+ Async do
280
+ response = @request_client.conn.put do |req|
281
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
282
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
283
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
284
+ req.body = {
285
+ **(request_options&.additional_body_parameters || {}),
286
+ label: label,
287
+ status: status,
288
+ environment: environment
289
+ }.compact
290
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
291
+ end
292
+ DocumentIndexRead.from_json(json_object: response.body)
293
+ end
294
+ end
295
+
296
+ # Used to delete a Document Index given its ID.
297
+ #
298
+ # @param id [String] A UUID string identifying this document index.
299
+ # @param request_options [RequestOptions]
300
+ # @return [Void]
301
+ def destroy(id:, request_options: nil)
302
+ Async do
303
+ @request_client.conn.delete do |req|
304
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
305
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
306
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
307
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
308
+ end
309
+ end
310
+ end
311
+
312
+ # Used to partial update a Document Index given its ID.
313
+ #
314
+ # @param id [String] A UUID string identifying this document index.
315
+ # @param label [String] A human-readable label for the document index
316
+ # @param status [ENTITY_STATUS] The current status of the document index
317
+ # * `ACTIVE` - Active
318
+ # * `ARCHIVED` - Archived
319
+ # @param environment [ENVIRONMENT_ENUM] The environment this document index is used in
320
+ # * `DEVELOPMENT` - Development
321
+ # * `STAGING` - Staging
322
+ # * `PRODUCTION` - Production
323
+ # @param request_options [RequestOptions]
324
+ # @return [DocumentIndexRead]
325
+ def partial_update(id:, label: nil, status: nil, environment: nil, request_options: nil)
326
+ Async do
327
+ response = @request_client.conn.patch do |req|
328
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
329
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
330
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
331
+ req.body = {
332
+ **(request_options&.additional_body_parameters || {}),
333
+ label: label,
334
+ status: status,
335
+ environment: environment
336
+ }.compact
337
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes/#{id}"
338
+ end
339
+ DocumentIndexRead.from_json(json_object: response.body)
340
+ end
341
+ end
192
342
  end
193
343
  end
@@ -8,6 +8,7 @@ require_relative "chat_history_variable_value"
8
8
  require_relative "search_results_variable_value"
9
9
  require_relative "error_variable_value"
10
10
  require_relative "function_call_variable_value"
11
+ require_relative "image_variable_value"
11
12
 
12
13
  module Vellum
13
14
  class ArrayVariableValueItem
@@ -46,6 +47,8 @@ module Vellum
46
47
  ErrorVariableValue.from_json(json_object: json_object)
47
48
  when "FUNCTION_CALL"
48
49
  FunctionCallVariableValue.from_json(json_object: json_object)
50
+ when "IMAGE"
51
+ ImageVariableValue.from_json(json_object: json_object)
49
52
  else
50
53
  StringVariableValue.from_json(json_object: json_object)
51
54
  end
@@ -71,6 +74,8 @@ module Vellum
71
74
  { **@member.to_json, type: @discriminant }.to_json
72
75
  when "FUNCTION_CALL"
73
76
  { **@member.to_json, type: @discriminant }.to_json
77
+ when "IMAGE"
78
+ { **@member.to_json, type: @discriminant }.to_json
74
79
  else
75
80
  { "type": @discriminant, value: @member }.to_json
76
81
  end
@@ -97,6 +102,8 @@ module Vellum
97
102
  ErrorVariableValue.validate_raw(obj: obj)
98
103
  when "FUNCTION_CALL"
99
104
  FunctionCallVariableValue.validate_raw(obj: obj)
105
+ when "IMAGE"
106
+ ImageVariableValue.validate_raw(obj: obj)
100
107
  else
101
108
  raise("Passed value matched no type within the union, validation failed.")
102
109
  end
@@ -151,5 +158,11 @@ module Vellum
151
158
  def self.function_call(member:)
152
159
  new(member: member, discriminant: "FUNCTION_CALL")
153
160
  end
161
+
162
+ # @param member [ImageVariableValue]
163
+ # @return [ArrayVariableValueItem]
164
+ def self.image(member:)
165
+ new(member: member, discriminant: "IMAGE")
166
+ end
154
167
  end
155
168
  end
@@ -6,20 +6,23 @@ require "json"
6
6
 
7
7
  module Vellum
8
8
  class ChatMessage
9
- attr_reader :text, :role, :content, :additional_properties
9
+ attr_reader :text, :role, :content, :source, :additional_properties
10
10
 
11
11
  # @param text [String]
12
12
  # @param role [CHAT_MESSAGE_ROLE]
13
13
  # @param content [ChatMessageContent]
14
+ # @param source [String] An optional identifier representing who or what generated this message.
14
15
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
16
  # @return [ChatMessage]
16
- def initialize(role:, text: nil, content: nil, additional_properties: nil)
17
+ def initialize(role:, text: nil, content: nil, source: nil, additional_properties: nil)
17
18
  # @type [String]
18
19
  @text = text
19
20
  # @type [CHAT_MESSAGE_ROLE]
20
21
  @role = role
21
22
  # @type [ChatMessageContent]
22
23
  @content = content
24
+ # @type [String] An optional identifier representing who or what generated this message.
25
+ @source = source
23
26
  # @type [OpenStruct] Additional properties unmapped to the current class definition
24
27
  @additional_properties = additional_properties
25
28
  end
@@ -39,14 +42,15 @@ module Vellum
39
42
  content = parsed_json["content"].to_json
40
43
  content = ChatMessageContent.from_json(json_object: content)
41
44
  end
42
- new(text: text, role: role, content: content, additional_properties: struct)
45
+ source = struct.source
46
+ new(text: text, role: role, content: content, source: source, additional_properties: struct)
43
47
  end
44
48
 
45
49
  # Serialize an instance of ChatMessage to a JSON object
46
50
  #
47
51
  # @return [JSON]
48
52
  def to_json(*_args)
49
- { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content }.to_json
53
+ { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content, "source": @source }.to_json
50
54
  end
51
55
 
52
56
  # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
@@ -57,6 +61,7 @@ module Vellum
57
61
  obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
58
62
  obj.role.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
59
63
  obj.content.nil? || ChatMessageContent.validate_raw(obj: obj.content)
64
+ obj.source&.is_a?(String) != false || raise("Passed value for field obj.source is not the expected type, validation failed.")
60
65
  end
61
66
  end
62
67
  end
@@ -6,20 +6,23 @@ require "json"
6
6
 
7
7
  module Vellum
8
8
  class ChatMessageRequest
9
- attr_reader :text, :role, :content, :additional_properties
9
+ attr_reader :text, :role, :content, :source, :additional_properties
10
10
 
11
11
  # @param text [String]
12
12
  # @param role [CHAT_MESSAGE_ROLE]
13
13
  # @param content [ChatMessageContentRequest]
14
+ # @param source [String] An optional identifier representing who or what generated this message.
14
15
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
16
  # @return [ChatMessageRequest]
16
- def initialize(role:, text: nil, content: nil, additional_properties: nil)
17
+ def initialize(role:, text: nil, content: nil, source: nil, additional_properties: nil)
17
18
  # @type [String]
18
19
  @text = text
19
20
  # @type [CHAT_MESSAGE_ROLE]
20
21
  @role = role
21
22
  # @type [ChatMessageContentRequest]
22
23
  @content = content
24
+ # @type [String] An optional identifier representing who or what generated this message.
25
+ @source = source
23
26
  # @type [OpenStruct] Additional properties unmapped to the current class definition
24
27
  @additional_properties = additional_properties
25
28
  end
@@ -39,14 +42,15 @@ module Vellum
39
42
  content = parsed_json["content"].to_json
40
43
  content = ChatMessageContentRequest.from_json(json_object: content)
41
44
  end
42
- new(text: text, role: role, content: content, additional_properties: struct)
45
+ source = struct.source
46
+ new(text: text, role: role, content: content, source: source, additional_properties: struct)
43
47
  end
44
48
 
45
49
  # Serialize an instance of ChatMessageRequest to a JSON object
46
50
  #
47
51
  # @return [JSON]
48
52
  def to_json(*_args)
49
- { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content }.to_json
53
+ { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content, "source": @source }.to_json
50
54
  end
51
55
 
52
56
  # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
@@ -57,6 +61,7 @@ module Vellum
57
61
  obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
58
62
  obj.role.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
59
63
  obj.content.nil? || ChatMessageContentRequest.validate_raw(obj: obj.content)
64
+ obj.source&.is_a?(String) != false || raise("Passed value for field obj.source is not the expected type, validation failed.")
60
65
  end
61
66
  end
62
67
  end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "array_variable_value_item"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionArrayVellumValue
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String] The variable's uniquely identifying internal id.
11
+ # @param name [String]
12
+ # @param value [Array<ArrayVariableValueItem>]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionArrayVellumValue]
15
+ def initialize(id:, name:, value: nil, additional_properties: nil)
16
+ # @type [String] The variable's uniquely identifying internal id.
17
+ @id = id
18
+ # @type [String]
19
+ @name = name
20
+ # @type [Array<ArrayVariableValueItem>]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of ExecutionArrayVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionArrayVellumValue]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ value = parsed_json["value"].map do |v|
36
+ v = v.to_json
37
+ ArrayVariableValueItem.from_json(json_object: v)
38
+ end
39
+ new(id: id, name: name, value: value, additional_properties: struct)
40
+ end
41
+
42
+ # Serialize an instance of ExecutionArrayVellumValue to a JSON object
43
+ #
44
+ # @return [JSON]
45
+ def to_json(*_args)
46
+ { "id": @id, "name": @name, "value": @value }.to_json
47
+ end
48
+
49
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
50
+ #
51
+ # @param obj [Object]
52
+ # @return [Void]
53
+ def self.validate_raw(obj:)
54
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
55
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
56
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "chat_message"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionChatHistoryVellumValue
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String] The variable's uniquely identifying internal id.
11
+ # @param name [String]
12
+ # @param value [Array<ChatMessage>]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionChatHistoryVellumValue]
15
+ def initialize(id:, name:, value: nil, additional_properties: nil)
16
+ # @type [String] The variable's uniquely identifying internal id.
17
+ @id = id
18
+ # @type [String]
19
+ @name = name
20
+ # @type [Array<ChatMessage>]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of ExecutionChatHistoryVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionChatHistoryVellumValue]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ value = parsed_json["value"].map do |v|
36
+ v = v.to_json
37
+ ChatMessage.from_json(json_object: v)
38
+ end
39
+ new(id: id, name: name, value: value, additional_properties: struct)
40
+ end
41
+
42
+ # Serialize an instance of ExecutionChatHistoryVellumValue to a JSON object
43
+ #
44
+ # @return [JSON]
45
+ def to_json(*_args)
46
+ { "id": @id, "name": @name, "value": @value }.to_json
47
+ end
48
+
49
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
50
+ #
51
+ # @param obj [Object]
52
+ # @return [Void]
53
+ def self.validate_raw(obj:)
54
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
55
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
56
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "vellum_error"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionErrorVellumValue
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String] The variable's uniquely identifying internal id.
11
+ # @param name [String]
12
+ # @param value [VellumError]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionErrorVellumValue]
15
+ def initialize(id:, name:, value: nil, additional_properties: nil)
16
+ # @type [String] The variable's uniquely identifying internal id.
17
+ @id = id
18
+ # @type [String]
19
+ @name = name
20
+ # @type [VellumError]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of ExecutionErrorVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionErrorVellumValue]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ if parsed_json["value"].nil?
36
+ value = nil
37
+ else
38
+ value = parsed_json["value"].to_json
39
+ value = VellumError.from_json(json_object: value)
40
+ end
41
+ new(id: id, name: name, value: value, additional_properties: struct)
42
+ end
43
+
44
+ # Serialize an instance of ExecutionErrorVellumValue to a JSON object
45
+ #
46
+ # @return [JSON]
47
+ def to_json(*_args)
48
+ { "id": @id, "name": @name, "value": @value }.to_json
49
+ end
50
+
51
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
52
+ #
53
+ # @param obj [Object]
54
+ # @return [Void]
55
+ def self.validate_raw(obj:)
56
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
57
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
58
+ obj.value.nil? || VellumError.validate_raw(obj: obj.value)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "function_call"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionFunctionCallVellumValue
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String] The variable's uniquely identifying internal id.
11
+ # @param name [String]
12
+ # @param value [FunctionCall]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionFunctionCallVellumValue]
15
+ def initialize(id:, name:, value: nil, additional_properties: nil)
16
+ # @type [String] The variable's uniquely identifying internal id.
17
+ @id = id
18
+ # @type [String]
19
+ @name = name
20
+ # @type [FunctionCall]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of ExecutionFunctionCallVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionFunctionCallVellumValue]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ if parsed_json["value"].nil?
36
+ value = nil
37
+ else
38
+ value = parsed_json["value"].to_json
39
+ value = FunctionCall.from_json(json_object: value)
40
+ end
41
+ new(id: id, name: name, value: value, additional_properties: struct)
42
+ end
43
+
44
+ # Serialize an instance of ExecutionFunctionCallVellumValue to a JSON object
45
+ #
46
+ # @return [JSON]
47
+ def to_json(*_args)
48
+ { "id": @id, "name": @name, "value": @value }.to_json
49
+ end
50
+
51
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
52
+ #
53
+ # @param obj [Object]
54
+ # @return [Void]
55
+ def self.validate_raw(obj:)
56
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
57
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
58
+ obj.value.nil? || FunctionCall.validate_raw(obj: obj.value)
59
+ end
60
+ end
61
+ end